You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2014/05/01 21:03:50 UTC

[1/2] git commit: updated refs/heads/master to 3962577

Repository: cloudstack
Updated Branches:
  refs/heads/master b3491bcba -> 396257732


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


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

Branch: refs/heads/master
Commit: 3962577329ea2561fe8dd9db1281e7a6a2ea62cf
Parents: c111614
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Tue Apr 29 14:19:03 2014 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Thu May 1 21:03:11 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/39625773/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 89270c1..22575ee 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
@@ -709,7 +709,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());
@@ -1225,13 +1225,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/39625773/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 503c51b..09400c7 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
@@ -1150,7 +1150,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
                 if (srcPool.getType() != StoragePoolType.RBD) {
                     newDisk = destPool.createPhysicalDisk(name, Storage.ProvisioningType.THIN, disk.getVirtualSize());
                 } else {
-                    newDisk = destPool.createPhysicalDisk(name, sourceFormat, Storage.ProvisioningType.THIN, disk.getVirtualSize());
+                    newDisk = destPool.createPhysicalDisk(name, Storage.ProvisioningType.THIN, disk.getVirtualSize());
                 }
             }
         } else {
@@ -1201,10 +1201,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;


[2/2] git commit: updated refs/heads/master to 3962577

Posted by wi...@apache.org.
kvm: Better handle different volume formats when creating a volume

The KVMStorageProcessor no longer has a hardcoded if-statement which sets
RBD volumes to RAW, this is now handled in the LibvirtStorageAdapter

The Management Server still sends QCOW2 as format. That's a fix for later.


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

Branch: refs/heads/master
Commit: c1116142a3cd356e1e8da5404be150a07752b5d5
Parents: b3491bc
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Tue Apr 29 13:35:20 2014 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Thu May 1 21:03:11 2014 +0200

----------------------------------------------------------------------
 .../hypervisor/kvm/storage/KVMStorageProcessor.java     | 12 +++---------
 .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java   |  3 +--
 .../hypervisor/kvm/storage/LibvirtStoragePool.java      |  2 +-
 3 files changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c1116142/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 1fb2d5f..89270c1 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
@@ -1054,19 +1054,13 @@ public class KVMStorageProcessor implements StorageProcessor {
             primaryPool = storagePoolMgr.getStoragePool(primaryStore.getPoolType(), primaryStore.getUuid());
             disksize = volume.getSize();
 
-            vol = primaryPool.createPhysicalDisk(volume.getUuid(), volume.getProvisioningType(), disksize);
+            vol = primaryPool.createPhysicalDisk(volume.getUuid(), PhysicalDiskFormat.valueOf(volume.getFormat().toString().toUpperCase()),
+                                                 volume.getProvisioningType(), disksize);
 
             VolumeObjectTO newVol = new VolumeObjectTO();
             newVol.setPath(vol.getName());
             newVol.setSize(volume.getSize());
-
-            /**
-             * Volumes on RBD are always in RAW format
-             * Hardcode this to RAW since there is no other way right now
-             */
-            if (primaryPool.getType() == StoragePoolType.RBD) {
-                newVol.setFormat(ImageFormat.RAW);
-            }
+            newVol.setFormat(ImageFormat.valueOf(vol.getFormat().toString().toUpperCase()));
 
             return new CreateObjectAnswer(newVol);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c1116142/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 3c0dd94..503c51b 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
@@ -733,7 +733,6 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
          * For that reason we use the native RBD bindings to create the
          * RBD image until libvirt creates RBD format 2 by default
          */
-        format = PhysicalDiskFormat.RAW;
 
         try {
             s_logger.info("Creating RBD image " + pool.getSourceDir() + "/" + name + " with size " + size);
@@ -758,7 +757,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
 
         volPath = pool.getSourceDir() + "/" + name;
         KVMPhysicalDisk disk = new KVMPhysicalDisk(volPath, name, pool);
-        disk.setFormat(format);
+        disk.setFormat(PhysicalDiskFormat.RAW);
         disk.setSize(size);
         disk.setVirtualSize(size);
         return disk;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c1116142/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java
index 7678f1d..702816e 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java
@@ -106,7 +106,7 @@ public class LibvirtStoragePool implements KVMStoragePool {
 
     @Override
     public PhysicalDiskFormat getDefaultFormat() {
-        if (getStoragePoolType() == StoragePoolType.CLVM) {
+        if (getStoragePoolType() == StoragePoolType.CLVM || getStoragePoolType() == StoragePoolType.RBD) {
             return PhysicalDiskFormat.RAW;
         } else {
             return PhysicalDiskFormat.QCOW2;