revertSnapshot fails with an NPE when the snapshot's volume has been deleted
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- backend-api-design, cloud
Direzione di ricerca
Start by reading SnapshotManagerImpl.revertSnapshot and the snapshot copy path that chooses a source zone; the issue identifies findById() as the lookup that returns null for removed volumes. Then inspect VolumeApiServiceImpl.allocVolume and TemplateManagerImpl.createPrivateTemplate for snapshot based creation when the volume row is missing. Add clear errors for the missing volume cases and use the snapshot's recorded zone for copy; done when all four API paths handle these cases without an NPE.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
problem
revertSnapshot fails with a NullPointerException when the snapshot's volume has been deleted:
Cannot invoke "com.cloud.storage.VolumeVO.getState()" because "volume" is null
at com.cloud.storage.snapshot.SnapshotManagerImpl.revertSnapshot
SnapshotManagerImpl.revertSnapshot looks the volume up with findById(), which does not return removed volumes, and uses the result without a null check. Volume snapshots outlive their volume, so any snapshot of a deleted volume hits this. The caller gets an internal error instead of being told why the snapshot cannot be reverted.
A few other snapshot APIs have the same gap:
copySnapshotwithoutsourcezoneidtakes the source zone from the volume, also looked up withfindById(). For a snapshot of a deleted volume it fails withCannot invoke "com.cloud.storage.Volume.getDataCenterId()" because "volume" is null. The copy itself does not need the volume, and the same copy works whensourcezoneidis passed.createVolumefrom a snapshot andcreateTemplatefrom a snapshot look the volume up including removed rows, so a deleted volume is fine. They still NPE when the volume row itself is gone (parentVolume.getPassphraseId()inVolumeApiServiceImpl.allocVolume; forcreateTemplate, the template record is created and the job then fails inTemplateManagerImpl.createPrivateTemplate). A missing row is the case in #14599.
versions
4.22, and main.
The steps to reproduce the bug
- Create a data volume, attach it to a VM, and take a volume snapshot of it.
- Detach and delete the volume. The snapshot remains.
- Call
revertSnapshot id=<snapshot>. It fails with the NPE above. - Call
copySnapshot id=<snapshot> destzoneids=<another zone>withoutsourcezoneid. It fails with thegetDataCenterId()NPE.
For createVolume snapshotid= and createTemplate snapshotid=, the volume row has to be missing from the volumes table.
What to do about it?
revertSnapshot: refuse with a clear error when the snapshot's volume no longer exists.copySnapshot: when the volume is gone, take the source zone from the snapshot, which records the zone it was taken in.createVolumeandcreateTemplatefrom a snapshot: refuse with a clear error when the volume row is missing, instead of failing with an NPE.
- Lingua principale
- Java
- Stelle
- 3.1k
- Fork
- 1.4k
- Merge medio
- 7g 16h
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/cloudstack
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new sizeForse già presa @bhouse-nexthop l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/cloudstack#14645 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replacedForse già presa @bhouse-nexthop l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/cloudstack#14633 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)Forse già presa @bhouse-nexthop l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/cloudstack#14631 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/cloudstack#14625 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)Forse già presa @willbennett-devops l’ha presa 12 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/cloudstack#14545 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/cloudstack
Issue simili
-
[Bug]: Nullable implicit operator on string extensible enums still throws for a null stringForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settingsApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationForse già presa @amalsaidov l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni