Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 025c143ac -> d59cc1ff8


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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d59cc1ff
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d59cc1ff
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d59cc1ff

Branch: refs/heads/4.4-forward
Commit: d59cc1ff8fa909d37609410e19142b158cecb2f3
Parents: 945e879
Author: Rajesh Battala <[email protected]>
Authored: Thu Jun 5 15:06:11 2014 +0530
Committer: Rajesh Battala <[email protected]>
Committed: Thu Jun 5 15:06:24 2014 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/dao/HypervisorCapabilitiesDaoImpl.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d59cc1ff/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;
+        }
     }
 }

Reply via email to