Skip to content

Commit edc34d9

Browse files
committed
KVM: use "qemu-img convert" to create qcow2 on CLVM
1 parent 88ebe43 commit edc34d9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,15 +1621,18 @@ to support snapshots(backuped) as qcow2 files. */
16211621
Map<String, String> info = qemu.info(srcFile);
16221622
String backingFile = info.get(QemuImg.BACKING_FILE);
16231623
// qcow2 templates can just be copied into place
1624-
if (sourceFormat.equals(destFormat) && backingFile == null && sourcePath.endsWith(".qcow2")) {
1624+
if (sourceFormat.equals(destFormat) && backingFile == null && sourcePath.endsWith(".qcow2")
1625+
&& destPool.getType() != StoragePoolType.CLVM) {
16251626
String result = Script.runSimpleBashScript("cp -f " + sourcePath + " " + destPath, timeout);
16261627
if (result != null) {
16271628
throw new CloudRuntimeException("Failed to create disk: " + result);
16281629
}
16291630
} else {
16301631
destFile = new QemuImgFile(destPath, destFormat);
16311632
try {
1632-
boolean isQCOW2 = PhysicalDiskFormat.QCOW2.equals(sourceFormat);
1633+
boolean isQCOW2 = PhysicalDiskFormat.QCOW2.equals(sourceFormat)
1634+
&& PhysicalDiskFormat.QCOW2.equals(destFormat)
1635+
&& destPool.getType() != StoragePoolType.CLVM;
16331636
qemu.convert(srcFile, destFile, null, null, new QemuImageOptions(srcFile.getFormat(), srcFile.getFileName(), null),
16341637
null, false, isQCOW2);
16351638
Map<String, String> destInfo = qemu.info(destFile);

0 commit comments

Comments
 (0)