render / rpms / libvirt

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