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] Added an xm console -q flag.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Added an xm console -q flag.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Nov 2006 13:10:12 +0000
Delivery-date: Tue, 21 Nov 2006 05:09:52 -0800
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 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Added an xm console -q flag., Xen patchbot-unstable <=