Default to notify only script to handle non-CLVM/QCOW cases.

Before this commit the call to `getResizeScriptType` would throw
an exception (earlier versions returned `null`, which was fine) -
this caused the RBD case to fail. By changing the default to
notify only we fix the case for any non-CLVM and non-QCOW cases.

This is RBD for now, but this should extend to new storage
types suppored by Libvirt natively in future.
This commit is contained in:
Aaron Brady 2015-08-14 12:15:07 +01:00
parent 0fcc7297e0
commit 77a96ed1f7
1 changed files with 2 additions and 2 deletions

View File

@ -69,9 +69,10 @@ public final class LibvirtResizeVolumeCommandWrapper extends CommandWrapper<Resi
final KVMPhysicalDisk vol = pool.getPhysicalDisk(volid);
final String path = vol.getPath();
String type = libvirtComputingResource.getResizeScriptType(pool, vol);
String type = notifyOnlyType;
if (pool.getType() != StoragePoolType.RBD) {
type = libvirtComputingResource.getResizeScriptType(pool, vol);
if (type.equals("QCOW2") && shrinkOk) {
return new ResizeVolumeAnswer(command, false, "Unable to shrink volumes of type " + type);
}
@ -99,7 +100,6 @@ public final class LibvirtResizeVolumeCommandWrapper extends CommandWrapper<Resi
}
v.resize(newSize, flags);
type = notifyOnlyType;
} catch (final LibvirtException e) {
return new ResizeVolumeAnswer(command, false, e.toString());
}