Repository: cloudstack Updated Branches: refs/heads/4.5 b9e0e914c -> 344a9f992
LibvirtComputingResource: Fix coverity scan, recent bugfixes revealed a potential unhandled null in getResizeScriptType Change-Id: I5715a4424646261f2c43cd5e0a16fd72dd12c753 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/344a9f99 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/344a9f99 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/344a9f99 Branch: refs/heads/4.5 Commit: 344a9f992e3cf070cc7ace43409f7d7b5ee50f0e Parents: b9e0e91 Author: Marcus Sorensen <marcus_soren...@apple.com> Authored: Mon Feb 23 16:55:56 2015 -0800 Committer: Marcus Sorensen <marcus_soren...@apple.com> Committed: Mon Feb 23 16:56:54 2015 -0800 ---------------------------------------------------------------------- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/344a9f99/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 bf417f6..df272ee 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 @@ -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 {