VR reports a load balancer change as applied when haproxy.cfg cannot be replaced

Abierto Apto para principiantes
#14,633 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Empieza con CsLoadBalancer.process() en systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py y sigue cómo gestiona el resultado de CsHelper.copy() después de validar haproxy.cfg.new con haproxy -c. Comprueba cómo se notifica una instalación fallida a la ejecución de configuración y compáralo con la ruta existente para los fallos de validación. Se considera terminado cuando un fallo de instalación hace que falle la aplicación, para que el servidor de gestión pueda revertir los cambios.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

problem

When a virtual router can't replace /etc/haproxy/haproxy.cfg, it still reports a load balancer config change as applied.

CsLoadBalancer.process() (systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py) writes the new config to haproxy.cfg.new, checks it with haproxy -c, and then installs it with CsHelper.copy(). CsHelper.copy() catches the IOError, logs Could not copy /etc/haproxy/haproxy.cfg.new to /etc/haproxy/haproxy.cfg, and returns. The router then reloads HAProxy, which reads the old file, and the config run ends successfully.

The management server therefore gets a successful answer, records the change as applied, and doesn't roll it back, while the router keeps serving the old configuration. A config that fails haproxy -c already makes the apply fail, so only this path is silent.

versions

4.22 (the code is the same on main).

The steps to reproduce the bug
  1. Create a load balancer rule on an isolated network or VPC served by a virtual router.
  2. On the router, make the config file unwritable, for example chattr +i /etc/haproxy/haproxy.cfg.
  3. Change the rule, for example updateLoadBalancerRule algorithm=leastconn, or add a rule.
  4. The API call succeeds and listLoadBalancerRules shows the new values. The router's /var/log/cloud.log has Could not copy /etc/haproxy/haproxy.cfg.new to /etc/haproxy/haproxy.cfg, and /etc/haproxy/haproxy.cfg still has the old config.
What to do about it?

Fail the apply when the new config can't be installed, the same way as when it fails haproxy -c, so that the management server sees the failure and rolls back.

Lenguaje dominante
Java
Estrellas
3.1k
Forks
1.4k
Merge medio
6 d 20 h
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/cloudstack

Todos los issues de apache/cloudstack

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.