cli: Advertise the --host-device option as --hostdev

It annoys me that all the other CLI options map to the libvirt XML name,
except this one. Of course, keep the old option around for back compat,
just give precendence to the new option.
This commit is contained in:
Cole Robinson 2014-09-20 14:29:34 -04:00
parent 5bbd46a070
commit 5130d959e5
4 changed files with 20 additions and 17 deletions

View File

@ -993,31 +993,31 @@ proper device (if needed). This applies to all PCI devices.
Use --controller=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsControllers> Use --controller=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsControllers>
=item --host-device=HOSTDEV =item --hostdev=HOSTDEV, --host-device=HOSTDEV
Attach a physical host device to the guest. Some example values for HOSTDEV: Attach a physical host device to the guest. Some example values for HOSTDEV:
=over 2 =over 2
=item B<--host-device pci_0000_00_1b_0> =item B<--hostdev pci_0000_00_1b_0>
A node device name via libvirt, as shown by 'virsh nodedev-list' A node device name via libvirt, as shown by 'virsh nodedev-list'
=item B<--host-device 001.003> =item B<--hostdev 001.003>
USB by bus, device (via lsusb). USB by bus, device (via lsusb).
=item B<--host-device 0x1234:0x5678> =item B<--hostdev 0x1234:0x5678>
USB by vendor, product (via lsusb). USB by vendor, product (via lsusb).
=item B<--host-device 1f.01.02> =item B<--hostdev 1f.01.02>
PCI device (via lspci). PCI device (via lspci).
=back =back
Use --host-device=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsHostDev> Use --hostdev=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsHostDev>
=item --sound MODEL =item --sound MODEL

View File

@ -204,7 +204,7 @@ Before defining or updating the domain, show the generated XML diff and interact
=item --console =item --console
=item --host-device =item --hostdev
=item --sound =item --sound
@ -299,11 +299,11 @@ Change disk 'hda' IO to native and use startup policy as 'optional'.
Change all host devices to use driver_name=vfio for VM 'fedora20' on the remote connection Change all host devices to use driver_name=vfio for VM 'fedora20' on the remote connection
# virt-xml --connect qemu+ssh://remotehost/system \ # virt-xml --connect qemu+ssh://remotehost/system \
fedora20 --edit all --host-device driver_name=vfio fedora20 --edit all --hostdev driver_name=vfio
Hotplug host USB device 001.003 to running domain 'fedora19': Hotplug host USB device 001.003 to running domain 'fedora19':
# virt-xml f19 --add-device --host-device 001.003 --update # virt-xml f19 --add-device --hostdev 001.003 --update
Add a spicevmc channel to the domain 'winxp', that will be available after the next VM shutdown. Add a spicevmc channel to the domain 'winxp', that will be available after the next VM shutdown.

View File

@ -559,7 +559,7 @@ c.add_compare("""--hvm --pxe \
--blkiotune weight=200,device_path=/dev/sdc,device_weight=300 \ --blkiotune weight=200,device_path=/dev/sdc,device_weight=300 \
--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10 \ --idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10 \
--boot loader=/foo/bar \ --boot loader=/foo/bar \
--host-device net_00_1c_25_10_b1_e4,boot_order=4,rom_bar=off \ --hostdev net_00_1c_25_10_b1_e4,boot_order=4,rom_bar=off \
--features acpi=off,eoi=on,privnet=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234 \ --features acpi=off,eoi=on,privnet=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234 \
--clock offset=localtime,hpet_present=no,rtc_tickpolicy=merge \ --clock offset=localtime,hpet_present=no,rtc_tickpolicy=merge \
--pm suspend_to_mem=yes,suspend_to_disk=no \ --pm suspend_to_mem=yes,suspend_to_disk=no \
@ -729,7 +729,7 @@ c.add_valid("--redirdev usb,type=tcp,server=127.0.0.1:4002") # Different host s
c = vinst.add_category("hostdev", "--noautoconsole --nographics --nodisks --pxe") c = vinst.add_category("hostdev", "--noautoconsole --nographics --nodisks --pxe")
c.add_valid("--host-device usb_device_781_5151_2004453082054CA1BEEE") # Host dev by libvirt name c.add_valid("--host-device usb_device_781_5151_2004453082054CA1BEEE") # Host dev by libvirt name
c.add_valid("--host-device 001.003 --host-device 15:0.1 --host-device 2:15:0.2 --host-device 0:15:0.3 --host-device 0x0781:0x5151,driver_name=vfio --host-device 04b3:4485") # Many hostdev parsing types c.add_valid("--host-device 001.003 --hostdev 15:0.1 --host-device 2:15:0.2 --hostdev 0:15:0.3 --host-device 0x0781:0x5151,driver_name=vfio --host-device 04b3:4485") # Many hostdev parsing types
c.add_invalid("--host-device 1d6b:2") # multiple USB devices with identical vendorId and productId c.add_invalid("--host-device 1d6b:2") # multiple USB devices with identical vendorId and productId
c.add_invalid("--host-device pci_8086_2850_scsi_host_scsi_host") # Unsupported hostdev type c.add_invalid("--host-device pci_8086_2850_scsi_host_scsi_host") # Unsupported hostdev type
c.add_invalid("--host-device foobarhostdev") # Unknown hostdev c.add_invalid("--host-device foobarhostdev") # Unknown hostdev

View File

@ -562,9 +562,12 @@ def add_device_options(devg, sound_back_compat=False):
devg.add_argument("--console", action="append", devg.add_argument("--console", action="append",
help=_("Configure a text console connection between " help=_("Configure a text console connection between "
"the guest and host")) "the guest and host"))
devg.add_argument("--host-device", action="append", devg.add_argument("--hostdev", action="append",
help=_("Configure physical host devices attached to the " help=_("Configure physical USB/PCI/etc host devices "
"guest")) "to be shared with the guest"))
# Back compat name
devg.add_argument("--host-device", action="append", dest="hostdev",
help=argparse.SUPPRESS)
# --sound used to be a boolean option, hence the nargs handling # --sound used to be a boolean option, hence the nargs handling
sound_kwargs = { sound_kwargs = {
@ -904,7 +907,7 @@ class VirtCLIParser(object):
These values should be set by subclasses in _init_params These values should be set by subclasses in _init_params
@cli_arg_name: The command line argument this maps to, so @cli_arg_name: The command line argument this maps to, so
"host-device" for --host-device "hostdev" for --hostdev
@guest: Will be set parse(), the toplevel Guest object @guest: Will be set parse(), the toplevel Guest object
@remove_first: Passed to VirtOptionString @remove_first: Passed to VirtOptionString
@check_none: If the parsed option string is just 'none', return None @check_none: If the parsed option string is just 'none', return None
@ -2060,7 +2063,7 @@ class ParserSound(VirtCLIParser):
######################### #########################
# --host-device parsing # # --hostdev parsing #
######################### #########################
class ParserHostdev(VirtCLIParser): class ParserHostdev(VirtCLIParser):
@ -2152,7 +2155,7 @@ def build_parser_map(options, skip=None, only=None):
register_parser("filesystem", ParserFilesystem) register_parser("filesystem", ParserFilesystem)
register_parser("video", ParserVideo) register_parser("video", ParserVideo)
register_parser("sound", ParserSound) register_parser("sound", ParserSound)
register_parser("host-device", ParserHostdev) register_parser("hostdev", ParserHostdev)
register_parser("panic", ParserPanic) register_parser("panic", ParserPanic)
return parsermap return parsermap