revertSnapshot fails with an NPE when the snapshot's volume has been deleted
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- java
- Domínio
- backend-api-design, cloud
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 3.1k
- Forks
- 1.4k
- Merge médio
- 7d 16h
- PRs com merge (30d)
- 15
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/cloudstack
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new sizeTalvez já em andamento @bhouse-nexthop assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/cloudstack#14645 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replacedTalvez já em andamento @bhouse-nexthop assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/cloudstack#14633 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)Talvez já em andamento @bhouse-nexthop assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/cloudstack#14631 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
apache/cloudstack#14625 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)Talvez já em andamento @willbennett-devops assumiu há 12 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/cloudstack#14545 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/cloudstack
Issues semelhantes
-
[Bug]: Nullable implicit operator on string extensible enums still throws for a null stringTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertabug emitter:client:csharp
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
microsoft/typespec#12572 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settingsAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
Mantenedores costumam responder em até 1 dia
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationTalvez já em andamento @amalsaidov assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
needs-area-label
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 2 dias