cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [1/3] git commit: updated refs/heads/master to 26746fe
Date Thu, 10 Apr 2014 09:58:24 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 6a725c679 -> 26746feb3


CLOUDSTACK-6371: Set snapshot size in copycommand answer during snapshot backup


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85072cb6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85072cb6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85072cb6

Branch: refs/heads/master
Commit: 85072cb6b9c33cb14b6d211935a1d2a557b02f69
Parents: 6a725c6
Author: Kishan Kavala <kishan@cloud.com>
Authored: Thu Apr 10 12:59:04 2014 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Thu Apr 10 14:45:14 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85072cb6/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 604bdae..a294ced 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -688,6 +688,7 @@ public class KVMStorageProcessor implements StorageProcessor {
             snapshotDisk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(),
volumePath);
             primaryPool = snapshotDisk.getPool();
 
+            long size = 0;
             /**
              * RBD snapshots can't be copied using qemu-img, so we have to use
              * the Java bindings for librbd here.
@@ -731,6 +732,7 @@ public class KVMStorageProcessor implements StorageProcessor {
                         offset += bytes;
                     }
                     s_logger.debug("Completed backing up RBD snapshot " + snapshotName +
" to  " + snapFile.getAbsolutePath() + ". Bytes written: " + offset);
+                    size = offset;
                     bos.close();
 
                     s_logger.debug("Attempting to remove snapshot RBD " + snapshotName +
" from image " + snapshotDisk.getName());
@@ -761,10 +763,15 @@ public class KVMStorageProcessor implements StorageProcessor {
                     s_logger.debug("Failed to backup snaptshot: " + result);
                     return new CopyCmdAnswer(result);
                 }
+                File snapFile = new File(snapshotDestPath + "/" + snapshotName);
+                if(snapFile.exists()){
+                    size = snapFile.length();
+                }
             }
 
             SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
             newSnapshot.setPath(snapshotRelPath + File.separator + snapshotName);
+            newSnapshot.setPhysicalSize(size);
             return new CopyCmdAnswer(newSnapshot);
         } catch (LibvirtException e) {
             s_logger.debug("Failed to backup snapshot: " + e.toString());


Mime
View raw message