From b618fb2c2ecde7614dc09254452f098d486cba85 Mon Sep 17 00:00:00 2001 From: Sanjay Tripathi Date: Fri, 19 Jun 2015 15:53:38 +0530 Subject: [PATCH] VM Snapshot Usage for DATA disk is reported as the size of the DATA disk instead of the actual snapshot size. This closes #485 --- .../xenserver/resource/CitrixResourceBase.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 aa02d00416f4..8ed4ffc166ac 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 @@ -3162,6 +3162,15 @@ public String getVMInstanceName() { } public long getVMSnapshotChainSize(final Connection conn, final VolumeObjectTO volumeTo, final String vmName) throws BadServerResponse, XenAPIException, XmlRpcException { + if (volumeTo.getVolumeType() == Volume.Type.DATADISK) { + VDI dataDisk = VDI.getByUuid(conn, volumeTo.getPath()); + if (dataDisk != null) { + String dataDiskName = dataDisk.getNameLabel(conn); + if (dataDiskName != null && !dataDiskName.isEmpty()) { + volumeTo.setName(dataDiskName); + } + } + } final Set allvolumeVDIs = VDI.getByNameLabel(conn, volumeTo.getName()); long size = 0; for (final VDI vdi : allvolumeVDIs) {