bhyve: add tests for SATA address allocation

This commit is contained in:
Roman Bogorodskiy 2017-01-05 18:38:20 +04:00
parent 803966c76d
commit ae01530cb4
24 changed files with 1030 additions and 7 deletions

View File

@ -0,0 +1,21 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd3.img,\
hd:/tmp/freebsd4.img,hd:/tmp/freebsd5.img,hd:/tmp/freebsd6.img,\
hd:/tmp/freebsd7.img,hd:/tmp/freebsd8.img,hd:/tmp/freebsd9.img,\
hd:/tmp/freebsd10.img,hd:/tmp/freebsd11.img,hd:/tmp/freebsd12.img,\
hd:/tmp/freebsd12.img,hd:/tmp/freebsd13.img,hd:/tmp/freebsd14.img,\
hd:/tmp/freebsd15.img,hd:/tmp/freebsd16.img,hd:/tmp/freebsd17.img,\
hd:/tmp/freebsd18.img,hd:/tmp/freebsd19.img,hd:/tmp/freebsd20.img,\
hd:/tmp/freebsd21.img,hd:/tmp/freebsd22.img,hd:/tmp/freebsd23.img,\
hd:/tmp/freebsd24.img,hd:/tmp/freebsd25.img,hd:/tmp/freebsd26.img,\
hd:/tmp/freebsd27.img,hd:/tmp/freebsd28.img,hd:/tmp/freebsd29.img,\
hd:/tmp/freebsd30.img \
-s 3:0,ahci,hd:/tmp/freebsd31.img,hd:/tmp/freebsd32.img,hd:/tmp/freebsd33.img,\
hd:/tmp/freebsd34.img,hd:/tmp/freebsd35.img \
-s 4:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve

View File

@ -0,0 +1,3 @@
/usr/sbin/bhyveload \
-m 214 \
-d /tmp/freebsd1.img bhyve

View File

@ -0,0 +1,196 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdb' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd3.img'/>
<target dev='hdc' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd4.img'/>
<target dev='hdd' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd5.img'/>
<target dev='hde' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd6.img'/>
<target dev='hdf' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd7.img'/>
<target dev='hdg' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd8.img'/>
<target dev='hdh' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd9.img'/>
<target dev='hdi' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd10.img'/>
<target dev='hdj' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd11.img'/>
<target dev='hdk' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd12.img'/>
<target dev='hdl' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd12.img'/>
<target dev='hdm' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd13.img'/>
<target dev='hdn' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd14.img'/>
<target dev='hdo' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd15.img'/>
<target dev='hdp' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd16.img'/>
<target dev='hdq' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd17.img'/>
<target dev='hdr' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd18.img'/>
<target dev='hds' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd19.img'/>
<target dev='hdt' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd20.img'/>
<target dev='hdu' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd21.img'/>
<target dev='hdv' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd22.img'/>
<target dev='hdw' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd23.img'/>
<target dev='hdx' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd24.img'/>
<target dev='hdy' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd25.img'/>
<target dev='hdz' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd26.img'/>
<target dev='hdaa' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd27.img'/>
<target dev='hdab' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd28.img'/>
<target dev='hdac' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd29.img'/>
<target dev='hdae' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd30.img'/>
<target dev='hdaf' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd31.img'/>
<target dev='hdag' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd32.img'/>
<target dev='hdah' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd33.img'/>
<target dev='hdai' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd34.img'/>
<target dev='hdaj' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd35.img'/>
<target dev='hdak' bus='sata'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,9 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci,hd:/tmp/freebsd1.img,hd:/tmp/freebsd2.img,hd:/tmp/freebsd2.img \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve

View File

@ -0,0 +1,3 @@
/usr/sbin/bhyveload \
-m 214 \
-d /tmp/freebsd1.img bhyve

View File

@ -0,0 +1,31 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdb' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdc' bus='sata'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,196 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdb' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd3.img'/>
<target dev='hdc' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd4.img'/>
<target dev='hdd' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd5.img'/>
<target dev='hde' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd6.img'/>
<target dev='hdf' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd7.img'/>
<target dev='hdg' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd8.img'/>
<target dev='hdh' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd9.img'/>
<target dev='hdi' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd10.img'/>
<target dev='hdj' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd11.img'/>
<target dev='hdk' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd12.img'/>
<target dev='hdl' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd12.img'/>
<target dev='hdm' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd13.img'/>
<target dev='hdn' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd14.img'/>
<target dev='hdo' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd15.img'/>
<target dev='hdp' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd16.img'/>
<target dev='hdq' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd17.img'/>
<target dev='hdr' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd18.img'/>
<target dev='hds' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd19.img'/>
<target dev='hdt' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd20.img'/>
<target dev='hdu' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd21.img'/>
<target dev='hdv' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd22.img'/>
<target dev='hdw' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd23.img'/>
<target dev='hdx' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd24.img'/>
<target dev='hdy' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd25.img'/>
<target dev='hdz' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd26.img'/>
<target dev='hdaa' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd27.img'/>
<target dev='hdab' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd28.img'/>
<target dev='hdac' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd29.img'/>
<target dev='hdae' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd30.img'/>
<target dev='hdaf' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd31.img'/>
<target dev='hdag' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd32.img'/>
<target dev='hdah' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd33.img'/>
<target dev='hdai' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd34.img'/>
<target dev='hdaj' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd35.img'/>
<target dev='hdak' bus='sata'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,11 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci-hd,/tmp/freebsd1.img \
-s 3:0,ahci-hd,/tmp/freebsd2.img \
-s 4:0,ahci-hd,/tmp/freebsd2.img \
-s 5:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve

View File

@ -0,0 +1,3 @@
/usr/sbin/bhyveload \
-m 214 \
-d /tmp/freebsd1.img bhyve

View File

@ -0,0 +1,31 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdb' bus='sata'/>
</disk>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdc' bus='sata'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,9 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci-hd,/tmp/freebsd.img \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve

View File

@ -0,0 +1,3 @@
/usr/sbin/bhyveload \
-m 214 \
-d /tmp/freebsd.img bhyve

View File

@ -0,0 +1,21 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,9 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci,hd:/tmp/freebsd.img \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 bhyve

View File

@ -0,0 +1,3 @@
/usr/sbin/bhyveload \
-m 214 \
-d /tmp/freebsd.img bhyve

View File

@ -0,0 +1,21 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>

View File

@ -5,7 +5,7 @@
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci,hd:/tmp/freebsd.img \
-s 2:0,ahci-hd,/tmp/freebsd.img \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:a7:cd:5b \
-s 1,lpc \
-l com1,/dev/nmdm0A bhyve

View File

@ -37,8 +37,15 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
if (flags & FLAG_EXPECT_PARSE_ERROR)
if (flags & FLAG_EXPECT_PARSE_ERROR) {
ret = 0;
} else if (flags & FLAG_EXPECT_FAILURE) {
ret = 0;
VIR_TEST_DEBUG("Got expected error: %s\n",
virGetLastErrorMessage());
virResetLastError();
}
goto out;
}
@ -179,6 +186,17 @@ mymain(void)
DO_TEST("serial-grub");
DO_TEST("localtime");
/* Address allocation tests */
DO_TEST("addr-single-sata-disk");
DO_TEST("addr-multiple-sata-disks");
DO_TEST("addr-more-than-32-sata-disks");
/* The same without 32 devs per controller support */
driver.bhyvecaps ^= BHYVE_CAP_AHCI32SLOT;
DO_TEST("addr-no32devs-single-sata-disk");
DO_TEST("addr-no32devs-multiple-sata-disks");
DO_TEST_FAILURE("addr-no32devs-more-than-32-sata-disks");
driver.grubcaps = 0;
DO_TEST("serial-grub-nocons");

View File

@ -0,0 +1,246 @@
<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>
<os>
<type arch='x86_64'>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>
<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='0' 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='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd3.img'/>
<target dev='hdc' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd4.img'/>
<target dev='hdd' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='3'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd5.img'/>
<target dev='hde' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='4'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd6.img'/>
<target dev='hdf' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='5'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd7.img'/>
<target dev='hdg' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='6'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd8.img'/>
<target dev='hdh' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='7'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd9.img'/>
<target dev='hdi' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='8'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd10.img'/>
<target dev='hdj' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='9'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd11.img'/>
<target dev='hdk' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='10'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd12.img'/>
<target dev='hdl' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='11'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd12.img'/>
<target dev='hdm' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='12'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd13.img'/>
<target dev='hdn' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='13'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd14.img'/>
<target dev='hdo' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='14'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd15.img'/>
<target dev='hdp' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='15'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd16.img'/>
<target dev='hdq' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='16'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd17.img'/>
<target dev='hdr' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='17'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd18.img'/>
<target dev='hds' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='18'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd19.img'/>
<target dev='hdt' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='19'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd20.img'/>
<target dev='hdu' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='20'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd21.img'/>
<target dev='hdv' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='21'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd22.img'/>
<target dev='hdw' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='22'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd23.img'/>
<target dev='hdx' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='23'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd24.img'/>
<target dev='hdy' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='24'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd25.img'/>
<target dev='hdz' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='25'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd26.img'/>
<target dev='hdaa' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='26'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd27.img'/>
<target dev='hdab' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='27'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd28.img'/>
<target dev='hdac' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='28'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd29.img'/>
<target dev='hdae' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='30'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd30.img'/>
<target dev='hdaf' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='31'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd31.img'/>
<target dev='hdag' bus='sata'/>
<address type='drive' controller='1' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd32.img'/>
<target dev='hdah' bus='sata'/>
<address type='drive' controller='1' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd33.img'/>
<target dev='hdai' bus='sata'/>
<address type='drive' controller='1' bus='0' target='0' unit='2'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd34.img'/>
<target dev='hdaj' bus='sata'/>
<address type='drive' controller='1' bus='0' target='0' unit='3'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd35.img'/>
<target dev='hdak' bus='sata'/>
<address type='drive' controller='1' bus='0' target='0' unit='4'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</controller>
<controller type='sata' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,45 @@
<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>
<os>
<type arch='x86_64'>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>
<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='0' 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='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdc' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,51 @@
<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>
<os>
<type arch='x86_64'>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>
<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='0' 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='1' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdc' bus='sata'/>
<address type='drive' controller='2' bus='0' target='0' unit='0'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</controller>
<controller type='sata' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<controller type='sata' index='2'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,33 @@
<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>
<os>
<type arch='x86_64'>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>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,33 @@
<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>
<os>
<type arch='x86_64'>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>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='hda' bus='sata'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='pci' index='0' model='pci-root'/>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>

View File

@ -14,15 +14,21 @@ static bhyveConn driver;
struct testInfo {
const char *name;
bool different;
unsigned int flags;
};
typedef enum {
FLAG_IS_DIFFERENT = 1 << 0,
FLAG_EXPECT_FAILURE = 1 << 1,
} virBhyveXMLToXMLTestFlags;
static int
testCompareXMLToXMLHelper(const void *data)
{
const struct testInfo *info = data;
char *xml_in = NULL;
char *xml_out = NULL;
bool is_different = info->flags & FLAG_IS_DIFFERENT;
int ret = -1;
if (virAsprintf(&xml_in, "%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml",
@ -32,10 +38,17 @@ testCompareXMLToXMLHelper(const void *data)
goto cleanup;
ret = testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, xml_in,
info->different ? xml_out : xml_in,
is_different ? xml_out : xml_in,
false, NULL, NULL, 0,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
if ((ret != 0) && (info->flags & FLAG_EXPECT_FAILURE)) {
ret = 0;
VIR_TEST_DEBUG("Got expected error: %s\n",
virGetLastErrorMessage());
virResetLastError();
}
cleanup:
VIR_FREE(xml_in);
VIR_FREE(xml_out);
@ -53,16 +66,19 @@ mymain(void)
if ((driver.xmlopt = virBhyveDriverCreateXMLConf(&driver)) == NULL)
return EXIT_FAILURE;
# define DO_TEST_FULL(name, is_different) \
# define DO_TEST_FULL(name, flags) \
do { \
const struct testInfo info = {name, is_different}; \
const struct testInfo info = {name, (flags)}; \
if (virTestRun("BHYVE XML-2-XML " name, \
testCompareXMLToXMLHelper, &info) < 0) \
ret = -1; \
} while (0)
# define DO_TEST_DIFFERENT(name) \
DO_TEST_FULL(name, true)
DO_TEST_FULL(name, FLAG_IS_DIFFERENT)
# define DO_TEST_FAILURE(name) \
DO_TEST_FULL(name, FLAG_EXPECT_FAILURE)
driver.bhyvecaps = BHYVE_CAP_AHCI32SLOT;
@ -89,6 +105,17 @@ mymain(void)
DO_TEST_DIFFERENT("serial-grub");
DO_TEST_DIFFERENT("serial-grub-nocons");
/* Address allocation tests */
DO_TEST_DIFFERENT("addr-single-sata-disk");
DO_TEST_DIFFERENT("addr-multiple-sata-disks");
DO_TEST_DIFFERENT("addr-more-than-32-sata-disks");
/* The same without 32 devs per controller support */
driver.bhyvecaps ^= BHYVE_CAP_AHCI32SLOT;
DO_TEST_DIFFERENT("addr-no32devs-single-sata-disk");
DO_TEST_DIFFERENT("addr-no32devs-multiple-sata-disks");
DO_TEST_FAILURE("addr-no32devs-more-than-32-sata-disks");
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);