virt-install: --host-device: add driver_name option

This commit is contained in:
Cole Robinson 2014-01-14 18:09:21 -05:00
parent b57a2094ff
commit 6d2f937c99
5 changed files with 6 additions and 1 deletions

View File

@ -679,7 +679,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.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") # Many hostdev parsing types
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") # Many hostdev parsing types
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 foobarhostdev") # Unknown hostdev

View File

@ -37,6 +37,7 @@
<source>
<address domain="0x4" bus="0x5" slot="0x6" function="0x7"/>
</source>
<driver name="vfio"/>
</hostdev>
</devices>
</domain>

View File

@ -585,6 +585,7 @@ class XMLParseTest(unittest.TestCase):
check("bus", "0x1", "0x5")
check("slot", "0x2", "0x6")
check("function", "0x3", "0x7")
check("driver_name", None, "vfio")
self._alter_compare(guest.get_xml_config(), outfile)

View File

@ -1898,6 +1898,7 @@ def parse_hostdev(guest, optstr, dev):
return virtinst.NodeDevice.lookupNodeName(guest.conn, val)
set_param(dev.set_from_nodedev, "name", convert_cb=convert_name)
set_param("driver_name", "driver_name")
_check_leftover_opts(opts)
return dev

View File

@ -86,5 +86,7 @@ class VirtualHostDevice(VirtualDevice):
function = XMLProperty("./source/address/@function")
slot = XMLProperty("./source/address/@slot")
driver_name = XMLProperty("./driver/@name")
VirtualHostDevice.register_type()