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.
2013-05-31 10:09:24 +00:00
|
|
|
<domain type='qemu'>
|
|
|
|
<name>QEMUGuest2</name>
|
|
|
|
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
|
|
|
|
<memory unit='KiB'>219100</memory>
|
|
|
|
<currentMemory unit='KiB'>219100</currentMemory>
|
|
|
|
<vcpu placement='static'>1</vcpu>
|
|
|
|
<os>
|
|
|
|
<type arch='i686' machine='pc'>hvm</type>
|
|
|
|
<boot dev='hd'/>
|
|
|
|
</os>
|
|
|
|
<clock offset='utc'/>
|
|
|
|
<on_poweroff>destroy</on_poweroff>
|
|
|
|
<on_reboot>restart</on_reboot>
|
|
|
|
<on_crash>destroy</on_crash>
|
|
|
|
<devices>
|
2019-11-29 16:33:37 +00:00
|
|
|
<emulator>/usr/bin/qemu-system-i386</emulator>
|
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.
2013-05-31 10:09:24 +00:00
|
|
|
<disk type='block' device='disk'>
|
|
|
|
<source dev='/dev/HostVG/QEMUGuest2'/>
|
|
|
|
<target dev='hda' bus='ide'/>
|
|
|
|
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
|
</disk>
|
|
|
|
<controller type='scsi' index='0' model='virtio-scsi'/>
|
|
|
|
<controller type='usb' index='0'/>
|
|
|
|
<controller type='ide' index='0'/>
|
|
|
|
<controller type='pci' index='0' model='pci-root'/>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host0'/>
|
|
|
|
<address bus='0' target='0' unit='0'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host1'/>
|
|
|
|
<address bus='0' target='0' unit='1'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host2'/>
|
|
|
|
<address bus='0' target='0' unit='2'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host3'/>
|
|
|
|
<address bus='0' target='0' unit='3'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host4'/>
|
|
|
|
<address bus='0' target='0' unit='4'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host5'/>
|
|
|
|
<address bus='0' target='0' unit='5'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host6'/>
|
|
|
|
<address bus='0' target='0' unit='6'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host7'/>
|
|
|
|
<address bus='0' target='0' unit='7'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host8'/>
|
|
|
|
<address bus='0' target='0' unit='8'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host9'/>
|
|
|
|
<address bus='0' target='0' unit='9'/>
|
|
|
|
</source>
|
|
|
|
<address type='drive' controller='1' bus='0' target='0' unit='5'/>
|
|
|
|
</hostdev>
|
|
|
|
<hostdev mode='subsystem' type='scsi' managed='yes'>
|
|
|
|
<source>
|
|
|
|
<adapter name='scsi_host10'/>
|
|
|
|
<address bus='0' target='0' unit='10'/>
|
|
|
|
</source>
|
|
|
|
</hostdev>
|
|
|
|
<memballoon model='virtio'/>
|
|
|
|
</devices>
|
|
|
|
</domain>
|