You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/01/29 09:53:48 UTC
[13/50] git commit: updated refs/heads/marvin to df58f51
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/4583bac0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4583bac0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4583bac0
Branch: refs/heads/marvin
Commit: 4583bac05bb3c2df2e7f199599765eb297023bf8
Parents: 39447cc
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:21:05 2014 +0530
----------------------------------------------------------------------
.../resource/VmwareStorageProcessor.java | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4583bac0/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 0ed09c4..6157bd6 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -957,7 +957,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
@@ -1040,8 +1040,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 {