libvirt/SOURCES/libvirt-virDomainDiskSourceNVMeFormat-Format-only-valid-managed-values.patch
2021-09-10 11:58:15 +00:00

44 lines
1.7 KiB
Diff

From 2eff64aa7a19da95b2f865a40010ab96f6e2e70e Mon Sep 17 00:00:00 2001
Message-Id: <2eff64aa7a19da95b2f865a40010ab96f6e2e70e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 24 Mar 2020 16:25:57 +0100
Subject: [PATCH] virDomainDiskSourceNVMeFormat: Format only valid 'managed'
values
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
VIR_TRISTATE_BOOL_ABSENT which maps to the 'default' string would not be
parsed back, so we shouldn't format it either.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit fac9a8b4c45bffbda28c20c99c84542a5e16cba5)
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
Message-Id: <562a24096551a25b6c06e33a9afa3fd10ab1598b.1585063415.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e8518139c..e3755fa285 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24442,8 +24442,9 @@ virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf,
const virStorageSourceNVMeDef *nvme)
{
virBufferAddLit(attrBuf, " type='pci'");
- virBufferAsprintf(attrBuf, " managed='%s'",
- virTristateBoolTypeToString(nvme->managed));
+ if (nvme->managed != VIR_TRISTATE_BOOL_ABSENT)
+ virBufferAsprintf(attrBuf, " managed='%s'",
+ virTristateBoolTypeToString(nvme->managed));
virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespc);
virPCIDeviceAddressFormat(childBuf, nvme->pciAddr, false);
}
--
2.26.0