[libvirt] [PATCHv3 2/5] qemu: Change tests to use (modified) qemuDomainAssignAddresses

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Fri Jun 29 15:02:04 UTC 2012


Rewrote the device assignment parts in tests to use qemuDomainAssignAddresses.
This way the tests will work for new device address types as they show
up in the future (like s390 device types).

Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
---
 tests/qemuxml2argvtest.c |   12 +-----------
 tests/qemuxmlnstest.c    |   13 ++-----------
 2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7b00ea2..cda32b6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -149,21 +149,11 @@ static int testCompareXMLToArgvFiles(const char *xml,
         goto out;
 
     if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) {
-        qemuDomainPCIAddressSetPtr pciaddrs;
-
-        if (qemuDomainAssignSpaprVIOAddresses(vmdef)) {
+        if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) {
             if (expectError)
                 goto ok;
             goto out;
         }
-
-        if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef)))
-            goto out;
-
-        if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0)
-            goto out;
-
-        qemuDomainPCIAddressSetFree(pciaddrs);
     }
 
     log = virtTestLogContentAndReset();
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 8eca466..0bc821d 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -95,17 +95,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (qemudCanonicalizeMachine(&driver, vmdef) < 0)
         goto fail;
 
-    if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) {
-        qemuDomainPCIAddressSetPtr pciaddrs;
-        if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef)))
-            goto fail;
-
-        if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0)
-            goto fail;
-
-        qemuDomainPCIAddressSetFree(pciaddrs);
-    }
-
+    if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE))
+        qemuDomainAssignAddresses(vmdef, extraFlags, NULL);
 
     log = virtTestLogContentAndReset();
     VIR_FREE(log);
-- 
1.7.0.4




More information about the libvir-list mailing list