[xen-unstable] Fix xenmon.py to work on Solaris

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen-unstable] Fix xenmon.py to work on Solaris

Xen patchbot-unstable
# HG changeset patch
# User Keir Fraser <[hidden email]>
# Date 1196764848 0
# Node ID 7bee812a03979e2b99ba7a6731de22eb24290e2c
# Parent  0e8e68cfc8acf27aeca1f8aa8ad451f30d330c34
Fix xenmon.py to work on Solaris

The xenmon.py script does not work on Solaris because of (1) its
assumption that xenbaked is in the users path and, (2) the use of the
killall command. Changed xenmon.py to use pkill instead and provided
the path to xenbaked on Solaris.

Signed-off-by: Tariq Magdon-Ismail <[hidden email]>
---
 tools/xenmon/xenmon.py |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff -r 0e8e68cfc8ac -r 7bee812a0397 tools/xenmon/xenmon.py
--- a/tools/xenmon/xenmon.py Tue Dec 04 10:29:00 2007 +0000
+++ b/tools/xenmon/xenmon.py Tue Dec 04 10:40:48 2007 +0000
@@ -653,21 +653,36 @@ def writelog():
 # start xenbaked
 def start_xenbaked():
     global options
-    
-    os.system("killall -9 xenbaked")
-    # assumes that xenbaked is in your path
-    os.system("xenbaked --ms_per_sample=%d &" %
+    global kill_cmd
+    global xenbaked_cmd
+
+    os.system(kill_cmd)
+    os.system(xenbaked_cmd + " --ms_per_sample=%d &" %
               options.mspersample)
     time.sleep(1)
 
 # stop xenbaked
 def stop_xenbaked():
-    os.system("killall -s INT xenbaked")
+    global stop_cmd
+    os.system(stop_cmd)
 
 def main():
     global options
     global args
     global domains
+    global stop_cmd
+    global kill_cmd
+    global xenbaked_cmd
+
+    if os.uname()[0] == "SunOS":
+        xenbaked_cmd = "/usr/lib/xenbaked"
+ stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
+ kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
+    else:
+        # assumes that xenbaked is in your path
+        xenbaked_cmd = "xenbaked"
+        stop_cmd = "/usr/bin/pkill -INT xenbaked"
+        kill_cmd = "/usr/bin/pkill -KILL xenbaked"
 
     parser = setup_cmdline_parser()
     (options, args) = parser.parse_args()

_______________________________________________
Xen-changelog mailing list
[hidden email]
http://lists.xensource.com/xen-changelog