From a26bbc2ce2f99e706895f9c0bbc6bdb5a522c37f Mon Sep 17 00:00:00 2001 From: Remi Bergsma Date: Thu, 21 May 2015 22:57:12 +0200 Subject: [PATCH] CLOUDSTACK-6181: Allow RBD volumes to be resized We don't need an external script to investigate the format of the RBD volume, we only have to ask Libvirt to resize the volume and that will ask librbd to do so. Backport for 4.4, original commit: 173909e99d85cfcc85b017bc426950f9f16fddf0 --- .../kvm/resource/LibvirtComputingResource.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 c3fc8ee4cd97..fc00ddd1fe23 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -1847,10 +1847,14 @@ public Answer execute(ResizeVolumeCommand cmd) { String path = vol.getPath(); String type = getResizeScriptType(pool, vol); - if (type == null) { - return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '" + pool.getType() + "' and volume format '" + vol.getFormat() + "'"); - } else if (type.equals("QCOW2") && shrinkOk) { - return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type); + if (pool.getType() != StoragePoolType.RBD) { + if (type == null) { + return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '" + pool.getType() + "' and volume format '" + vol.getFormat() + "'"); + } else if (type.equals("QCOW2") && shrinkOk) { + return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type); + } + } else { + s_logger.debug("Volume " + path + " is on a RBD storage pool. No need to query for additional information."); } s_logger.debug("Resizing volume: " + path + "," + currentSize + "," + newSize + "," + type + "," + vmInstanceName + "," + shrinkOk);