Re: [PATCH 06/24] virQEMUDriverConfigLoadSpecificTLSEntry: Split up fetching of server-only config options

2020-07-02 Thread Eric Blake

On 7/2/20 9:39 AM, Peter Krempa wrote:

The '*_tls_x509_verify' options are relevant only when we are going to
expose a server socket as client sockets always enable verification.

Split up the macro to separate the common bits from the server bits so
that when we'll later extend support of 'nbd' and 'vxhs' disks which are
client only we can reuse the existing macros.

Signed-off-by: Peter Krempa 
---
  src/qemu/qemu_conf.c | 25 -
  1 file changed, 16 insertions(+), 9 deletions(-)



Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



[PATCH 06/24] virQEMUDriverConfigLoadSpecificTLSEntry: Split up fetching of server-only config options

2020-07-02 Thread Peter Krempa
The '*_tls_x509_verify' options are relevant only when we are going to
expose a server socket as client sockets always enable verification.

Split up the macro to separate the common bits from the server bits so
that when we'll later extend support of 'nbd' and 'vxhs' disks which are
client only we can reuse the existing macros.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_conf.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2cbff1348a..b9b90e853f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -486,13 +486,8 @@ 
virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg,
 if (virConfGetValueBool(conf, "chardev_tls", >chardevTLS) < 0)
 return -1;

-#define GET_CONFIG_TLS_CERTINFO(val) \
+#define GET_CONFIG_TLS_CERTINFO_COMMON(val) \
 do { \
-if ((rv = virConfGetValueBool(conf, #val "_tls_x509_verify", \
-  >val## TLSx509verify)) < 0) \
-return -1; \
-if (rv == 1) \
-cfg->val## TLSx509verifyPresent = true; \
 if (virConfGetValueString(conf, #val "_tls_x509_cert_dir", \
   >val## TLSx509certdir) < 0) \
 return -1; \
@@ -502,11 +497,23 @@ 
virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg,
 return -1; \
 } while (0)

-GET_CONFIG_TLS_CERTINFO(chardev);
+#define GET_CONFIG_TLS_CERTINFO_SERVER(val) \
+do { \
+if ((rv = virConfGetValueBool(conf, #val "_tls_x509_verify", \
+  >val## TLSx509verify)) < 0) \
+return -1; \
+if (rv == 1) \
+cfg->val## TLSx509verifyPresent = true; \
+} while (0)
+
+GET_CONFIG_TLS_CERTINFO_COMMON(chardev);
+GET_CONFIG_TLS_CERTINFO_SERVER(chardev);

-GET_CONFIG_TLS_CERTINFO(migrate);
+GET_CONFIG_TLS_CERTINFO_COMMON(migrate);
+GET_CONFIG_TLS_CERTINFO_SERVER(migrate);

-#undef GET_CONFIG_TLS_CERTINFO
+#undef GET_CONFIG_TLS_CERTINFO_COMMON
+#undef GET_CONFIG_TLS_CERTINFO_SERVER
 return 0;
 }

-- 
2.26.2