LibvirtComputingResource: Fix coverity scan, recent bugfixes revealed a potential unhandled null in getResizeScriptType

Change-Id: I5715a4424646261f2c43cd5e0a16fd72dd12c753
This commit is contained in:
Marcus Sorensen 2015-02-23 16:55:56 -08:00
parent b9e0e914c4
commit 344a9f992e
1 changed files with 2 additions and 4 deletions

View File

@ -1839,7 +1839,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
&& volFormat == PhysicalDiskFormat.QCOW2 ) {
return "QCOW2";
}
return null;
throw new CloudRuntimeException("Cannot determine resize type from pool type " + pool.getType());
}
/* uses a local script now, eventually support for virStorageVolResize() will maybe work on
@ -1866,9 +1866,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
String type = getResizeScriptType(pool, vol);
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) {
if (type.equals("QCOW2") && shrinkOk) {
return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type);
}
} else {