From: Richard W.M. Jones Date: Sat, 10 May 2014 14:44:39 +0000 (+0100) Subject: mclu: Add --viewer option to mclu start, to start virt-viewer. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=d406a1d14b7ab17cced29df9f2f62a01336eeef0;p=mclu.git mclu: Add --viewer option to mclu start, to start virt-viewer. --- diff --git a/mclu_start.py b/mclu_start.py index 1187942..50d58c9 100644 --- a/mclu_start.py +++ b/mclu_start.py @@ -19,9 +19,11 @@ import argparse import fnmatch import re +import subprocess import sys import libvirt +import config import lib def cmdline (subparsers): @@ -30,6 +32,10 @@ def cmdline (subparsers): help='start virtual machine(s)', ) p.add_argument ( + '--viewer', action='store_const', const=True, + help='start virt-viewer to show the graphical console' + ) + p.add_argument ( 'vms', nargs='+', help='virtual machine(s) to be started' ) @@ -53,6 +59,10 @@ def run (c, args, nodes): started = [] for vm_name in inactive: if fnmatch.fnmatch (vm_name, wc): + if args.viewer: + subprocess.Popen ([config.VIRT_VIEWER, "-c", + node.uri, vm_name], + close_fds=True) lib.start_guest (c, node, vm_name) started.append (vm_name)