Skip to content

Commit 173909e

Browse files
committed
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.
1 parent 2c07651 commit 173909e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,10 +1860,14 @@ public Answer execute(ResizeVolumeCommand cmd) {
18601860
String path = vol.getPath();
18611861
String type = getResizeScriptType(pool, vol);
18621862

1863-
if (type == null) {
1864-
return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '" + pool.getType() + "' and volume format '" + vol.getFormat() + "'");
1865-
} else if (type.equals("QCOW2") && shrinkOk) {
1866-
return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type);
1863+
if (pool.getType() != StoragePoolType.RBD) {
1864+
if (type == null) {
1865+
return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '" + pool.getType() + "' and volume format '" + vol.getFormat() + "'");
1866+
} else if (type.equals("QCOW2") && shrinkOk) {
1867+
return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type);
1868+
}
1869+
} else {
1870+
s_logger.debug("Volume " + path + " is on a RBD storage pool. No need to query for additional information.");
18671871
}
18681872

18691873
s_logger.debug("Resizing volume: " + path + "," + currentSize + "," + newSize + "," + type + "," + vmInstanceName + "," + shrinkOk);

0 commit comments

Comments
 (0)