You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2014/01/28 05:04:54 UTC
git commit: updated refs/heads/4.3-forward to e8ba2d0
Updated Branches:
refs/heads/4.3-forward 6d1475182 -> e8ba2d085
CLOUDSTACK-5796. [VMware] Size column is not getting updated in snapshot_store_ref table when a snapshot is backed up in secondary storage.
Calculate and update the size of a backed up snapshot. This snapshot size is in turn used to update the secondary_storage count for an account.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e8ba2d08
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e8ba2d08
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e8ba2d08
Branch: refs/heads/4.3-forward
Commit: e8ba2d08500b582a5e2e52e694fa6d9ec89d923b
Parents: 6d14751
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon Jan 27 17:52:16 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Jan 28 09:17:01 2014 +0530
----------------------------------------------------------------------
.../resource/VmwareStorageProcessor.java | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8ba2d08/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index 2089c08..24cfe53 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -985,7 +985,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
String backupUuid = UUID.randomUUID().toString();
Pair<String, String[]> snapshotInfo = exportVolumeToSecondaryStroage(vmMo, volumePath, secStorageUrl,
installPath, backupUuid, workerVmName);
- return new Ternary<String, String, String[]>(backupUuid + "/" + backupUuid, snapshotInfo.first(), snapshotInfo.second());
+ return new Ternary<String, String, String[]>(backupUuid, snapshotInfo.first(), snapshotInfo.second());
}
@Override
@@ -1067,8 +1067,25 @@ public class VmwareStorageProcessor implements StorageProcessor {
answer = new CopyCmdAnswer(details);
} else {
details = "Successfully backedUp the snapshot with Uuid: " + snapshotUuid + " to secondary storage.";
+
+ // Get snapshot physical size
+ long physicalSize = 0l;
+ String secondaryMountPoint = mountService.getMountPoint(secondaryStorageUrl);
+ String snapshotDir = destSnapshot.getPath() + "/" + snapshotBackupUuid;
+ File[] files = new File(secondaryMountPoint + "/" + snapshotDir).listFiles();
+ if(files != null) {
+ for(File file : files) {
+ String fileName = file.getName();
+ if(fileName.toLowerCase().startsWith(snapshotBackupUuid) && fileName.toLowerCase().endsWith(".vmdk")) {
+ physicalSize = new File(secondaryMountPoint + "/" + snapshotDir + "/" + fileName).length();
+ break;
+ }
+ }
+ }
+
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
- newSnapshot.setPath(destSnapshot.getPath() + "/" + snapshotBackupUuid);
+ newSnapshot.setPath(snapshotDir + "/" + snapshotBackupUuid);
+ newSnapshot.setPhysicalSize(physicalSize);
answer = new CopyCmdAnswer(newSnapshot);
}
} finally {