You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2014/10/13 19:51:15 UTC
git commit: updated refs/heads/master to 95c7ffb
Repository: cloudstack
Updated Branches:
refs/heads/master e717450e0 -> 95c7ffbd4
fixed NPE on calculating vm snasphot volume size
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/95c7ffbd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/95c7ffbd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/95c7ffbd
Branch: refs/heads/master
Commit: 95c7ffbd46f9f674b8813a7b992c17019eb00137
Parents: e717450
Author: Anthony Xu <an...@citrix.com>
Authored: Mon Oct 13 10:29:58 2014 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Mon Oct 13 10:49:45 2014 -0700
----------------------------------------------------------------------
.../xenserver/resource/CitrixResourceBase.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95c7ffbd/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index e3c3943..b669181 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -6241,11 +6241,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
// add size of snapshot vdi node, usually this only contains meta data
size = size + vdi.getPhysicalUtilisation(conn);
// add size of snapshot vdi parent, this contains data
- if (parentVDI != null)
+ if (!isRefNull(parentVDI))
size = size + parentVDI.getPhysicalUtilisation(conn).longValue();
}
} catch (Exception e) {
- s_logger.debug("Exception occurs when calculate " + "snapshot capacity for volumes: " + e.getMessage());
+ s_logger.debug("Exception occurs when calculate snapshot capacity for volumes: due to " + e.toString());
continue;
}
}
@@ -6257,13 +6257,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
try {
String vName = vmr.getNameLabel(conn);
if (vName != null && vName.contains(vmName) && vmr.getIsASnapshot(conn)) {
-
VDI memoryVDI = vmr.getSuspendVDI(conn);
- size = size + memoryVDI.getParent(conn).getPhysicalUtilisation(conn);
- size = size + memoryVDI.getPhysicalUtilisation(conn);
+ if (!isRefNull(memoryVDI)) {
+ size = size + memoryVDI.getPhysicalUtilisation(conn);
+ VDI pMemoryVDI = memoryVDI.getParent(conn);
+ if (!isRefNull(pMemoryVDI)) {
+ size = size + pMemoryVDI.getPhysicalUtilisation(conn);
+ }
+ }
}
} catch (Exception e) {
- s_logger.debug("Exception occurs when calculate " + "snapshot capacity for memory: " + e.getMessage());
+ s_logger.debug("Exception occurs when calculate snapshot capacity for memory: due to " + e.toString());
continue;
}
}