From fac9a8b4c45bffbda28c20c99c84542a5e16cba5 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 23 Mar 2020 18:26:52 +0100 Subject: [PATCH] virDomainDiskSourceNVMeFormat: Format only valid 'managed' values 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 Reviewed-by: Michal Privoznik --- 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 c997ff9e1e..a88a5a744e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24687,8 +24687,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); } -- GitLab