CLOUDSTACK-6831 [Hyper-V] Improve the logging for VM snapshot failures as it is not supported. Right now it is throwing NPEs

This commit is contained in:
Rajesh Battala 2014-06-05 15:06:11 +05:30
parent 945e879bf2
commit d59cc1ff8f
1 changed files with 7 additions and 1 deletions

View File

@ -101,6 +101,12 @@ public class HypervisorCapabilitiesDaoImpl extends GenericDaoBase<HypervisorCapa
@Override
public Boolean isVmSnapshotEnabled(HypervisorType hypervisorType, String hypervisorVersion) {
HypervisorCapabilitiesVO result = getCapabilities(hypervisorType, hypervisorVersion);
return result.getVmSnapshotEnabled();
// if default capability profile not present for any hypervisor type result will be null.
// So returning vm snapshot not supported if there is no default capability profile for hypervisor.
if (result != null) {
return result.getVmSnapshotEnabled();
} else {
return false;
}
}
}