From d406a1d14b7ab17cced29df9f2f62a01336eeef0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 10 May 2014 15:44:39 +0100 Subject: [PATCH] mclu: Add --viewer option to mclu start, to start virt-viewer. --- mclu_start.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) -- 1.8.3.1