mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-10 01:18:03 +03:00
cli: Add device address.type/address.bus/... options
This exposes every device <address> option, for each device cli option. So --disk, --network, --video, etc. Fill out a few more address XML bits as well
This commit is contained in:
parent
927990ad9d
commit
2b34831b26
@ -1060,6 +1060,10 @@ This deprecates the --accelerate option, which is now the default behavior. To i
|
||||
|
||||
=head1 DEVICE OPTIONS
|
||||
|
||||
All devices have a set of B<address.*> options for configuring the
|
||||
particulars of the device's address on its parent controller or bus.
|
||||
See C<http://libvirt.org/formatdomain.html#elementsAddress> for details.
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<--controller> OPTIONS
|
||||
@ -1083,7 +1087,8 @@ see C<http://libvirt.org/formatdomain.html#elementsControllers>.
|
||||
|
||||
=item B<address>
|
||||
|
||||
Controller address, current PCI of form 'bus:domain:slot.function'.
|
||||
Shorthand for setting a manual PCI address from an lscpi style string.
|
||||
The preferred method for setting this is using the address.* parameters.
|
||||
|
||||
=item B<index>
|
||||
|
||||
|
@ -133,6 +133,7 @@
|
||||
<driver name="qemu"/>
|
||||
<source dir="/var"/>
|
||||
<target dev="fda" bus="fdc"/>
|
||||
<address type="ccw" cssid="0xfe" ssid="0" devno="01"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1">
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
|
||||
@ -193,6 +194,11 @@
|
||||
</virtualport>
|
||||
<boot order="1"/>
|
||||
</interface>
|
||||
<interface type="user">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="virtio"/>
|
||||
<address type="spapr-vio" reg="0x500"/>
|
||||
</interface>
|
||||
<input type="keyboard" bus="usb"/>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
|
||||
@ -284,6 +290,7 @@
|
||||
<source>
|
||||
<address domain="0" bus="21" slot="0" function="3"/>
|
||||
</source>
|
||||
<address type="isa" iobase="0x500" irq="5"/>
|
||||
</hostdev>
|
||||
<hostdev mode="subsystem" type="usb" managed="yes">
|
||||
<source>
|
||||
|
@ -464,12 +464,13 @@ c.add_compare(""" \
|
||||
--disk qemu+nbd:///var/foo/bar/socket,bus=usb,removable=on \
|
||||
--disk path=http://[1:2:3:4:1:2:3:4]:5522/my/path?query=foo \
|
||||
--disk vol=gluster-pool/test-gluster.raw,startup_policy=optional \
|
||||
--disk %(DIR)s,device=floppy \
|
||||
--disk %(DIR)s,device=floppy,address.type=ccw,address.cssid=0xfe,address.ssid=0,address.devno=01 \
|
||||
\
|
||||
--network user,mac=12:34:56:78:11:22,portgroup=foo,link_state=down,rom_bar=on,rom_file=/tmp/foo \
|
||||
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3 \
|
||||
--network bridge=ovsbr,virtualport_type=openvswitch,virtualport_profileid=demo,virtualport_interfaceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,link_state=yes \
|
||||
--network type=direct,source=eth5,source_mode=vepa,target=mytap12,virtualport_type=802.1Qbg,virtualport_managerid=12,virtualport_typeid=1193046,virtualport_typeidversion=1,virtualport_instanceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,boot_order=1 \
|
||||
--network user,model=virtio,address.type=spapr-vio,address.reg=0x500 \
|
||||
\
|
||||
--graphics sdl \
|
||||
--graphics spice,keymap=none \
|
||||
@ -500,7 +501,7 @@ c.add_compare(""" \
|
||||
--host-device 001.003 \
|
||||
--hostdev 15:0.1 \
|
||||
--host-device 2:15:0.2 \
|
||||
--hostdev 0:15:0.3 \
|
||||
--hostdev 0:15:0.3,address.type=isa,address.iobase=0x500,address.irq=5 \
|
||||
--host-device 0x0781:0x5151,driver_name=vfio \
|
||||
--host-device 04b3:4485 \
|
||||
--host-device pci_8086_2829_scsi_host_scsi_device_lun0 \
|
||||
|
@ -1053,6 +1053,30 @@ class VirtCLIParser(object):
|
||||
self.set_param(None, "clearxml",
|
||||
setter_cb=set_clearxml_cb, is_onoff=True)
|
||||
|
||||
def _add_device_address_params(self):
|
||||
"""
|
||||
Add VirtualDeviceAddress parameters if we are parsing for a device
|
||||
"""
|
||||
self.set_param("address.type", "address.type")
|
||||
self.set_param("address.domain", "address.domain")
|
||||
self.set_param("address.bus", "address.bus")
|
||||
self.set_param("address.slot", "address.slot")
|
||||
self.set_param("address.multifunction", "address.multifunction",
|
||||
is_onoff=True)
|
||||
self.set_param("address.function", "address.function")
|
||||
self.set_param("address.controller", "address.controller")
|
||||
self.set_param("address.unit", "address.unit")
|
||||
self.set_param("address.port", "address.port")
|
||||
self.set_param("address.target", "address.target")
|
||||
self.set_param("address.reg", "address.reg")
|
||||
self.set_param("address.cssid", "address.cssid")
|
||||
self.set_param("address.ssid", "address.ssid")
|
||||
self.set_param("address.devno", "address.devno")
|
||||
self.set_param("address.iobase", "address.iobase")
|
||||
self.set_param("address.irq", "address.irq")
|
||||
self.set_param("address.base", "address.base")
|
||||
|
||||
|
||||
def check_introspection(self, option):
|
||||
for optstr in util.listify(option):
|
||||
if optstr == "?" or optstr == "help":
|
||||
@ -1662,6 +1686,7 @@ class ParserDisk(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualDisk
|
||||
self.remove_first = "path"
|
||||
self._add_device_address_params()
|
||||
|
||||
def noset_cb(opts, inst, cliname, val):
|
||||
ignore = opts, inst, cliname, val
|
||||
@ -1708,7 +1733,6 @@ class ParserDisk(VirtCLIParser):
|
||||
self.set_param("iotune_tis", "total_iops_sec")
|
||||
self.set_param("sgio", "sgio")
|
||||
|
||||
|
||||
def _parse(self, opts, inst):
|
||||
if opts.fullopts == "none":
|
||||
return
|
||||
@ -1808,6 +1832,7 @@ class ParserNetwork(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualNetworkInterface
|
||||
self.remove_first = "type"
|
||||
self._add_device_address_params()
|
||||
|
||||
def set_mac_cb(opts, inst, cliname, val):
|
||||
ignore = opts
|
||||
@ -1896,6 +1921,7 @@ class ParserGraphics(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualGraphics
|
||||
self.remove_first = "type"
|
||||
self._add_device_address_params()
|
||||
|
||||
def set_keymap_cb(opts, inst, cliname, val):
|
||||
ignore = opts
|
||||
@ -1975,6 +2001,7 @@ class ParserController(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualController
|
||||
self.remove_first = "type"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("type", "type")
|
||||
self.set_param("model", "model")
|
||||
@ -2004,6 +2031,7 @@ class ParserInput(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualInputDevice
|
||||
self.remove_first = "type"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("type", "type")
|
||||
self.set_param("bus", "bus")
|
||||
@ -2018,6 +2046,7 @@ class ParserSmartcard(VirtCLIParser):
|
||||
self.objclass = VirtualSmartCardDevice
|
||||
self.remove_first = "mode"
|
||||
self.check_none = True
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("mode", "mode")
|
||||
self.set_param("type", "type")
|
||||
@ -2031,6 +2060,7 @@ class ParserRedir(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualRedirDevice
|
||||
self.remove_first = "bus"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("bus", "bus")
|
||||
self.set_param("type", "type")
|
||||
@ -2058,6 +2088,7 @@ class ParserTPM(VirtCLIParser):
|
||||
self.objclass = VirtualTPMDevice
|
||||
self.remove_first = "type"
|
||||
self.check_none = True
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("type", "type")
|
||||
self.set_param("model", "model")
|
||||
@ -2078,6 +2109,7 @@ class ParserRNG(VirtCLIParser):
|
||||
self.objclass = VirtualRNGDevice
|
||||
self.remove_first = "type"
|
||||
self.check_none = True
|
||||
self._add_device_address_params()
|
||||
|
||||
def set_hosts_cb(opts, inst, cliname, val):
|
||||
namemap = {}
|
||||
@ -2147,6 +2179,7 @@ class ParserWatchdog(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualWatchdog
|
||||
self.remove_first = "model"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("model", "model")
|
||||
self.set_param("action", "action")
|
||||
@ -2160,6 +2193,7 @@ class ParserMemballoon(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualMemballoon
|
||||
self.remove_first = "model"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("model", "model")
|
||||
|
||||
@ -2172,6 +2206,7 @@ class ParserPanic(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualPanicDevice
|
||||
self.remove_first = "iobase"
|
||||
self._add_device_address_params()
|
||||
|
||||
def set_iobase_cb(opts, inst, cliname, val):
|
||||
ignore = opts
|
||||
@ -2189,6 +2224,7 @@ class ParserPanic(VirtCLIParser):
|
||||
class _ParserChar(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.remove_first = "char_type"
|
||||
self._add_device_address_params()
|
||||
|
||||
def support_check(inst, attrname, cliname):
|
||||
if type(attrname) is not str:
|
||||
@ -2263,6 +2299,7 @@ class ParserFilesystem(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualFilesystem
|
||||
self.remove_first = ["source", "target"]
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("type", "type")
|
||||
self.set_param("accessmode", "accessmode", aliases=["mode"])
|
||||
@ -2278,6 +2315,7 @@ class ParserVideo(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualVideoDevice
|
||||
self.remove_first = "model"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("model", "model", ignore_default=True)
|
||||
self.set_param("accel3d", "accel3d", is_onoff=True)
|
||||
@ -2309,6 +2347,7 @@ class ParserSound(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualAudio
|
||||
self.remove_first = "model"
|
||||
self._add_device_address_params()
|
||||
|
||||
self.set_param("model", "model", ignore_default=True)
|
||||
|
||||
@ -2327,6 +2366,7 @@ class ParserHostdev(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.objclass = VirtualHostDevice
|
||||
self.remove_first = "name"
|
||||
self._add_device_address_params()
|
||||
|
||||
# If using the name_lookup_cb, this saves us repeatedly trying to
|
||||
# lookup the nodedev
|
||||
|
@ -74,15 +74,28 @@ class VirtualDeviceAddress(XMLBuilder):
|
||||
|
||||
|
||||
type = XMLProperty("./@type")
|
||||
# type=pci
|
||||
domain = XMLProperty("./@domain", is_int=True)
|
||||
bus = XMLProperty("./@bus", is_int=True)
|
||||
slot = XMLProperty("./@slot", is_int=True)
|
||||
function = XMLProperty("./@function", is_int=True)
|
||||
multifunction = XMLProperty("./@multifunction", is_onoff=True)
|
||||
# type=drive
|
||||
controller = XMLProperty("./@controller", is_int=True)
|
||||
unit = XMLProperty("./@unit", is_int=True)
|
||||
port = XMLProperty("./@port", is_int=True)
|
||||
target = XMLProperty("./@target", is_int=True)
|
||||
multifunction = XMLProperty("./@multifunction", is_onoff=True)
|
||||
# type=spapr-vio
|
||||
reg = XMLProperty("./@reg")
|
||||
# type=ccw
|
||||
cssid = XMLProperty("./@cssid")
|
||||
ssid = XMLProperty("./@ssid")
|
||||
devno = XMLProperty("./@devno")
|
||||
# type=isa
|
||||
iobase = XMLProperty("./@iobase")
|
||||
irq = XMLProperty("./@irq")
|
||||
# type=dimm
|
||||
base = XMLProperty("./@base")
|
||||
|
||||
|
||||
class VirtualDevice(XMLBuilder):
|
||||
|
Loading…
Reference in New Issue
Block a user