CLOUDSTACK-6831 [Hyper-V] Improve the logging for VM snapshot failures as it is not supported. Right now it is throwing NPEs
(cherry picked from commit d59cc1ff8fa909d37609410e19142b158cecb2f3) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/073928fe Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/073928fe Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/073928fe Branch: refs/heads/4.4 Commit: 073928fef5b9f3562f9333143cd69ed4a4113699 Parents: 1f7d2ee Author: Rajesh Battala <[email protected]> Authored: Thu Jun 5 15:06:11 2014 +0530 Committer: Daan Hoogland <[email protected]> Committed: Thu Jun 5 14:36:17 2014 +0200 ---------------------------------------------------------------------- .../cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/073928fe/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java b/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java index 2b94e69..e83a4ad 100644 --- a/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java +++ b/engine/schema/src/com/cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java @@ -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; + } } }
