[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XM] Move 'xm sysrq' into main.py



# HG changeset patch
# User atse@xxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 92bfc59726a4ebfff76994bce9445cb93fce9f76
# Parent  e6388ec26a97bade18da37741abb73b6a5530e91
[XM] Move 'xm sysrq' into main.py

* There's not need for sysrq to be in its own file.
* Bonus advantage: can use arg_check rather than gopts for argument
  validation.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xm/sysrq.py |   30 ------------------------------
 tools/python/xen/xm/main.py  |    8 +++++++-
 2 files changed, 7 insertions(+), 31 deletions(-)

diff -r e6388ec26a97 -r 92bfc59726a4 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Sep 22 16:20:36 2006 +0100
+++ b/tools/python/xen/xm/main.py       Fri Sep 22 16:32:30 2006 +0100
@@ -1010,6 +1010,12 @@ def xm_uptime(args):
 
         print upstring
 
+def xm_sysrq(args):
+    arg_check(args, "sysrq", 2)
+    dom = args[0]
+    req = args[1]
+    server.xend.domain.send_sysrq(dom, req)    
+
 def xm_top(args):
     arg_check(args, "top", 0)
 
@@ -1318,6 +1324,7 @@ commands = {
     "restore": xm_restore,
     "save": xm_save,
     "shutdown": xm_shutdown,
+    "sysrq": xm_sysrq,
     "uptime": xm_uptime,
     "list": xm_list,
     # memory commands
@@ -1359,7 +1366,6 @@ IMPORTED_COMMANDS = [
 IMPORTED_COMMANDS = [
     'create',
     'migrate',
-    'sysrq',
     'labels',
     'addlabel',
     'cfgbootpolicy',
diff -r e6388ec26a97 -r 92bfc59726a4 tools/python/xen/xm/sysrq.py
--- a/tools/python/xen/xm/sysrq.py      Fri Sep 22 16:20:36 2006 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-# (C) Matthew Bloch <matthew@xxxxxxxxxxxxxx> 2004
-# Copyright (C) 2005 XenSource Ltd
-
-"""Domain sysrq.
-"""
-
-from xen.xend.XendClient import server
-from xen.xm.opts import *
-
-gopts = Opts(use="""[DOM] [letter]
-
-Sends a Linux sysrq to a domain.
-""")
-
-gopts.opt('help', short='h',
-         fn=set_true, default=0,
-         use="Print this help.")
-
-def main(argv):
-    opts = gopts
-    args = opts.parse(argv)
-
-    if len(args) < 1:
-        raise OptionError('Missing domain argument')
-    if len(args) < 2:
-        raise OptionError('Missing sysrq character')
-
-    dom = args[0]
-    req = ord(args[1][0])
-    server.xend.domain.send_sysrq(dom, req)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.