render / rpms / libvirt

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