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

Ouverte Adaptée aux débutants
#14,633 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
78/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
backend, networking

Piste de recherche

Commencez par CsLoadBalancer.process() dans systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py et suivez la manière dont le résultat de CsHelper.copy() est traité après la validation de haproxy.cfg.new avec haproxy -c. Vérifiez comment un échec d’installation est signalé à l’exécution de configuration, puis comparez avec le chemin existant en cas d’échec de validation. Le travail est terminé lorsqu’un échec d’installation fait échouer l’application, afin que le serveur de gestion puisse effectuer un retour arrière.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Java
Étoiles
3.1k
Forks
1.4k
Merge moyen
6 j 20 h
PR mergées (30 j)
17

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de apache/cloudstack

Toutes les issues de apache/cloudstack

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.