restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)

Aperta Adatta ai principianti
#14,631 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
java
Ambito
api, cloud

Direzione di ricerca

Leggi RestartNetworkCmd.execute() e confronta la gestione delle eccezioni con quella di RestartVPCCmd.execute(), indicato nell’issue come riferimento. Controlla le eccezioni dichiarate in NetworkService.restartNetwork() e segui le corrispondenze degli errori descritte nel report. Il lavoro è completato quando gli stessi errori producono codici di errore API coerenti e i livelli di log previsti per entrambi i comandi di riavvio.

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

Descrizione

problem

A restartNetwork that fails with a ResourceUnavailableException is reported as an unexpected error, while the same failure from restartVPC is not.

RestartNetworkCmd.execute() doesn't catch the checked exceptions that NetworkService.restartNetwork() declares, so they reach ApiAsyncJobDispatcher. The dispatcher logs anything that isn't a ServerApiException at ERROR as Unexpected exception while executing ... RestartNetworkCmd, with a stack trace, and fails the job with error code 530.

RestartVPCCmd.execute() catches the same exceptions and maps them to ServerApiException: ResourceUnavailableException gives 534 at WARN, ConcurrentOperationException 530 and InsufficientCapacityException 533. API clients therefore see a different error code for the same condition depending on whether the network is in a VPC, and the management server log shows an ERROR for an expected refusal.

versions

4.22 (the code is the same on main).

The steps to reproduce the bug
  1. Make a network restart fail with a ResourceUnavailableException. For example, stop the CloudStack agent on the host that runs the network's router, so that the commands to the router fail with AgentUnavailableException, and call restartNetwork on that network.
  2. The async job fails with error code 530, and the management server logs Unexpected exception while executing org.apache.cloudstack.api.command.user.network.RestartNetworkCmd at ERROR.
  3. Do the same with restartVPC on a VPC: the job fails with 534, and the exception is logged at WARN.
What to do about it?

Catch the exceptions in RestartNetworkCmd.execute() the way RestartVPCCmd.execute() does.

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.