render / rpms / libvirt

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