[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@xensource.com>
This commit is contained in:
atse@norwich.uk.xensource.com committed 2006-09-22 16:32:30 +01:00
1 parent cef39afbe9
commit 3b61bd783a
2 files changed
+7 -31

No files matched your search

+7 -1
View File
@@ -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 @@ commands = {
IMPORTED_COMMANDS = [
'create',
'migrate',
'sysrq',
'labels',
'addlabel',
'cfgbootpolicy',
-30
View File
@@ -1,30 +0,0 @@
# (C) Matthew Bloch <matthew@bytemark.co.uk> 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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.