WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XM] Move 'xm sysrq' into main.py
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Sep 2006 16:50:13 +0000
Delivery-date: Fri, 22 Sep 2006 09:52:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XM] Move 'xm sysrq' into main.py, Xen patchbot-unstable <=