cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yas...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 0a62eb8
Date Tue, 13 May 2014 01:51:02 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 98307bfce -> 0a62eb838


CLOUDSTACK-6607: Correct the result of VpcNetworkUsage

Blank or not shouldn't be used to indicate command is failure or not.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/10de19e4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/10de19e4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/10de19e4

Branch: refs/heads/master
Commit: 10de19e4dd78746ce5a98317d5c3b1b3b05370ca
Parents: 98307bf
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Mon May 12 18:25:18 2014 -0700
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Mon May 12 18:50:41 2014 -0700

----------------------------------------------------------------------
 .../hypervisor/xen/resource/XenServer56Resource.java  | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/10de19e4/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
index a78ed81..a5a81a2 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56Resource.java
@@ -26,6 +26,7 @@ import com.cloud.agent.api.NetworkUsageAnswer;
 import com.cloud.agent.api.NetworkUsageCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.resource.ServerResource;
+import com.cloud.utils.ExecutionResult;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SSHCmdHelper;
@@ -166,11 +167,15 @@ public class XenServer56Resource extends CitrixResourceBase {
                 return new NetworkUsageAnswer(cmd, "success", 0L, 0L);
             }
 
-            String result = executeInVR(cmd.getPrivateIP(), "vpc_netusage.sh", args).getDetails();
+            ExecutionResult result = executeInVR(cmd.getPrivateIP(), "vpc_netusage.sh", args);
+            String detail = result.getDetails();
+            if (!result.isSuccess()) {
+                throw new Exception(" vpc network usage plugin call failed ");
+            }
             if (option.equals("get") || option.equals("vpn")) {
                 long[] stats = new long[2];
-                if (result != null) {
-                    String[] splitResult = result.split(":");
+                if (detail != null) {
+                    String[] splitResult = detail.split(":");
                     int i = 0;
                     while (i < splitResult.length - 1) {
                         stats[0] += (new Long(splitResult[i++])).longValue();
@@ -179,9 +184,6 @@ public class XenServer56Resource extends CitrixResourceBase {
                     return new NetworkUsageAnswer(cmd, "success", stats[0], stats[1]);
                 }
             }
-            if (result == null || result.isEmpty()) {
-                throw new Exception(" vpc network usage plugin call failed ");
-            }
             return new NetworkUsageAnswer(cmd, "success", 0L, 0L);
         } catch (Exception ex) {
             s_logger.warn("Failed to get network usage stats due to ", ex);


Mime
View raw message