Skip to content

Commit 6a683dc

Browse files
authored
storage: Fixed null pointer (#4130)
Fixes #4090 When trying to migrate a VM across 2 clusters, if a snapshot has been deleted and garbage collection has run to update the removed field, it is not possible to migrate the instance due to a null pointer.
1 parent 8b234bd commit 6a683dc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotDataFactoryImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public List<SnapshotInfo> getSnapshots(long volumeId, DataStoreRole role) {
7373
for (SnapshotDataStoreVO snapshotDataStoreVO : allSnapshotsFromVolumeAndDataStore) {
7474
DataStore store = storeMgr.getDataStore(snapshotDataStoreVO.getDataStoreId(), role);
7575
SnapshotVO snapshot = snapshotDao.findById(snapshotDataStoreVO.getSnapshotId());
76+
if (snapshot == null){ //snapshot may have been removed;
77+
continue;
78+
}
7679
SnapshotObject info = SnapshotObject.getSnapshotObject(snapshot, store);
7780

7881
infos.add(info);

0 commit comments

Comments
 (0)