mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8164: Look for all host to avoid NPE
(cherry picked from commit d8def3dc0b)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Conflicts:
engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java
This commit is contained in:
parent
2c7cacd9df
commit
969bbb02a9
|
|
@ -79,9 +79,9 @@ public class VMSnapshotHelperImpl implements VMSnapshotHelper {
|
|||
return vm.getHostId();
|
||||
|
||||
// check if lastHostId is available
|
||||
if(vm.getLastHostId() != null){
|
||||
HostVO lastHost = hostDao.findById(vm.getLastHostId());
|
||||
if(lastHost.getStatus() == com.cloud.host.Status.Up && !lastHost.isInMaintenanceStates())
|
||||
if (vm.getLastHostId() != null) {
|
||||
HostVO lastHost = hostDao.findByIdIncludingRemoved(vm.getLastHostId());
|
||||
if (lastHost.getStatus() == com.cloud.host.Status.Up && !lastHost.isInMaintenanceStates())
|
||||
return lastHost.getId();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -766,6 +766,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