You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/03/04 11:05:48 UTC

[04/50] [abbrv] git commit: updated refs/heads/reporter to 178a938

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/77d11eb1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/77d11eb1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/77d11eb1

Branch: refs/heads/reporter
Commit: 77d11eb1a3f58c3c78cddfac600252f3c6af6862
Parents: 09e26c8
Author: Marcus Sorensen <ma...@apple.com>
Authored: Mon Feb 23 16:55:56 2015 -0800
Committer: Marcus Sorensen <ma...@apple.com>
Committed: Mon Feb 23 16:56:19 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/77d11eb1/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 48ad19d..341c4f8 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -1840,7 +1840,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
@@ -1867,9 +1867,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 {