cli: --controller: use predictable cli subarg names
To match the XML schema, rename these subarguments and add aliases to preserve compatibility: * driver_queues -> driver.queues * master -> master.startport
This commit is contained in:
parent
ea63141fca
commit
8e1cdf2cd7
|
@ -1081,6 +1081,8 @@ Controller also supports the special values B<usb2> and B<usb3> to
|
||||||
specify which version of the USB controller should be used (version 2
|
specify which version of the USB controller should be used (version 2
|
||||||
or 3).
|
or 3).
|
||||||
|
|
||||||
|
Some example suboptions:
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item B<model>
|
=item B<model>
|
||||||
|
@ -1101,28 +1103,6 @@ The preferred method for setting this is using the address.* parameters.
|
||||||
A decimal integer describing in which order the bus controller is
|
A decimal integer describing in which order the bus controller is
|
||||||
encountered, and to reference the controller bus.
|
encountered, and to reference the controller bus.
|
||||||
|
|
||||||
=item B<master>
|
|
||||||
|
|
||||||
Applicable to USB companion controllers, to define the master bus startport.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item B<--controller usb,model=ich9-ehci1,address=0:0:4.0,index=0>
|
|
||||||
|
|
||||||
Adds a ICH9 EHCI1 USB controller on PCI address 0:0:4.0
|
|
||||||
|
|
||||||
=item B<--controller usb,model=ich9-uhci2,address=0:0:4.7,index=0,master=2>
|
|
||||||
|
|
||||||
Adds a ICH9 UHCI2 USB companion controller for the previous master
|
|
||||||
controller, ports start from port number 2.
|
|
||||||
|
|
||||||
The parameter multifunction='on' will be added automatically to the
|
|
||||||
proper device (if needed). This applies to all PCI devices.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
Use --controller=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsControllers>
|
Use --controller=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsControllers>
|
||||||
|
|
|
@ -2781,9 +2781,10 @@ class ParserController(VirtCLIParser):
|
||||||
cli_arg_name = "controller"
|
cli_arg_name = "controller"
|
||||||
guest_propname = "devices.controller"
|
guest_propname = "devices.controller"
|
||||||
remove_first = "type"
|
remove_first = "type"
|
||||||
|
aliases = {
|
||||||
def set_server_cb(self, inst, val, virtarg):
|
"master.startport": "master",
|
||||||
inst.address.set_addrstr(val)
|
"driver.queues": "driver_queues",
|
||||||
|
}
|
||||||
|
|
||||||
def _parse(self, inst):
|
def _parse(self, inst):
|
||||||
if self.optstr == "usb2":
|
if self.optstr == "usb2":
|
||||||
|
@ -2792,6 +2793,14 @@ class ParserController(VirtCLIParser):
|
||||||
return DeviceController.get_usb3_controller(inst.conn, self.guest)
|
return DeviceController.get_usb3_controller(inst.conn, self.guest)
|
||||||
return super()._parse(inst)
|
return super()._parse(inst)
|
||||||
|
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Option handling #
|
||||||
|
###################
|
||||||
|
|
||||||
|
def set_address_cb(self, inst, val, virtarg):
|
||||||
|
inst.address.set_addrstr(val)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _init_class(cls, **kwargs):
|
def _init_class(cls, **kwargs):
|
||||||
VirtCLIParser._init_class(**kwargs)
|
VirtCLIParser._init_class(**kwargs)
|
||||||
|
@ -2799,11 +2808,11 @@ class ParserController(VirtCLIParser):
|
||||||
cls.add_arg("type", "type")
|
cls.add_arg("type", "type")
|
||||||
cls.add_arg("model", "model")
|
cls.add_arg("model", "model")
|
||||||
cls.add_arg("index", "index")
|
cls.add_arg("index", "index")
|
||||||
cls.add_arg("master", "master_startport")
|
|
||||||
cls.add_arg("driver_queues", "driver_queues")
|
|
||||||
cls.add_arg("maxGrantFrames", "maxGrantFrames")
|
cls.add_arg("maxGrantFrames", "maxGrantFrames")
|
||||||
|
cls.add_arg("master.startport", "master_startport")
|
||||||
|
cls.add_arg("driver.queues", "driver_queues")
|
||||||
|
|
||||||
cls.add_arg("address", None, lookup_cb=None, cb=cls.set_server_cb)
|
cls.add_arg("address", None, lookup_cb=None, cb=cls.set_address_cb)
|
||||||
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
|
|
|
@ -88,7 +88,8 @@ class DeviceController(Device):
|
||||||
return ctrl
|
return ctrl
|
||||||
|
|
||||||
|
|
||||||
_XML_PROP_ORDER = ["type", "index", "model", "master_startport", "driver_queues", "maxGrantFrames"]
|
_XML_PROP_ORDER = ["type", "index", "model", "master_startport",
|
||||||
|
"driver_queues", "maxGrantFrames"]
|
||||||
|
|
||||||
type = XMLProperty("./@type")
|
type = XMLProperty("./@type")
|
||||||
model = XMLProperty("./@model")
|
model = XMLProperty("./@model")
|
||||||
|
|
Loading…
Reference in New Issue