mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-26 08:55:13 +03:00
cli: Remove unneeded parameter to optparse.add_option
This commit is contained in:
parent
eca87838fb
commit
b3a72bcb95
20
virt-clone
20
virt-clone
@ -138,9 +138,9 @@ def parse_args():
|
||||
geng.add_option("-o", "--original", dest="original_guest",
|
||||
help=_("Name of the original guest; "
|
||||
"The status must be shut off or paused."))
|
||||
geng.add_option("", "--original-xml", dest="original_xml",
|
||||
geng.add_option("--original-xml", dest="original_xml",
|
||||
help=_("XML file to use as the original guest."))
|
||||
geng.add_option("", "--auto-clone", dest="auto_clone", action="store_true",
|
||||
geng.add_option("--auto-clone", dest="auto_clone", action="store_true",
|
||||
help=_("Auto generate clone name and storage paths from"
|
||||
" the original guest configuration."))
|
||||
geng.add_option("-n", "--name", dest="new_name",
|
||||
@ -154,14 +154,14 @@ def parse_args():
|
||||
stog.add_option("-f", "--file", dest="new_diskfile", action="append",
|
||||
help=_("New file to use as the disk image for the "
|
||||
"new guest"))
|
||||
stog.add_option("", "--force-copy", dest="target", action="append",
|
||||
stog.add_option("--force-copy", dest="target", action="append",
|
||||
help=_("Force to copy devices (eg, if 'hdc' is a "
|
||||
"readonly cdrom device, --force-copy=hdc)"))
|
||||
stog.add_option("", "--nonsparse", action="store_false", dest="sparse",
|
||||
stog.add_option("--nonsparse", action="store_false", dest="sparse",
|
||||
default=True,
|
||||
help=_("Do not use a sparse file for the clone's "
|
||||
"disk image"))
|
||||
stog.add_option("", "--preserve-data", action="store_false",
|
||||
stog.add_option("--preserve-data", action="store_false",
|
||||
dest="preserve", default=True,
|
||||
help=_("Do not clone storage, new disk images specified "
|
||||
"via --file are preserved unchanged"))
|
||||
@ -174,25 +174,25 @@ def parse_args():
|
||||
parser.add_option_group(netg)
|
||||
|
||||
misc = optparse.OptionGroup(parser, _("Miscellaneous Options"))
|
||||
misc.add_option("", "--print-xml", action="store_true", dest="xmlonly",
|
||||
misc.add_option("--print-xml", action="store_true", dest="xmlonly",
|
||||
help=_("Print the generated domain XML rather than define "
|
||||
"and clone the guest."))
|
||||
misc.add_option("", "--replace", action="store_true", dest="replace",
|
||||
misc.add_option("--replace", action="store_true", dest="replace",
|
||||
help=_("Don't check for name collision. Allows replacing "
|
||||
"an existing guest with the new clone"))
|
||||
misc.add_option("-d", "--debug", action="store_true", dest="debug",
|
||||
help=_("Print debugging information"))
|
||||
misc.add_option("", "--prompt", action="store_true", dest="prompt",
|
||||
misc.add_option("--prompt", action="store_true", dest="prompt",
|
||||
default=False,
|
||||
help=_("Request user input for ambiguous situations or "
|
||||
"required options."))
|
||||
misc.add_option("", "--force", action="store_true", dest="force",
|
||||
misc.add_option("--force", action="store_true", dest="force",
|
||||
default=False,
|
||||
help=_("Do not prompt for input. Answers yes where "
|
||||
"applicable, terminates for all other prompts"))
|
||||
misc.add_option("-q", "--quiet", action="store_true", dest="quiet",
|
||||
help=_("Suppress non-error output"))
|
||||
misc.add_option("", "--clone-running", action="store_true",
|
||||
misc.add_option("--clone-running", action="store_true",
|
||||
dest="clone_running", default=False,
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
parser.add_option_group(misc)
|
||||
|
@ -78,7 +78,7 @@ def parse_args():
|
||||
help=_("Suppress non-error output"))
|
||||
misc.add_option("-d", "--debug", action="store_true", dest="debug",
|
||||
help=_("Print debugging information"))
|
||||
misc.add_option("", "--dry-run", action="store_false", dest="nodry",
|
||||
misc.add_option("--dry-run", action="store_false", dest="nodry",
|
||||
default=True,
|
||||
help=_("Dry run, don't make any changes"))
|
||||
opts.add_option_group(misc)
|
||||
|
12
virt-image
12
virt-image
@ -61,23 +61,23 @@ def parse_args():
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
misc.add_option("--prompt", action="store_true", dest="prompt",
|
||||
default=False,
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
misc.add_option("", "--force", action="store_true", dest="force",
|
||||
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",
|
||||
|
60
virt-install
60
virt-install
@ -896,14 +896,14 @@ def parse_args():
|
||||
help=_("Memory to allocate for guest instance in "
|
||||
"megabytes"))
|
||||
cli.vcpu_cli_options(geng)
|
||||
geng.add_option("", "--description", dest="description",
|
||||
geng.add_option("--description", dest="description",
|
||||
help=_("Human readable description of the VM to store in "
|
||||
"the generated XML."))
|
||||
geng.add_option("", "--security", dest="security",
|
||||
geng.add_option("--security", dest="security",
|
||||
help=_("Set domain security driver configuration."))
|
||||
geng.add_option("", "--numatune", dest="numatune",
|
||||
geng.add_option("--numatune", dest="numatune",
|
||||
help=_("Tune NUMA policy for the domain process."))
|
||||
geng.add_option("", "--features", dest="features",
|
||||
geng.add_option("--features", dest="features",
|
||||
help=_("Set domain <features> XML. Ex:\n"
|
||||
"--features acpi=off\n"
|
||||
"--features apic=on,eoi=on"))
|
||||
@ -911,41 +911,41 @@ def parse_args():
|
||||
|
||||
insg = optparse.OptionGroup(parser, _("Installation Method Options"))
|
||||
insg.add_option("-c", dest="cdrom_short", help=optparse.SUPPRESS_HELP)
|
||||
insg.add_option("", "--cdrom", dest="cdrom",
|
||||
insg.add_option("--cdrom", dest="cdrom",
|
||||
help=_("CD-ROM installation media"))
|
||||
insg.add_option("-l", "--location", dest="location",
|
||||
help=_("Installation source (eg, nfs:host:/path, "
|
||||
"http://host/path, ftp://host/path)"))
|
||||
insg.add_option("", "--pxe", action="store_true", dest="pxe",
|
||||
insg.add_option("--pxe", action="store_true", dest="pxe",
|
||||
help=_("Boot from the network using the PXE protocol"))
|
||||
insg.add_option("", "--import", action="store_true", dest="import_install",
|
||||
insg.add_option("--import", action="store_true", dest="import_install",
|
||||
help=_("Build guest around an existing disk image"))
|
||||
insg.add_option("", "--init", dest="init",
|
||||
insg.add_option("--init", dest="init",
|
||||
help=_("Path to init binary for container guest. Ex:\n"
|
||||
"--init /path/to/app (to contain an application)\n"
|
||||
"--init /sbin/init (for a full OS container)"))
|
||||
insg.add_option("", "--livecd", action="store_true", dest="livecd",
|
||||
insg.add_option("--livecd", action="store_true", dest="livecd",
|
||||
help=_("Treat the CD-ROM media as a Live CD"))
|
||||
insg.add_option("-x", "--extra-args", dest="extra",
|
||||
default="",
|
||||
help=_("Additional arguments to pass to the install kernel "
|
||||
"booted from --location"))
|
||||
insg.add_option("", "--initrd-inject", dest="initrd_injections",
|
||||
insg.add_option("--initrd-inject", dest="initrd_injections",
|
||||
action="append",
|
||||
help=_("Add given file to root of initrd from --location"))
|
||||
cli.add_distro_options(insg)
|
||||
insg.add_option("", "--boot", dest="bootopts", default="",
|
||||
insg.add_option("--boot", dest="bootopts", default="",
|
||||
help=_("Optionally configure post-install boot order, "
|
||||
"menu, permanent kernel boot, etc."))
|
||||
parser.add_option_group(insg)
|
||||
|
||||
stog = optparse.OptionGroup(parser, _("Storage Configuration"))
|
||||
stog.add_option("", "--disk", dest="diskopts", action="append",
|
||||
stog.add_option("--disk", dest="diskopts", action="append",
|
||||
help=_("Specify storage with various options. Ex.\n"
|
||||
"--disk path=/my/existing/disk\n"
|
||||
"--disk path=/my/new/disk,size=5 (in gigabytes)\n"
|
||||
"--disk vol=poolname/volname,device=cdrom,bus=scsi,..."))
|
||||
stog.add_option("", "--nodisks", action="store_true",
|
||||
stog.add_option("--nodisks", action="store_true",
|
||||
help=_("Don't set up any disks for the guest."))
|
||||
cli.add_fs_option(stog)
|
||||
|
||||
@ -955,19 +955,19 @@ def parse_args():
|
||||
stog.add_option("-s", "--file-size", type="float",
|
||||
action="append", dest="disksize",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
stog.add_option("", "--nonsparse", action="store_false",
|
||||
stog.add_option("--nonsparse", action="store_false",
|
||||
default=True, dest="sparse",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
parser.add_option_group(stog)
|
||||
|
||||
netg = cli.network_option_group(parser)
|
||||
|
||||
netg.add_option("", "--nonetworks", action="store_true",
|
||||
netg.add_option("--nonetworks", action="store_true",
|
||||
help=_("Don't create network interfaces for the guest."))
|
||||
parser.add_option_group(netg)
|
||||
|
||||
vncg = cli.graphics_option_group(parser)
|
||||
vncg.add_option("", "--noautoconsole", action="store_false",
|
||||
vncg.add_option("--noautoconsole", action="store_false",
|
||||
dest="autoconsole", default=True,
|
||||
help=_("Don't automatically try to connect to the guest "
|
||||
"console"))
|
||||
@ -977,7 +977,7 @@ def parse_args():
|
||||
cli.add_device_options(devg)
|
||||
|
||||
# Deprecated
|
||||
devg.add_option("", "--sound", action="store_true", dest="old_sound_bool",
|
||||
devg.add_option("--sound", action="store_true", dest="old_sound_bool",
|
||||
default=False, help=optparse.SUPPRESS_HELP)
|
||||
parser.add_option_group(devg)
|
||||
|
||||
@ -986,17 +986,17 @@ def parse_args():
|
||||
help=_("This guest should be a fully virtualized guest"))
|
||||
virg.add_option("-p", "--paravirt", action="store_true", dest="paravirt",
|
||||
help=_("This guest should be a paravirtualized guest"))
|
||||
virg.add_option("", "--container", action="store_true", default=False,
|
||||
virg.add_option("--container", action="store_true", default=False,
|
||||
dest="container",
|
||||
help=_("This guest should be a container guest"))
|
||||
virg.add_option("", "--virt-type", dest="hv_type",
|
||||
virg.add_option("--virt-type", dest="hv_type",
|
||||
default="",
|
||||
help=_("Hypervisor name to use (kvm, qemu, xen, ...)"))
|
||||
virg.add_option("", "--accelerate", action="store_true", default=False,
|
||||
virg.add_option("--accelerate", action="store_true", default=False,
|
||||
dest="accelerate", help=optparse.SUPPRESS_HELP)
|
||||
virg.add_option("", "--arch", dest="arch",
|
||||
virg.add_option("--arch", dest="arch",
|
||||
help=_("The CPU architecture to simulate"))
|
||||
virg.add_option("", "--machine", dest="machine",
|
||||
virg.add_option("--machine", dest="machine",
|
||||
help=_("The machine type to emulate"))
|
||||
virg.add_option("-u", "--uuid", dest="uuid",
|
||||
help=_("UUID for the guest."))
|
||||
@ -1004,28 +1004,28 @@ def parse_args():
|
||||
parser.add_option_group(virg)
|
||||
|
||||
misc = optparse.OptionGroup(parser, _("Miscellaneous Options"))
|
||||
misc.add_option("", "--autostart", action="store_true", dest="autostart",
|
||||
misc.add_option("--autostart", action="store_true", dest="autostart",
|
||||
default=False,
|
||||
help=_("Have domain autostart on host boot up."))
|
||||
misc.add_option("", "--print-xml", action="store_true", dest="xmlonly",
|
||||
misc.add_option("--print-xml", action="store_true", dest="xmlonly",
|
||||
help=_("Print the generated domain XML rather than define "
|
||||
"the guest."))
|
||||
misc.add_option("", "--print-step", type="str", dest="xmlstep",
|
||||
misc.add_option("--print-step", type="str", dest="xmlstep",
|
||||
help=_("Print XML of a specific install step "
|
||||
"(1, 2, 3, all) rather than define the guest."))
|
||||
misc.add_option("", "--noreboot", action="store_true", dest="noreboot",
|
||||
misc.add_option("--noreboot", action="store_true", dest="noreboot",
|
||||
help=_("Don't boot guest after completing install."))
|
||||
misc.add_option("", "--wait", type="int", dest="wait",
|
||||
misc.add_option("--wait", type="int", dest="wait",
|
||||
help=_("Time to wait (in minutes)"))
|
||||
misc.add_option("", "--dry-run", action="store_true", dest="dry",
|
||||
misc.add_option("--dry-run", action="store_true", dest="dry",
|
||||
help=_("Run through install process, but do not "
|
||||
"create devices or define the guest."))
|
||||
misc.add_option("", "--force", action="store_true", dest="force",
|
||||
misc.add_option("--force", action="store_true", dest="force",
|
||||
help=_("Forces 'yes' for any applicable prompts, "
|
||||
"terminates for all others"))
|
||||
misc.add_option("-q", "--quiet", action="store_true", dest="quiet",
|
||||
help=_("Suppress non-error output"))
|
||||
misc.add_option("", "--prompt", action="store_true", dest="prompt",
|
||||
misc.add_option("--prompt", action="store_true", dest="prompt",
|
||||
default=False,
|
||||
help=_("Request user input for ambiguous situations or "
|
||||
"required options."))
|
||||
|
@ -792,23 +792,23 @@ def set_os_variant(obj, distro_type, distro_variant):
|
||||
#############################
|
||||
|
||||
def add_connect_option(parser):
|
||||
parser.add_option("", "--connect", metavar="URI", dest="connect",
|
||||
parser.add_option("--connect", metavar="URI", dest="connect",
|
||||
help=_("Connect to hypervisor with libvirt URI"))
|
||||
|
||||
|
||||
def vcpu_cli_options(grp, backcompat=True):
|
||||
grp.add_option("", "--vcpus", dest="vcpus",
|
||||
grp.add_option("--vcpus", dest="vcpus",
|
||||
help=_("Number of vcpus to configure for your guest. Ex:\n"
|
||||
"--vcpus 5\n"
|
||||
"--vcpus 5,maxcpus=10\n"
|
||||
"--vcpus sockets=2,cores=4,threads=2"))
|
||||
grp.add_option("", "--cpuset", dest="cpuset",
|
||||
grp.add_option("--cpuset", dest="cpuset",
|
||||
help=_("Set which physical CPUs domain can use."))
|
||||
grp.add_option("", "--cpu", dest="cpu",
|
||||
grp.add_option("--cpu", dest="cpu",
|
||||
help=_("CPU model and features. Ex: --cpu coreduo,+x2apic"))
|
||||
|
||||
if backcompat:
|
||||
grp.add_option("", "--check-cpu", action="store_true",
|
||||
grp.add_option("--check-cpu", action="store_true",
|
||||
dest="check_cpu", help=optparse.SUPPRESS_HELP)
|
||||
|
||||
|
||||
@ -819,17 +819,17 @@ def graphics_option_group(parser):
|
||||
|
||||
vncg = optparse.OptionGroup(parser, _("Graphics Configuration"))
|
||||
add_gfx_option(vncg)
|
||||
vncg.add_option("", "--vnc", action="store_true", dest="vnc",
|
||||
vncg.add_option("--vnc", action="store_true", dest="vnc",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
vncg.add_option("", "--vncport", type="int", dest="vncport",
|
||||
vncg.add_option("--vncport", type="int", dest="vncport",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
vncg.add_option("", "--vnclisten", dest="vnclisten",
|
||||
vncg.add_option("--vnclisten", dest="vnclisten",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
vncg.add_option("-k", "--keymap", dest="keymap",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
vncg.add_option("", "--sdl", action="store_true", dest="sdl",
|
||||
vncg.add_option("--sdl", action="store_true", dest="sdl",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
vncg.add_option("", "--nographics", action="store_true",
|
||||
vncg.add_option("--nographics", action="store_true",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
return vncg
|
||||
|
||||
@ -861,47 +861,47 @@ def add_net_option(devg):
|
||||
|
||||
|
||||
def add_device_options(devg):
|
||||
devg.add_option("", "--controller", dest="controller", action="append",
|
||||
devg.add_option("--controller", dest="controller", action="append",
|
||||
help=_("Configure a guest controller device. Ex:\n"
|
||||
"--controller type=usb,model=ich9-ehci1"))
|
||||
devg.add_option("", "--serial", dest="serials", action="append",
|
||||
devg.add_option("--serial", dest="serials", action="append",
|
||||
help=_("Configure a guest serial device"))
|
||||
devg.add_option("", "--parallel", dest="parallels", action="append",
|
||||
devg.add_option("--parallel", dest="parallels", action="append",
|
||||
help=_("Configure a guest parallel device"))
|
||||
devg.add_option("", "--channel", dest="channels", action="append",
|
||||
devg.add_option("--channel", dest="channels", action="append",
|
||||
help=_("Configure a guest communication channel"))
|
||||
devg.add_option("", "--console", dest="consoles", action="append",
|
||||
devg.add_option("--console", dest="consoles", action="append",
|
||||
help=_("Configure a text console connection between "
|
||||
"the guest and host"))
|
||||
devg.add_option("", "--host-device", dest="hostdevs", action="append",
|
||||
devg.add_option("--host-device", dest="hostdevs", action="append",
|
||||
help=_("Configure physical host devices attached to the "
|
||||
"guest"))
|
||||
devg.add_option("", "--soundhw", dest="sound", action="append",
|
||||
devg.add_option("--soundhw", dest="sound", action="append",
|
||||
help=_("Configure guest sound device emulation"))
|
||||
devg.add_option("", "--watchdog", dest="watchdog", action="append",
|
||||
devg.add_option("--watchdog", dest="watchdog", action="append",
|
||||
help=_("Configure a guest watchdog device"))
|
||||
devg.add_option("", "--video", dest="video", action="append",
|
||||
devg.add_option("--video", dest="video", action="append",
|
||||
help=_("Configure guest video hardware."))
|
||||
devg.add_option("", "--smartcard", dest="smartcard", action="append",
|
||||
devg.add_option("--smartcard", dest="smartcard", action="append",
|
||||
help=_("Configure a guest smartcard device. Ex:\n"
|
||||
"--smartcard mode=passthrough"))
|
||||
devg.add_option("", "--redirdev", dest="redirdev", action="append",
|
||||
devg.add_option("--redirdev", dest="redirdev", action="append",
|
||||
help=_("Configure a guest redirection device. Ex:\n"
|
||||
"--redirdev usb,type=tcp,server=192.168.1.1:4000"))
|
||||
devg.add_option("", "--memballoon", dest="memballoon", action="append",
|
||||
devg.add_option("--memballoon", dest="memballoon", action="append",
|
||||
help=_("Configure a guest memballoon device. Ex:\n"
|
||||
"--memballoon model=virtio"))
|
||||
devg.add_option("", "--tpm", dest="tpm", action="append",
|
||||
devg.add_option("--tpm", dest="tpm", action="append",
|
||||
help=_("Configure a guest TPM device. Ex:\n"
|
||||
"--tpm type=passthrough"))
|
||||
devg.add_option("", "--rng", dest="rng", action="append",
|
||||
devg.add_option("--rng", dest="rng", action="append",
|
||||
help=_("Configure a guest RNG device. Ex:\n"
|
||||
"--rng /dev/random\n"
|
||||
"--rng type=egd,host=localhost,service=708"))
|
||||
|
||||
|
||||
def add_gfx_option(devg):
|
||||
devg.add_option("", "--graphics", dest="graphics", action="append",
|
||||
devg.add_option("--graphics", dest="graphics", action="append",
|
||||
help=_("Configure guest display settings. Ex:\n"
|
||||
"--graphics vnc\n"
|
||||
"--graphics spice,port=5901,tlsport=5902\n"
|
||||
@ -910,7 +910,7 @@ def add_gfx_option(devg):
|
||||
|
||||
|
||||
def add_fs_option(devg):
|
||||
devg.add_option("", "--filesystem", dest="filesystems", action="append",
|
||||
devg.add_option("--filesystem", dest="filesystems", action="append",
|
||||
help=_("Pass host directory to the guest. Ex: \n"
|
||||
"--filesystem /my/source/dir,/dir/in/guest\n"
|
||||
"--filesystem template_name,/,type=template"))
|
||||
@ -920,17 +920,17 @@ def add_distro_options(g):
|
||||
# Way back when, we required specifying both --os-type and --os-variant
|
||||
# Nowadays the distinction is pointless, so hide the less useful
|
||||
# --os-type option.
|
||||
g.add_option("", "--os-type", dest="distro_type",
|
||||
g.add_option("--os-type", dest="distro_type",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
g.add_option("", "--os-variant", dest="distro_variant",
|
||||
g.add_option("--os-variant", dest="distro_variant",
|
||||
help=_("The OS variant being installed guests, "
|
||||
"e.g. 'fedora18', 'rhel6', 'winxp', etc."))
|
||||
|
||||
|
||||
def add_old_feature_options(optg):
|
||||
optg.add_option("", "--noapic", action="store_true", dest="noapic",
|
||||
optg.add_option("--noapic", action="store_true", dest="noapic",
|
||||
default=False, help=optparse.SUPPRESS_HELP)
|
||||
optg.add_option("", "--noacpi", action="store_true", dest="noacpi",
|
||||
optg.add_option("--noacpi", action="store_true", dest="noacpi",
|
||||
default=False, help=optparse.SUPPRESS_HELP)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user