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

Aperta Adatta ai principianti
#14,633 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia con CsLoadBalancer.process() in systemvm/debian/opt/cloud/bin/cs/CsLoadBalancer.py e segui come viene gestito il risultato di CsHelper.copy() dopo aver convalidato haproxy.cfg.new con haproxy -c. Verifica come un’installazione non riuscita viene segnalata all’esecuzione della configurazione, quindi confrontala con il percorso esistente per gli errori di convalida. Il lavoro è completato quando un errore di installazione fa fallire l’applicazione, così che il server di gestione possa eseguire il rollback.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
3.1k
Fork
1.4k
Merge medio
6g 20h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/cloudstack

Tutte le issue di apache/cloudstack

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.