[PATCH v1 4/4] bhyve: add tests for SATA address allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 ...bhyvexml2argv-addr-more-than-32-sata-disks.args |  21 ++
 ...yvexml2argv-addr-more-than-32-sata-disks.ldargs |   3 +
 .../bhyvexml2argv-addr-more-than-32-sata-disks.xml | 196 ++++++++++++++++
 .../bhyvexml2argv-addr-multiple-sata-disks.args    |   9 +
 .../bhyvexml2argv-addr-multiple-sata-disks.ldargs  |   3 +
 .../bhyvexml2argv-addr-multiple-sata-disks.xml     |  31 +++
 ...2argv-addr-no32devs-more-than-32-sata-disks.xml | 196 ++++++++++++++++
 ...xml2argv-addr-no32devs-multiple-sata-disks.args |  11 +
 ...l2argv-addr-no32devs-multiple-sata-disks.ldargs |   3 +
 ...exml2argv-addr-no32devs-multiple-sata-disks.xml |  31 +++
 ...yvexml2argv-addr-no32devs-single-sata-disk.args |   9 +
 ...exml2argv-addr-no32devs-single-sata-disk.ldargs |   3 +
 ...hyvexml2argv-addr-no32devs-single-sata-disk.xml |  21 ++
 .../bhyvexml2argv-addr-single-sata-disk.args       |   9 +
 .../bhyvexml2argv-addr-single-sata-disk.ldargs     |   3 +
 .../bhyvexml2argv-addr-single-sata-disk.xml        |  21 ++
 .../bhyvexml2argv-serial-grub-nocons.args          |   2 +-
 tests/bhyvexml2argvtest.c                          |  20 +-
 ...hyvexml2xmlout-addr-more-than-32-sata-disks.xml | 246 +++++++++++++++++++++
 .../bhyvexml2xmlout-addr-multiple-sata-disks.xml   |  45 ++++
 ...ml2xmlout-addr-no32devs-multiple-sata-disks.xml |  51 +++++
 ...vexml2xmlout-addr-no32devs-single-sata-disk.xml |  33 +++
 .../bhyvexml2xmlout-addr-single-sata-disk.xml      |  33 +++
 tests/bhyvexml2xmltest.c                           |  37 +++-
 24 files changed, 1030 insertions(+), 7 deletions(-)
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-more-than-32-sata-disks.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml

diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args
new file mode 100644
index 000000000..d7917bd8f
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.args
@@ -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
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.ldargs
new file mode 100644
index 000000000..70b2224f2
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.ldargs
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd1.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.xml
new file mode 100644
index 000000000..62d087104
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-more-than-32-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args
new file mode 100644
index 000000000..5665842b8
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.args
@@ -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
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.ldargs
new file mode 100644
index 000000000..70b2224f2
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.ldargs
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd1.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.xml
new file mode 100644
index 000000000..e0c509825
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-multiple-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-more-than-32-sata-disks.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-more-than-32-sata-disks.xml
new file mode 100644
index 000000000..62d087104
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-more-than-32-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args
new file mode 100644
index 000000000..03bf381ff
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.args
@@ -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
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.ldargs
new file mode 100644
index 000000000..70b2224f2
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.ldargs
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd1.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.xml
new file mode 100644
index 000000000..e0c509825
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-multiple-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args
new file mode 100644
index 000000000..d51924135
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.args
@@ -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
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.ldargs
new file mode 100644
index 000000000..32538b558
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.ldargs
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.xml
new file mode 100644
index 000000000..47bb47154
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-no32devs-single-sata-disk.xml
@@ -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>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args
new file mode 100644
index 000000000..547485ba5
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.args
@@ -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
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.ldargs
new file mode 100644
index 000000000..32538b558
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.ldargs
@@ -0,0 +1,3 @@
+/usr/sbin/bhyveload \
+-m 214 \
+-d /tmp/freebsd.img bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.xml
new file mode 100644
index 000000000..47bb47154
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-addr-single-sata-disk.xml
@@ -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>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
index ff69ed3a7..42a278208 100644
--- a/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
@@ -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
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index 6d0a9e1f8..e80705780 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -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");
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml
new file mode 100644
index 000000000..ac3799936
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-more-than-32-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml
new file mode 100644
index 000000000..ac4cbb4ea
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-multiple-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml
new file mode 100644
index 000000000..e4be4b9a4
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-multiple-sata-disks.xml
@@ -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>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml
new file mode 100644
index 000000000..53fa67a3e
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-no32devs-single-sata-disk.xml
@@ -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>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml
new file mode 100644
index 000000000..53fa67a3e
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-addr-single-sata-disk.xml
@@ -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>
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index 93ab3800c..004afda14 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -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);
 
-- 
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux