]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Generate address for scsi host device automatically
authorOsier Yang <jyang@redhat.com>
Fri, 31 May 2013 10:09:24 +0000 (18:09 +0800)
committerOsier Yang <jyang@redhat.com>
Sat, 1 Jun 2013 02:00:23 +0000 (10:00 +0800)
commitcdb978955991070ba14ade9d3ad460c43f836d87
tree9fa63cef29990ed368414f034c2f49c3bfd97724
parent2ea45647bcde23cff5da48f725561ff5ba3fba39
conf: Generate address for scsi host device automatically

With unknown good reasons, the attribute "bus" of scsi device
address is always set to 0, same for attribute "target". (See
virDomainDiskDefAssignAddress).

Though we might need to change the algorithm to honor "bus"
and "target" too, that's a different issue. The address generator
for scsi host device in this patch just follows the unknown
good reasons, only considering the "controller" and "unit".
It walks through all scsi controllers and their units, to see
if the address $controller:0:0:$unit can be used (if not used
by any disk or scsi host device yet), if found one, it sits on
it, otherwise, it creates a new controller (actually the controller
is implicitly created by someone else), and sits on
$new_controller:0:0:0 instead.
src/conf/domain_conf.c
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-autogen-address.xml [new file with mode: 0644]
tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-autogen-address.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c