render / rpms / libvirt

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