cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject [13/50] git commit: updated refs/heads/marvin to df58f51
Date Wed, 29 Jan 2014 08:53:48 GMT
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 <likitha.shetty@citrix.com>
Authored: Mon Jan 27 17:52:16 2014 +0530
Committer: Likitha Shetty <likitha.shetty@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 {


Mime
View raw message