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