mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
CLOUDSTACK-8164: Look for all host to avoid NPE
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
fd0eb6c29e
commit
a1a601be5a
@ -82,7 +82,7 @@ public class VMSnapshotHelperImpl implements VMSnapshotHelper {
|
||||
|
||||
// check if lastHostId is available
|
||||
if (vm.getLastHostId() != null) {
|
||||
HostVO lastHost = hostDao.findById(vm.getLastHostId());
|
||||
HostVO lastHost = hostDao.findByIdIncludingRemoved(vm.getLastHostId());
|
||||
if (lastHost.getStatus() == com.cloud.host.Status.Up && !lastHost.isInMaintenanceStates())
|
||||
return lastHost.getId();
|
||||
}
|
||||
|
||||
@ -748,6 +748,8 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
|
||||
if (jobResult != null) {
|
||||
if (jobResult instanceof ConcurrentOperationException)
|
||||
throw (ConcurrentOperationException)jobResult;
|
||||
else if (jobResult instanceof InvalidParameterValueException)
|
||||
throw (InvalidParameterValueException)jobResult;
|
||||
else if (jobResult instanceof Throwable)
|
||||
throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user