You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dbb2c6e
Browse filesBrowse the repository at this point in the historyBrowse files
Refuse snapshot operations cleanly when the volume is gone
revertSnapshot looked up the snapshot's volume with findById(), which
does not return removed volumes, and used it without a null check. Any
snapshot of a deleted volume therefore failed with an NPE on
VolumeVO.getState(). It now fails with an error saying the volume no
longer exists.
The same pattern elsewhere:
- copySnapshot without sourcezoneid took the source zone from the
volume, found the same way. For a deleted volume it now falls back
to the snapshot's own zone, which is the zone it was taken in.
- createVolume and createTemplate from a snapshot look the volume up
including removed rows, but still failed with an NPE when the row
itself is missing. They now refuse with a clear error.
Fixes#14644
Signed-off-by: Brad House <bhouse@nexthop.ai>
thrownewInvalidParameterValueException(String.format("Cannot create a volume from snapshot %s, because the volume it was taken from no longer exists", snapshotCheck.getUuid()));
906
+
}
904
907
905
908
// Don't support creating templates from encrypted volumes (yet)
Copy file name to clipboardExpand all lines: server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -377,6 +377,9 @@ public Snapshot revertSnapshot(Long snapshotId) {
377
377
thrownewInvalidParameterValueException(String.format("The snapshot [%s] is part of a [%s] snapshots and cannot be reverted separately", snapshot, snapshot.getTypeDescription()));
thrownewInvalidParameterValueException(String.format("Cannot create a Template from Snapshot %s, because the volume it was taken from no longer exists", snapshot.getUuid()));
2011
+
}
2009
2012
2010
2013
// Don't support creating templates from encrypted volumes (yet)
2011
-
if (volume != null && volume.getPassphraseId() != null) {
2014
+
if (volume.getPassphraseId() != null) {
2012
2015
thrownewUnsupportedOperationException("Cannot create Templates from Snapshots of encrypted volumes");
0 commit comments