CLOUDSTACK-8263: KVM - use virsh instead of libvirt for resizing qcow2, as libvirt bindings are insufficient
Change-Id: I08246219cb1469a46dc6a9ec76a8c3a67b0b8bf6 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9bf2626e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9bf2626e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9bf2626e Branch: refs/heads/hotfix/scp-exception Commit: 9bf2626e57743a6dd8b8413ce26feb4a972ce64e Parents: ed8184a Author: Marcus Sorensen <marcus_soren...@apple.com> Authored: Tue Feb 17 18:09:41 2015 -0800 Committer: Marcus Sorensen <marcus_soren...@apple.com> Committed: Tue Feb 17 18:09:41 2015 -0800 ---------------------------------------------------------------------- .../cloud/hypervisor/kvm/resource/LibvirtComputingResource.java | 4 ++-- scripts/storage/qcow2/resizevolume.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9bf2626e/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java ---------------------------------------------------------------------- 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 c6603f5..20d7093 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(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9bf2626e/scripts/storage/qcow2/resizevolume.sh ---------------------------------------------------------------------- diff --git a/scripts/storage/qcow2/resizevolume.sh b/scripts/storage/qcow2/resizevolume.sh index bc763d0..1e6ffd6 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