render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From ec4851ad003ae1e28bd43f3d76af9bc05537a97f Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <ec4851ad003ae1e28bd43f3d76af9bc05537a97f@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 24 Mar 2020 16:25:54 +0100
d76c62
Subject: [PATCH] qemublocktest: Backport cleanups for testQemuDiskXMLToProps
d76c62
 from dd94f36ffbe
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
RHEL-only subset changes from dd94f36ffbe
d76c62
d76c62
dd94f36ffbe is too invasive to backport but makes changes to
d76c62
testQemuDiskXMLToProps which make it hard to backport other patches.
d76c62
d76c62
Filter out the relevant changes for a clean backport.
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Message-Id: <af87b1b8a1e1343a339fcc308e74bc4d08a96103.1585063415.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 tests/qemublocktest.c | 6 +++++-
d76c62
 1 file changed, 5 insertions(+), 1 deletion(-)
d76c62
d76c62
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
d76c62
index c8428921fe..cd7ea6bb2b 100644
d76c62
--- a/tests/qemublocktest.c
d76c62
+++ b/tests/qemublocktest.c
d76c62
@@ -256,6 +256,7 @@ static int
d76c62
 testQemuDiskXMLToProps(const void *opaque)
d76c62
 {
d76c62
     struct testQemuDiskXMLToJSONData *data = (void *) opaque;
d76c62
+    g_autoptr(virDomainDef) vmdef = NULL;
d76c62
     virDomainDiskDefPtr disk = NULL;
d76c62
     virStorageSourcePtr n;
d76c62
     virJSONValuePtr formatProps = NULL;
d76c62
@@ -275,6 +276,10 @@ testQemuDiskXMLToProps(const void *opaque)
d76c62
                                        VIR_DOMAIN_DEF_PARSE_STATUS)))
d76c62
         goto cleanup;
d76c62
 
d76c62
+    if (!(vmdef = virDomainDefNew()) ||
d76c62
+        virDomainDiskInsert(vmdef, disk) < 0)
d76c62
+        goto cleanup;
d76c62
+
d76c62
     if (qemuCheckDiskConfig(disk, data->qemuCaps) < 0 ||
d76c62
         qemuDomainDeviceDefValidateDisk(disk, data->qemuCaps) < 0) {
d76c62
         VIR_TEST_VERBOSE("invalid configuration for disk");
d76c62
@@ -313,7 +318,6 @@ testQemuDiskXMLToProps(const void *opaque)
d76c62
  cleanup:
d76c62
     virJSONValueFree(formatProps);
d76c62
     virJSONValueFree(storageProps);
d76c62
-    virDomainDiskDefFree(disk);
d76c62
     VIR_FREE(xmlpath);
d76c62
     VIR_FREE(xmlstr);
d76c62
     return ret;
d76c62
-- 
d76c62
2.26.0
d76c62