cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Moroder (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-3383) GetHostStatsCommand fails when agent is running Ubuntu 13.04 (raring)
Date Sat, 11 Oct 2014 14:40:34 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-3383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14168177#comment-14168177
] 

Thomas Moroder commented on CLOUDSTACK-3383:
--------------------------------------------

This is the patch:

--- plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.orig.java
   2014-08-06 18:20:32.301343728 +0200
+++ plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
2014-10-11 16:39:15.441060282 +0200
@@ -3255,7 +3255,7 @@
     private Answer execute(GetHostStatsCommand cmd) {
         final Script cpuScript = new Script("/bin/bash", s_logger);
         cpuScript.add("-c");
-        cpuScript.add("idle=$(top -b -n 1|grep Cpu\\(s\\):|cut -d% -f4|cut -d, -f2);echo
$idle");
+        cpuScript.add("idle=$(top -b -n 1|grep Cpu\\(s\\):|cut -d, -f4|cut -d' ' -f2|cut
-d% -f1);echo $idle");

         final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
         String result = cpuScript.execute(parser);


> GetHostStatsCommand fails when agent is running Ubuntu 13.04 (raring)
> ---------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-3383
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3383
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: KVM
>    Affects Versions: 4.1.0
>         Environment: Ubuntu 13.04
>            Reporter: Harm van Tilborg
>            Priority: Minor
>              Labels: agent, kvm, libvirt
>
> 2013-07-05 13:02:37,782 DEBUG [cloud.agent.Agent] (agentRequest-Handler-3:null) Processing
command: com.cloud.agent.api.GetHostStatsCommand
> 2013-07-05 13:02:37,782 DEBUG [kvm.resource.LibvirtComputingResource] (agentRequest-Handler-3:null)
Executing: /bin/bash -c idle=$(top -b -n 1|grep Cpu\(s\):|cut -d% -f4|cut -d, -f2);echo $idle
> 2013-07-05 13:02:37,940 DEBUG [kvm.resource.LibvirtComputingResource] (agentRequest-Handler-3:null)
Execution is successful.
> 2013-07-05 13:02:37,941 DEBUG [cloud.agent.Agent] (agentRequest-Handler-3:null) Seq 1-2144469000:
 { Ans: , MgmtId: 159497075554, via: 1, Ver: v1, Flags: 10, [{"Answer":{"result":false,"details":"empty
String","wait":0}}] }
> When I check the output of Ubuntu's 13.04 top (top -v = procps-ng version 3.3.3), it's
formatted like this:
> raring# top -b -n 1|grep Cpu\(s\):
> %Cpu(s):  0.2 us,  0.2 sy,  0.0 ni, 99.5 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st
> While on Ubuntu 12.04 (top -v = procps version 3.2.8) it looks like this:
> precise# top -b -n 1|grep Cpu\(s\):
> Cpu(s):  0.3%us,  0.1%sy,  0.0%ni, 99.6%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
> So I believe it is better to split the string on a comma (,) than using the percentage
(%).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message