summaryrefslogtreecommitdiff
path: root/virt-image
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2013-09-28 11:27:26 -0400
committerCole Robinson <crobinso@redhat.com>2013-09-28 11:27:26 -0400
commit4c15da439b73c8628693193e094da1e2cb61791e (patch)
tree106cecb32dc88f138adaf5ed05b00f0d8f6777ed /virt-image
parentb1fb6c2567ca9b8053b5cedccd2f97ab9f42fbd2 (diff)
downloadvirt-manager-4c15da439b73c8628693193e094da1e2cb61791e.tar.gz
cli: Combine registering a bunch of common options
Diffstat (limited to 'virt-image')
-rwxr-xr-xvirt-image26
1 files changed, 5 insertions, 21 deletions
diff --git a/virt-image b/virt-image
index 43369730..caed4f96 100755
--- a/virt-image
+++ b/virt-image
@@ -58,30 +58,14 @@ def parse_args():
parser.add_option_group(vncg)
misc = optparse.OptionGroup(parser, _("Miscellaneous Options"))
- misc.add_option("-p", "--print", action="store_true", dest="print_only",
- help=_("Print the libvirt XML, but do not start the "
- "domain"))
misc.add_option("--boot", type="int", dest="boot",
help=_("The zero-based index of the boot record to use"))
- misc.add_option("--replace", action="store_true", dest="replace",
- default=False,
- help=_("Overwrite, or destroy, an existing image with "
- "the same name"))
- misc.add_option("--noreboot", action="store_true", dest="noreboot",
- help=_("Don't boot guest after completing install."))
misc.add_option("--skip-checksum", action="store_true",
dest="skipchecksum",
help=_("Skip disk checksum verification process"))
- misc.add_option("-d", "--debug", action="store_true", dest="debug",
- help=_("Print debugging information"))
- misc.add_option("--prompt", action="store_true", dest="prompt",
- default=False,
- help=optparse.SUPPRESS_HELP)
- misc.add_option("--force", action="store_true", dest="force",
- default=False,
- help=optparse.SUPPRESS_HELP)
- misc.add_option("-q", "--quiet", action="store_true", dest="quiet",
- help=_("Suppress non-error output"))
+
+ cli.add_misc_options(misc, prompt=True, replace=True, printxml=True,
+ noreboot=True)
parser.add_option_group(misc)
(options, args) = parser.parse_args()
@@ -97,7 +81,7 @@ def main(conn=None):
cli.earlyLogging()
options = parse_args()
- options.quiet = options.print_only or options.quiet
+ options.quiet = options.xmlonly or options.quiet
cli.setupLogging("virt-image", options.debug, options.quiet)
cli.set_prompt(False)
@@ -148,7 +132,7 @@ def main(conn=None):
guest.add_device(virtinst.VirtualVideoDevice(guest.conn))
# we've got everything -- try to start the install
- if options.print_only:
+ if options.xmlonly:
start_xml, final_xml = guest.start_install(return_xml=True)
print_stdout(start_xml or final_xml, do_force=True)
return 0