From: Richard W.M. Jones Date: Wed, 28 May 2014 11:20:08 +0000 (+0100) Subject: build/import: Add --no-start flag. X-Git-Url: http://git.annexia.org/?p=mclu.git;a=commitdiff_plain;h=bea8cc3f5c8cc7e5ee37653e4add8b2c09cd6f16 build/import: Add --no-start flag. --- diff --git a/mclu_build.py b/mclu_build.py index 1587f25..a7de55c 100644 --- a/mclu_build.py +++ b/mclu_build.py @@ -45,6 +45,10 @@ def cmdline (subparsers): help='use virtio disks and network' ) p.add_argument ( + '--no-start', action='store_const', const=True, + help='do not start the guest after building' + ) + p.add_argument ( '--size', required=True, help='size of disk' ) @@ -110,6 +114,7 @@ def run (c, args): fp.write (xml) fp.close () - # Start the guest. - lib.start_guest (c, node_name, vm_name) - print "guest built and started on node %s" % node_name + if not args.no_start: + # Start the guest. + lib.start_guest (c, node_name, vm_name) + print "guest started on node %s" % node_name diff --git a/mclu_import.py b/mclu_import.py index 46797d0..7a019ba 100644 --- a/mclu_import.py +++ b/mclu_import.py @@ -44,6 +44,10 @@ def cmdline (subparsers): help='use virtio disks and network' ) p.add_argument ( + '--no-start', action='store_const', const=True, + help='do not start the guest after importing' + ) + p.add_argument ( 'name', help='name of the new VM (or use "vm:name")' ) @@ -98,6 +102,7 @@ def run (c, args): fp.write (xml) fp.close () - # Start the guest. - lib.start_guest (c, node_name, vm_name) - print "guest imported and started on node %s" % node_name + if not args.no_start: + # Start the guest. + lib.start_guest (c, node_name, vm_name) + print "guest started on node %s" % node_name