From 9bf2626e57743a6dd8b8413ce26feb4a972ce64e Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Tue, 17 Feb 2015 18:09:41 -0800 Subject: [PATCH] CLOUDSTACK-8263: KVM - use virsh instead of libvirt for resizing qcow2, as libvirt bindings are insufficient Change-Id: I08246219cb1469a46dc6a9ec76a8c3a67b0b8bf6 --- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 4 ++-- scripts/storage/qcow2/resizevolume.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index c6603f55e6a..20d709322c6 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -1878,8 +1878,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv s_logger.debug("Resizing volume: " + path + "," + currentSize + "," + newSize + "," + type + "," + vmInstanceName + "," + shrinkOk); - /* libvirt doesn't support resizing (C)LVM devices, so we have to do that via a Bash script */ - if (pool.getType() != StoragePoolType.CLVM) { + /* libvirt doesn't support resizing (C)LVM devices, and corrupts QCOW2 in some scenarios, so we have to do these via Bash script */ + if (pool.getType() != StoragePoolType.CLVM && vol.getFormat() != PhysicalDiskFormat.QCOW2) { s_logger.debug("Volume " + path + " can be resized by libvirt. Asking libvirt to resize the volume."); try { Connect conn = LibvirtConnection.getConnection(); diff --git a/scripts/storage/qcow2/resizevolume.sh b/scripts/storage/qcow2/resizevolume.sh index bc763d07211..1e6ffd648f5 100755 --- a/scripts/storage/qcow2/resizevolume.sh +++ b/scripts/storage/qcow2/resizevolume.sh @@ -244,7 +244,7 @@ then resizelvm elif [ "$ptype" == "QCOW2" ] then - resizeqcow2 + notifyqemu elif [ "$ptype" == "NOTIFYONLY" ] then notifyqemu