Skip to content

Commit 3962577

Browse files
committed
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
1 parent c111614 commit 3962577

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ public Answer backupSnapshot(CopyCommand cmd) {
709709
srcFile.setFormat(PhysicalDiskFormat.RAW);
710710

711711
QemuImgFile destFile = new QemuImgFile(snapshotFile);
712-
destFile.setFormat(srcFile.getFormat());
712+
destFile.setFormat(snapshotDisk.getFormat());
713713

714714
s_logger.debug("Backing up RBD snapshot " + rbdSnapshot + " to " + snapshotFile);
715715
QemuImg q = new QemuImg(cmd.getWaitInMillSeconds());
@@ -1225,13 +1225,7 @@ public Answer createVolumeFromSnapshot(CopyCommand cmd) {
12251225
VolumeObjectTO newVol = new VolumeObjectTO();
12261226
newVol.setPath(disk.getName());
12271227
newVol.setSize(disk.getVirtualSize());
1228-
1229-
/**
1230-
* We have to force the format of RBD volumes to RAW
1231-
*/
1232-
if (primaryPool.getType() == StoragePoolType.RBD) {
1233-
newVol.setFormat(ImageFormat.RAW);
1234-
}
1228+
newVol.setFormat(ImageFormat.valueOf(disk.getFormat().toString().toUpperCase()));
12351229

12361230
return new CopyCmdAnswer(newVol);
12371231
} catch (CloudRuntimeException e) {

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ public KVMPhysicalDisk copyPhysicalDisk(KVMPhysicalDisk disk, String name, KVMSt
11501150
if (srcPool.getType() != StoragePoolType.RBD) {
11511151
newDisk = destPool.createPhysicalDisk(name, Storage.ProvisioningType.THIN, disk.getVirtualSize());
11521152
} else {
1153-
newDisk = destPool.createPhysicalDisk(name, sourceFormat, Storage.ProvisioningType.THIN, disk.getVirtualSize());
1153+
newDisk = destPool.createPhysicalDisk(name, Storage.ProvisioningType.THIN, disk.getVirtualSize());
11541154
}
11551155
}
11561156
} else {
@@ -1201,10 +1201,8 @@ public KVMPhysicalDisk copyPhysicalDisk(KVMPhysicalDisk disk, String name, KVMSt
12011201
}
12021202
} else if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() == StoragePoolType.RBD)) {
12031203
/**
1204-
* Qemu doesn't support writing to RBD format 2 directly, so we have to write to a temporary RAW file first
1205-
* which we then convert to RBD format 2.
1206-
*
1207-
* A HUGE performance gain can be achieved here if QCOW2 -> RBD format 2 can be done in one step
1204+
* Using qemu-img we copy the QCOW2 disk to RAW (on RBD) directly.
1205+
* To do so it's mandatory that librbd on the system is at least 0.67.7 (Ceph Dumpling)
12081206
*/
12091207
s_logger.debug("The source image is not RBD, but the destination is. We will convert into RBD format 2");
12101208
String sourceFile;

0 commit comments

Comments
 (0)