drvbhyve: Use boot-order for grub-bhyve boot device

Rather than just picking the first CD (or failing that, HDD) we come
across, if the user has picked a boot device ordering with <boot
order=''>, respect that (and just try to boot the lowest-index device).

Adds two sets of tests to bhyve2xmlargv; 'grub-bootorder' shows that we
pick a user-specified device over the first device in the domain;
'grub-bootorder2' shows that we pick the first (lowest index) device.
This commit is contained in:
Conrad Meyer
2014-11-13 15:40:48 +01:00
committed by Michal Privoznik
parent c87f268a36
commit cdbb21bc59
11 changed files with 148 additions and 23 deletions
@@ -0,0 +1,6 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,ahci-hd,/tmp/freebsd1.img \
-s 2:0,ahci-hd,/tmp/freebsd2.img \
-s 2:0,ahci-hd,/tmp/freebsd3.img \
bhyve
@@ -0,0 +1 @@
(hd0) /tmp/freebsd3.img
@@ -0,0 +1,2 @@
/usr/local/sbin/grub-bhyve --root hd0,msdos1 --device-map '<device.map>' \
--memory 214 bhyve
@@ -0,0 +1,36 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hda' bus='sata'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd3.img'/>
<target dev='hda' bus='sata'/>
<boot order='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>
@@ -0,0 +1,6 @@
/usr/sbin/bhyve -c 1 -m 214 -H -P -s 0:0,hostbridge \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
-s 2:0,ahci-hd,/tmp/freebsd1.img \
-s 2:0,ahci-hd,/tmp/freebsd2.img \
-s 2:0,ahci-hd,/tmp/freebsd3.img \
bhyve
@@ -0,0 +1 @@
(hd0) /tmp/freebsd3.img
@@ -0,0 +1,2 @@
/usr/local/sbin/grub-bhyve --root hd0,msdos1 --device-map '<device.map>' \
--memory 214 bhyve
@@ -0,0 +1,38 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata'/>
<boot order='111'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hda' bus='sata'/>
<boot order='22'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd3.img'/>
<target dev='hda' bus='sata'/>
<boot order='3'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>