Skip to content

Commit 7699c70

Browse files
abhinandanprateekyadvr
authored andcommitted
CLOUDSTACK-8164: Look for all host to avoid NPE
(cherry picked from commit d8def3d) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 668541d commit 7699c70

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public Long pickRunningHost(Long vmId) {
8282

8383
// check if lastHostId is available
8484
if (vm.getLastHostId() != null) {
85-
HostVO lastHost = hostDao.findById(vm.getLastHostId());
85+
HostVO lastHost = hostDao.findByIdIncludingRemoved(vm.getLastHostId());
8686
if (lastHost.getStatus() == com.cloud.host.Status.Up && !lastHost.isInMaintenanceStates())
8787
return lastHost.getId();
8888
}

‎server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ public boolean deleteAllVMSnapshots(long vmId, VMSnapshot.Type type) {
745745
if (jobResult != null) {
746746
if (jobResult instanceof ConcurrentOperationException)
747747
throw (ConcurrentOperationException)jobResult;
748+
else if (jobResult instanceof InvalidParameterValueException)
749+
throw (InvalidParameterValueException)jobResult;
748750
else if (jobResult instanceof Throwable)
749751
throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
750752
}

0 commit comments

Comments
 (0)