]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: permit auto-assignment of controller indexes
authorLaine Stump <laine@laine.org>
Tue, 10 May 2016 17:14:32 +0000 (13:14 -0400)
committerLaine Stump <laine@laine.org>
Wed, 25 May 2016 19:00:25 +0000 (15:00 -0400)
commit4d100c7a41befc21a5c09ad8385c711772714827
treeaf6dea011c929329a10f176e41c4e370ac39308f
parent808e16ff1357f8dafc2e697bb3fed2d6a3b3293b
conf: permit auto-assignment of controller indexes

Hand-entering indexes for 20 PCI controllers is not as tedious as
manually determining and entering their PCI addresses, but it's still
annoying, and the algorithm for determining the proper index is
incredibly simple (in all cases except one) - just pick the lowest
unused index.

The one exception is USB2 controllers because multiple controllers in
the same group have the same index. For these we look to see if 1) the
most recently added USB controller is also a USB2 controller, and 2)
the group *that* controller belongs to doesn't yet have a controller
of the exact model we're just now adding - if both are true, the new
controller gets the same index, but in all other cases we just assign
the lowest unused index.

With this patch in place and combined with the automatic PCI address
assignment, we can define a PCIe switch with several ports like this:

  <controller type='pci' model='pcie-root-port'/>
  <controller type='pci' model='pcie-switch-upstream-port'/>
  <controller type='pci' model='pcie-switch-downstream-port'/>
  <controller type='pci' model='pcie-switch-downstream-port'/>
  <controller type='pci' model='pcie-switch-downstream-port'/>
  <controller type='pci' model='pcie-switch-downstream-port'/>
  <controller type='pci' model='pcie-switch-downstream-port'/>
  ...

These will each get a unique index, and PCI addresses that connect
them together appropriately with no pesky numbers required.
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
tests/qemuxml2argvdata/qemuxml2argv-autoindex.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-autoindex.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/qemuxml2xmlout-autoindex.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c