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

[Xen-devel] [PATCH 2/3] Add "--console_timestamp" to xm create.



This patch adds "--console_timestamp" option to xm create.
Xenconsole adds date and domid to output message when we create a
guest with "--console_timestamp" option of xm create.

 # xm create -c --console_timestamp GUEST

This patch also adds "--timestamp" option to xm console.
Xenconsole adds date and domid to output message when we attach
guest's console with "--timestamp" option of xm console.

 # xm console --timestamp

Thanks,
--
Yuji Shimada

Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>

diff -r af1d9af1a993 tools/python/xen/xm/console.py
--- a/tools/python/xen/xm/console.py    Wed Jan 21 14:44:43 2009 +0000
+++ b/tools/python/xen/xm/console.py    Mon Jan 26 12:04:35 2009 +0900
@@ -27,6 +27,8 @@ def execConsole(domid):
 def execConsole(domid):
     xen.util.auxbin.execute(XENCONSOLE, [str(domid)])
 
+def execConsoleTimestamp(domid):
+    xen.util.auxbin.execute(XENCONSOLE, ['--timestamp', str(domid)])
 
 class OurXenstoreConnection:
     def __init__(self):
diff -r af1d9af1a993 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Wed Jan 21 14:44:43 2009 +0000
+++ b/tools/python/xen/xm/create.py     Mon Jan 26 12:04:37 2009 +0900
@@ -120,6 +120,10 @@ gopts.opt('console_autoconnect', short='
 gopts.opt('console_autoconnect', short='c',
           fn=set_true, default=0,
           use="Connect to the console after the domain is created.")
+
+gopts.opt('console_timestamp',
+          fn=set_true, default=0,
+          use="Add timestamp to output message.")
 
 gopts.opt('vncviewer',
           fn=set_true, default=0,
@@ -1352,7 +1356,10 @@ def do_console(domain_name):
                     sys.exit(os.WEXITSTATUS(rv))
             try:
                 domid = domain_name_to_domid(domain_name)
-                console.execConsole(domid)
+                if gopts.vals.console_timestamp:
+                    console.execConsoleTimestamp(domid)
+                else:
+                    console.execConsole(domid)
             except:
                 pass
         print("Could not start console\n");
diff -r af1d9af1a993 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Jan 21 14:44:43 2009 +0000
+++ b/tools/python/xen/xm/main.py       Mon Jan 26 12:04:38 2009 +0900
@@ -248,6 +248,7 @@ SUBCOMMAND_OPTIONS = {
     ),
     'console': (
        ('-q', '--quiet', 'Do not print an error message if the domain does not 
exist'),
+       ('', '--timestamp', 'Add timestamp to output message'),
     ),
     'vncviewer': (
        ('', '--autopass', 'Pass VNC password to viewer via stdin and 
-autopass'),
@@ -270,6 +271,7 @@ SUBCOMMAND_OPTIONS = {
     'start': (
        ('-p', '--paused', 'Do not unpause domain after starting it'),
        ('-c', '--console_autoconnect', 'Connect to the console after the 
domain is created'),
+       ('', '--console_timestamp', 'Add timestamp to output message'),
        ('', '--vncviewer', 'Connect to display via VNC after the domain is 
created'),
        ('', '--vncviewer-autopass', 'Pass VNC password to viewer via stdin and 
-autopass'),
     ),
@@ -1189,7 +1191,10 @@ def start_do_console(domain_name):
                 else:
                     dom = server.xend.domain(domain_name)
                     domid = int(sxp.child_value(dom, 'domid', '-1'))
-                console.execConsole(domid)
+                if console_timestamp == True:
+                    console.execConsoleTimestamp(domid)
+                else:
+                    console.execConsole(domid)
             except:
                 pass
         print("Could not start console\n");
@@ -1199,16 +1204,19 @@ def xm_start(args):
 
     paused = False
     console_autoconnect = False
+    console_timestamp = False
     vncviewer = False
     vncviewer_autopass = False
 
     try:
-        (options, params) = getopt.gnu_getopt(args, 'cp', 
['console_autoconnect','paused','vncviewer','vncviewer-autopass'])
+        (options, params) = getopt.gnu_getopt(args, 'cp', 
['console_autoconnect','console_timestamp','paused','vncviewer','vncviewer-autopass'])
         for (k, v) in options:
             if k in ('-p', '--paused'):
                 paused = True
             if k in ('-c', '--console_autoconnect'):
                 console_autoconnect = True
+            if k in ('--console_timestamp'):
+                console_timestamp = True
             if k in ('--vncviewer'):
                 vncviewer = True
             if k in ('--vncviewer-autopass'):
@@ -1767,9 +1775,10 @@ def xm_console(args):
     arg_check(args, "console", 1, 2)
 
     quiet = False;
+    timestamp = False;
 
     try:
-        (options, params) = getopt.gnu_getopt(args, 'q', ['quiet'])
+        (options, params) = getopt.gnu_getopt(args, 'q', ['quiet','timestamp'])
     except getopt.GetoptError, opterr:
         err(opterr)
         usage('console')
@@ -1777,6 +1786,8 @@ def xm_console(args):
     for (k, v) in options:
         if k in ['-q', '--quiet']:
             quiet = True
+        elif k in ['', '--timestamp']:
+            timestamp = True
         else:
             assert False
 
@@ -1804,7 +1815,10 @@ def xm_console(args):
         else:
             raise xmlrpclib.Fault(0, "Domain '%s' is not started" % dom)
 
-    console.execConsole(domid)
+    if timestamp == True:
+        console.execConsoleTimestamp(domid)
+    else:
+        console.execConsole(domid)
 
 
 def domain_name_to_domid(domain_name):


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


 


Rackspace

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