You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2019/07/22 11:57:49 UTC
[cloudstack] branch master updated: vmware: fix volume stats logic
(#3473)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new e1fa270 vmware: fix volume stats logic (#3473)
e1fa270 is described below
commit e1fa270593bb49ccbc85ffa2315570b8d7d8b2e1
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Mon Jul 22 17:27:41 2019 +0530
vmware: fix volume stats logic (#3473)
During volume stats calculation, if a volume has more than one disk in
the chain-info it is not used to sum the physical and virtual size
in the loop, instead any previous entry was overwritten by the last disk.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
.../com/cloud/hypervisor/vmware/resource/VmwareResource.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index c195712..141f2f6 100644
--- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3612,8 +3612,16 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
Pair<VirtualDisk, String> vds = vmMo.getDiskDevice(file.getFileName(), true);
long virtualsize = vds.first().getCapacityInKB() * 1024;
long physicalsize = primaryStorageDatastoreMo.fileDiskSize(file.getPath());
- VolumeStatsEntry vse = new VolumeStatsEntry(chainInfo, physicalsize, virtualsize);
- statEntry.put(chainInfo, vse);
+ if (statEntry.containsKey(chainInfo)) {
+ VolumeStatsEntry vse = statEntry.get(chainInfo);
+ if (vse != null) {
+ vse.setPhysicalSize(vse.getPhysicalSize() + physicalsize);
+ vse.setVirtualSize(vse.getVirtualSize() + virtualsize);
+ }
+ } else {
+ VolumeStatsEntry vse = new VolumeStatsEntry(chainInfo, physicalsize, virtualsize);
+ statEntry.put(chainInfo, vse);
+ }
}
}
}