This is because the output of df wraps onto two lines.

Signed-off-by: Alex Zeffertt <[email protected]>


1 file changed, 2 insertions(+), 2 deletions(-)
scripts/perfmon |    4 ++--


# HG changeset patch
# User Alex Zeffertt <[email protected]>
# Date 1267440753 0
# Node ID 166e935d2a9624466fa35b326ba1d4a31aa448e8
# Parent  8620e9a7232c4c6a437946c258011a3a0c9c4f1d
CA-38370: Perfmon barfs when dom0 root disk is a long path

This is because the output of df wraps onto two lines.

Signed-off-by: Alex Zeffertt <[email protected]>

diff -r 8620e9a7232c -r 166e935d2a96 scripts/perfmon
--- a/scripts/perfmon	Mon Mar 01 10:47:20 2010 +0000
+++ b/scripts/perfmon	Mon Mar 01 10:52:33 2010 +0000
@@ -354,8 +354,8 @@
     "Get the percent usage of the host filesystem.  Input list is ignored and should be empty"
     # this file is on the filesystem of interest in both OEM and Retail
     output = commands.getoutput('df /etc/passwd')
-    line = output.split('\n')[1]
-    percentage = line.split()[4]
+    output = ' '.join(output.splitlines()[1:]) # remove header line and rewrap on single line
+    percentage = output.split()[4]
     # strip of % character and convert to float
     return float(percentage[0:-1])/100.0
 
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to