mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
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 <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
6a336f8bc1
commit
e1fa270593
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user