2016-12-26 14:23:27 +03:00
<domain type= 'bhyve' >
<name > bhyve</name>
<uuid > df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory unit= 'KiB' > 219136</memory>
<currentMemory unit= 'KiB' > 219136</currentMemory>
<vcpu placement= 'static' > 1</vcpu>
<bootloader > /usr/local/sbin/grub-bhyve</bootloader>
<os >
<type arch= 'x86_64' > hvm</type>
</os>
<clock offset= 'utc' />
<on_poweroff > destroy</on_poweroff>
<on_reboot > restart</on_reboot>
<on_crash > destroy</on_crash>
<devices >
<disk type= 'file' device= 'disk' >
<driver name= 'file' type= 'raw' />
<source file= '/tmp/freebsd1.img' />
<target dev= 'hda' bus= 'sata' />
<address type= 'drive' controller= '0' bus= '0' target= '2' unit= '0' />
</disk>
<disk type= 'file' device= 'disk' >
<driver name= 'file' type= 'raw' />
<source file= '/tmp/freebsd2.img' />
<target dev= 'hdb' bus= 'sata' />
<address type= 'drive' controller= '0' bus= '0' target= '4' unit= '0' />
</disk>
<disk type= 'file' device= 'disk' >
<driver name= 'file' type= 'raw' />
<source file= '/tmp/freebsd3.img' />
<target dev= 'hdc' bus= 'sata' />
<boot order= '1' />
<address type= 'drive' controller= '0' bus= '0' target= '6' unit= '0' />
</disk>
2017-01-05 15:31:35 +03:00
<controller type= 'pci' index= '0' model= 'pci-root' />
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 15:51:25 +03:00
<controller type= 'sata' index= '0' >
<address type= 'pci' domain= '0x0000' bus= '0x00' slot= '0x02' function= '0x0' />
</controller>
2016-12-26 14:23:27 +03:00
<interface type= 'bridge' >
<mac address= '52:54:00:f4:6c:be' />
<source bridge= 'virbr0' />
<model type= 'virtio' />
<address type= 'pci' domain= '0x0000' bus= '0x00' slot= '0x03' function= '0x0' />
</interface>
</devices>
</domain>