Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 4415aee1e -> 355f1a2a7


CLOUDSTACK-4549: Do not force RBD snapshot backups to RAW format

Since we use qemu-img to copy from RBD to Secondary Storage we no
longer have to force to RAW images, but can stick with QCOW2

When the snapshot backups are QCOW2 format they can easily be deployed
again when restoring from a backup

Conflicts:

        
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java


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

Branch: refs/heads/4.4-forward
Commit: 355f1a2a7599f25771f390f7dba2f8659dbe8fa6
Parents: 4415aee
Author: Wido den Hollander <[email protected]>
Authored: Tue Apr 29 14:19:03 2014 +0200
Committer: Wido den Hollander <[email protected]>
Committed: Thu May 1 21:04:04 2014 +0200

----------------------------------------------------------------------
 .../hypervisor/kvm/storage/KVMStorageProcessor.java    | 10 ++--------
 .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java  | 13 +++----------
 2 files changed, 5 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/355f1a2a/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 621877e..41a7f9f 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
@@ -708,7 +708,7 @@ public class KVMStorageProcessor implements 
StorageProcessor {
                     srcFile.setFormat(PhysicalDiskFormat.RAW);
 
                     QemuImgFile destFile = new QemuImgFile(snapshotFile);
-                    destFile.setFormat(srcFile.getFormat());
+                    destFile.setFormat(snapshotDisk.getFormat());
 
                     s_logger.debug("Backing up RBD snapshot " + rbdSnapshot + 
" to " + snapshotFile);
                     QemuImg q = new QemuImg(cmd.getWaitInMillSeconds());
@@ -1230,13 +1230,7 @@ public class KVMStorageProcessor implements 
StorageProcessor {
             VolumeObjectTO newVol = new VolumeObjectTO();
             newVol.setPath(disk.getName());
             newVol.setSize(disk.getVirtualSize());
-
-            /**
-             * We have to force the format of RBD volumes to RAW
-             */
-            if (primaryPool.getType() == StoragePoolType.RBD) {
-                newVol.setFormat(ImageFormat.RAW);
-            }
+            
newVol.setFormat(ImageFormat.valueOf(disk.getFormat().toString().toUpperCase()));
 
             return new CopyCmdAnswer(newVol);
         } catch (CloudRuntimeException e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/355f1a2a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 699949d..52bbef3 100644
--- 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -1034,12 +1034,7 @@ public class LibvirtStorageAdaptor implements 
StorageAdaptor {
             if (disk.getFormat() == PhysicalDiskFormat.TAR) {
                 newDisk = destPool.createPhysicalDisk(name, 
PhysicalDiskFormat.DIR, disk.getVirtualSize());
             } else {
-                /* If the source device is on a RBD storage pool force the new 
disk to the same format (RAW) */
-                if (srcPool.getType() != StoragePoolType.RBD) {
-                    newDisk = destPool.createPhysicalDisk(name, 
disk.getVirtualSize());
-                } else {
-                    newDisk = destPool.createPhysicalDisk(name, sourceFormat, 
disk.getVirtualSize());
-                }
+                newDisk = destPool.createPhysicalDisk(name, 
disk.getVirtualSize());
             }
         } else {
             newDisk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + 
name, name, destPool);
@@ -1089,10 +1084,8 @@ public class LibvirtStorageAdaptor implements 
StorageAdaptor {
             }
         } else if ((srcPool.getType() != StoragePoolType.RBD) && 
(destPool.getType() == StoragePoolType.RBD)) {
             /**
-             * Qemu doesn't support writing to RBD format 2 directly, so we 
have to write to a temporary RAW file first
-             * which we then convert to RBD format 2.
-             *
-             * A HUGE performance gain can be achieved here if QCOW2 -> RBD 
format 2 can be done in one step
+             * Using qemu-img we copy the QCOW2 disk to RAW (on RBD) directly.
+             * To do so it's mandatory that librbd on the system is at least 
0.67.7 (Ceph Dumpling)
              */
             s_logger.debug("The source image is not RBD, but the destination 
is. We will convert into RBD format 2");
             String sourceFile;

Reply via email to