mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8164: Look for all host to avoid NPE
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit a1a601be5a)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
cecab95cc9
commit
d8def3dc0b
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -760,6 +760,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…
Reference in New Issue