[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Added an xm console -q flag.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Node ID 6661355c450e2cd2c6f59eacbcd7378b8dbb4479 # Parent 00ed59a6f043af31c584c5a78db2a6009f80df51 Added an xm console -q flag. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/python/xen/xm/main.py | 46 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff -r 00ed59a6f043 -r 6661355c450e tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Tue Nov 21 10:22:19 2006 +0000 +++ b/tools/python/xen/xm/main.py Tue Nov 21 11:21:20 2006 +0000 @@ -67,7 +67,7 @@ SUBCOMMAND_HELP = { SUBCOMMAND_HELP = { # common commands - 'console' : ('<Domain>', + 'console' : ('[-q|--quiet] <Domain>', 'Attach to <Domain>\'s console.'), 'create' : ('<ConfigFile> [options] [vars]', 'Create a domain based on <ConfigFile>.'), @@ -189,6 +189,9 @@ SUBCOMMAND_OPTIONS = { 'list': ( ('-l', '--long', 'Output all VM details in SXP'), ('', '--label', 'Include security labels'), + ), + 'console': ( + ('-q', '--quiet', 'Do not print an error message if the domain does not exist'), ), 'dmesg': ( ('-c', '--clear', 'Clear dmesg buffer'), @@ -1002,14 +1005,45 @@ def xm_info(args): print "%-23s:" % x[0], x[1] def xm_console(args): - arg_check(args, "console", 1) - - dom = args[0] - info = server.xend.domain(dom) + arg_check(args, "console", 1, 2) + + quiet = False; + + try: + (options, params) = getopt.gnu_getopt(args, 'q', ['quiet']) + except getopt.GetoptError, opterr: + err(opterr) + sys.exit(1) + + for (k, v) in options: + if k in ['-q', '--quiet']: + quiet = True + else: + assert False + + if len(params) != 1: + err('No domain given') + usage('console') + sys.exit(1) + + dom = params[0] + + try: + info = server.xend.domain(dom) + except: + if quiet: + sys.exit(1) + else: + raise domid = int(sxp.child_value(info, 'domid', '-1')) if domid == -1: - raise Exception("Domain is not started") + if quiet: + sys.exit(1) + else: + raise Exception("Domain is not started") + console.execConsole(domid) + def xm_uptime(args): short_mode = 0 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |