render / rpms / libvirt

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