[libvirt PATCH 01/14] conf: Use virTristateXXX in virStorageSource

Tim Wiederhake twiederh at redhat.com
Wed Apr 7 11:48:28 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/domain_conf.c         | 12 ++++++++----
 src/conf/storage_source_conf.h |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e72171586..b8f6c3d606 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8340,11 +8340,15 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
         return -1;
     }
 
-    if ((haveTLS = virXMLPropString(node, "tls")) &&
-        (src->haveTLS = virTristateBoolTypeFromString(haveTLS)) <= 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                   _("unknown disk source 'tls' setting '%s'"), haveTLS);
+    if ((haveTLS = virXMLPropString(node, "tls"))) {
+        int value;
+
+        if ((value = virTristateBoolTypeFromString(haveTLS)) <= 0) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("unknown disk source 'tls' setting '%s'"), haveTLS);
             return -1;
+        }
+        src->haveTLS = value;
     }
 
     if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h
index f42bb1c67d..e6702a1ffc 100644
--- a/src/conf/storage_source_conf.h
+++ b/src/conf/storage_source_conf.h
@@ -356,7 +356,7 @@ struct _virStorageSource {
     char *nodestorage; /* name of the storage object */
 
     /* An optional setting to enable usage of TLS for the storage source */
-    int haveTLS; /* enum virTristateBool */
+    virTristateBool haveTLS;
 
     /* Indication whether the haveTLS value was altered due to qemu.conf
      * setting when haveTLS is missing from the domain config file */
-- 
2.26.2




More information about the libvir-list mailing list