[PATCH WIP 12/14] remote: conditionalize sources for some pieces to become optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prepare for reusing libvirtd source to create other daemons by making
various bits conditionalized. This will avoid cut+paste of huge amount
of source code for each new daemon.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/remote/Makefile.inc.am        |  21 +++++
 src/remote/remote_daemon.c        | 160 +++++++++++++++++++++++---------------
 src/remote/remote_daemon_config.c |  36 +++++++--
 src/remote/remote_daemon_config.h |   9 ++-
 src/remote/remote_driver.h        |   1 -
 5 files changed, 153 insertions(+), 74 deletions(-)

diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index 12600b8bb5..a6c60a35b3 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -140,6 +140,27 @@ libvirtd_CFLAGS = \
 	-I$(srcdir)/access \
 	-I$(srcdir)/conf \
 	-I$(srcdir)/rpc \
+	-DSOCK_NAME="\"libvirt-sock\"" \
+	-DSOCK_NAME_RO="\"libvirt-sock-ro\"" \
+	-DSOCK_NAME_ADMIN="\"libvirt-admin-sock\"" \
+	-DAPP_NAME="\"libvirtd\"" \
+	-DLOAD_NETWORK \
+	-DLOAD_INTERFACE \
+	-DLOAD_STORAGE \
+	-DLOAD_NODE_DEVICES \
+	-DLOAD_SECRETS \
+	-DLOAD_NWFILTER \
+	-DLOAD_XEN \
+	-DLOAD_LIBXL \
+	-DLOAD_QEMU \
+	-DLOAD_LXC \
+	-DLOAD_UML \
+	-DLOAD_VBOX \
+	-DLOAD_BHYVE \
+	-DLOAD_VZ \
+	-DCONFIG_MIGRATE \
+	-DWITH_NET_IP \
+	-DREQUIRE_MODULE=false \
 	$(NULL)
 
 libvirtd_LDFLAGS = \
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 27377fe3bc..0f53b7989d 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -221,19 +221,19 @@ daemonUnixSocketPaths(struct daemonConfig *config,
     char *rundir = NULL;
 
     if (config->unix_sock_dir) {
-        if (virAsprintf(sockfile, "%s/libvirt-sock", config->unix_sock_dir) < 0)
+        if (virAsprintf(sockfile, "%s/" SOCK_NAME, config->unix_sock_dir) < 0)
             goto cleanup;
 
         if (privileged) {
-            if (virAsprintf(rosockfile, "%s/libvirt-sock-ro", config->unix_sock_dir) < 0 ||
-                virAsprintf(admsockfile, "%s/libvirt-admin-sock", config->unix_sock_dir) < 0)
+            if (virAsprintf(rosockfile, "%s/" SOCK_NAME_RO, config->unix_sock_dir) < 0 ||
+                virAsprintf(admsockfile, "%s/" SOCK_NAME_ADMIN, config->unix_sock_dir) < 0)
                 goto cleanup;
         }
     } else {
         if (privileged) {
-            if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock") < 0 ||
-                VIR_STRDUP(*rosockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro") < 0 ||
-                VIR_STRDUP(*admsockfile, LOCALSTATEDIR "/run/libvirt/libvirt-admin-sock") < 0)
+            if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/" SOCK_NAME) < 0 ||
+                VIR_STRDUP(*rosockfile, LOCALSTATEDIR "/run/libvirt/" SOCK_NAME_RO) < 0 ||
+                VIR_STRDUP(*admsockfile, LOCALSTATEDIR "/run/libvirt/" SOCK_NAME_ADMIN) < 0)
                 goto cleanup;
         } else {
             mode_t old_umask;
@@ -248,8 +248,8 @@ daemonUnixSocketPaths(struct daemonConfig *config,
             }
             umask(old_umask);
 
-            if (virAsprintf(sockfile, "%s/libvirt-sock", rundir) < 0 ||
-                virAsprintf(admsockfile, "%s/libvirt-admin-sock", rundir) < 0)
+            if (virAsprintf(sockfile, "%s/" SOCK_NAME, rundir) < 0 ||
+                virAsprintf(admsockfile, "%s/" SOCK_NAME_ADMIN, rundir) < 0)
                 goto cleanup;
         }
     }
@@ -305,56 +305,56 @@ static int daemonInitialize(void)
      * driver, since their resources must be auto-started before any
      * domains can be auto-started.
      */
-#ifdef WITH_NETWORK
-    if (virDriverLoadModule("network", "networkRegister", false) < 0)
+#if defined(WITH_NETWORK) && defined(LOAD_NETWORK)
+    if (virDriverLoadModule("network", "networkRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_INTERFACE
-    if (virDriverLoadModule("interface", "interfaceRegister", false) < 0)
+#if defined(WITH_INTERFACE) && defined(LOAD_INTERFACE)
+    if (virDriverLoadModule("interface", "interfaceRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_STORAGE
-    if (virDriverLoadModule("storage", "storageRegister", false) < 0)
+#if defined(WITH_STORAGE) && defined(LOAD_STORAGE)
+    if (virDriverLoadModule("storage", "storageRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_NODE_DEVICES
-    if (virDriverLoadModule("nodedev", "nodedevRegister", false) < 0)
+#if defined(WITH_NODE_DEVICES) && defined(LOAD_NODE_DEVICES)
+    if (virDriverLoadModule("nodedev", "nodedevRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_SECRETS
-    if (virDriverLoadModule("secret", "secretRegister", false) < 0)
+#if defined(WITH_SECRETS) && defined(LOAD_SECRETS)
+    if (virDriverLoadModule("secret", "secretRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_NWFILTER
-    if (virDriverLoadModule("nwfilter", "nwfilterRegister", false) < 0)
+#if defined(WITH_NWFILTER) && defined(LOAD_NWFILTER)
+    if (virDriverLoadModule("nwfilter", "nwfilterRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_LIBXL
-    if (virDriverLoadModule("libxl", "libxlRegister", false) < 0)
+#if defined(WITH_LIBXL) && defined(LOAD_LIBXL)
+    if (virDriverLoadModule("libxl", "libxlRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_QEMU
-    if (virDriverLoadModule("qemu", "qemuRegister", false) < 0)
+#if defined(WITH_QEMU) && defined(LOAD_QEMU)
+    if (virDriverLoadModule("qemu", "qemuRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_LXC
-    if (virDriverLoadModule("lxc", "lxcRegister", false) < 0)
+#if defined(WITH_LXC) && defined(LOAD_LXC)
+    if (virDriverLoadModule("lxc", "lxcRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_UML
-    if (virDriverLoadModule("uml", "umlRegister", false) < 0)
+#if defined(WITH_UML) && defined(LOAD_UML)
+    if (virDriverLoadModule("uml", "umlRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_VBOX
-    if (virDriverLoadModule("vbox", "vboxRegister", false) < 0)
+#if defined(WITH_VBOX) && defined(LOAD_VBOX)
+    if (virDriverLoadModule("vbox", "vboxRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_BHYVE
-    if (virDriverLoadModule("bhyve", "bhyveRegister", false) < 0)
+#if defined(WITH_BHYVE) && defined(LOAD_BHYVE)
+    if (virDriverLoadModule("bhyve", "bhyveRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
-#ifdef WITH_VZ
-    if (virDriverLoadModule("vz", "vzRegister", false) < 0)
+#if defined(WITH_VZ) && defined(LOAD_VZ)
+    if (virDriverLoadModule("vz", "vzRegister", REQUIRE_MODULE) < 0)
         return -1;
 #endif
     return 0;
@@ -368,15 +368,19 @@ daemonSetupNetworking(virNetServerPtr srv,
                       const char *sock_path,
                       const char *sock_path_ro,
                       const char *sock_path_adm,
+#ifdef WITH_NET_IP
                       bool ipsock,
-                      bool privileged)
+#endif
+                      bool privileged ATTRIBUTE_UNUSED)
 {
     virNetServerServicePtr svc = NULL;
     virNetServerServicePtr svcAdm = NULL;
     virNetServerServicePtr svcRO = NULL;
+#ifdef WITH_NET_IP
     virNetServerServicePtr svcTCP = NULL;
-#if WITH_GNUTLS
+# if WITH_GNUTLS
     virNetServerServicePtr svcTLS = NULL;
+# endif
 #endif
     gid_t unix_sock_gid = 0;
     int unix_sock_ro_mask = 0;
@@ -440,8 +444,10 @@ daemonSetupNetworking(virNetServerPtr srv,
     }
 
     if (virNetServerAddService(srv, svc,
+#ifdef WITH_NET_IP
                                config->mdns_adv && !ipsock ?
                                "_libvirt._tcp" :
+#endif
                                NULL) < 0)
         goto cleanup;
 
@@ -467,6 +473,7 @@ daemonSetupNetworking(virNetServerPtr srv,
             goto cleanup;
     }
 
+#ifdef WITH_NET_IP
     if (ipsock) {
         if (config->listen_tcp) {
             VIR_DEBUG("Registering TCP socket %s:%s",
@@ -475,9 +482,9 @@ daemonSetupNetworking(virNetServerPtr srv,
                                                      config->tcp_port,
                                                      AF_UNSPEC,
                                                      config->auth_tcp,
-#if WITH_GNUTLS
+# if WITH_GNUTLS
                                                      NULL,
-#endif
+# endif
                                                      false,
                                                      config->max_queued_clients,
                                                      config->max_client_requests)))
@@ -488,7 +495,7 @@ daemonSetupNetworking(virNetServerPtr srv,
                 goto cleanup;
         }
 
-#if WITH_GNUTLS
+# if WITH_GNUTLS
         if (config->listen_tls) {
             virNetTLSContextPtr ctxt = NULL;
 
@@ -552,23 +559,26 @@ daemonSetupNetworking(virNetServerPtr srv,
 
             virObjectUnref(ctxt);
         }
-#else
+# else
         (void)privileged;
         if (config->listen_tls) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("This libvirtd build does not support TLS"));
             goto cleanup;
         }
-#endif
+# endif
     }
+#endif
 
 #if WITH_SASL
-    if (config->auth_unix_rw == REMOTE_AUTH_SASL ||
-        (sock_path_ro && config->auth_unix_ro == REMOTE_AUTH_SASL) ||
-# if WITH_GNUTLS
-        (ipsock && config->listen_tls && config->auth_tls == REMOTE_AUTH_SASL) ||
+    if (config->auth_unix_rw == REMOTE_AUTH_SASL
+# ifdef WITH_NET_IP
+#  if WITH_GNUTLS
+        || (ipsock && config->listen_tls && config->auth_tls == REMOTE_AUTH_SASL)
+#  endif
+        || (ipsock && config->listen_tcp && config->auth_tcp == REMOTE_AUTH_SASL)
 # endif
-        (ipsock && config->listen_tcp && config->auth_tcp == REMOTE_AUTH_SASL)) {
+        || (sock_path_ro && config->auth_unix_ro == REMOTE_AUTH_SASL)) {
         saslCtxt = virNetSASLContextNewServer(
             (const char *const*)config->sasl_allowed_username_list);
         if (!saslCtxt)
@@ -579,10 +589,12 @@ daemonSetupNetworking(virNetServerPtr srv,
     ret = 0;
 
  cleanup:
-#if WITH_GNUTLS
+#ifdef WITH_NET_IP
+# if WITH_GNUTLS
     virObjectUnref(svcTLS);
-#endif
+# endif
     virObjectUnref(svcTCP);
+#endif
     virObjectUnref(svcRO);
     virObjectUnref(svcAdm);
     virObjectUnref(svc);
@@ -643,7 +655,7 @@ daemonSetupLogging(struct daemonConfig *config,
     /* Define the default output. This is only applied if there was no setting
      * from either the config or the environment.
      */
-    if (virLogSetDefaultOutput("libvirtd.log", godaemon, privileged) < 0)
+    if (virLogSetDefaultOutput(APP_NAME ".log", godaemon, privileged) < 0)
         return -1;
 
     if (virLogGetNbOutputs() == 0)
@@ -872,6 +884,7 @@ static int daemonStateInit(virNetDaemonPtr dmn)
     return 0;
 }
 
+#ifdef CONFIG_MIGRATE
 static int migrateProfile(void)
 {
     char *old_base = NULL;
@@ -944,6 +957,7 @@ static int migrateProfile(void)
 
     return ret;
 }
+#endif
 
 static int
 daemonSetupHostUUID(const struct daemonConfig *config)
@@ -1006,46 +1020,55 @@ daemonUsage(const char *argv0, bool privileged)
                   "  Default paths:\n"
                   "\n"
                   "    Configuration file (unless overridden by -f):\n"
-                  "      %s\n"
+                  "      %s.conf\n"
                   "\n"
                   "    Sockets:\n"
                   "      %s\n"
                   "      %s\n"
                   "\n"
+#ifdef WITH_NET_IP
                   "    TLS:\n"
                   "      CA certificate:     %s\n"
                   "      Server certificate: %s\n"
                   "      Server private key: %s\n"
+#endif
                   "\n"
                   "    PID file (unless overridden by -p):\n"
-                  "      %s/run/libvirtd.pid\n"
+                  "      %s/run/%s.pid\n"
                   "\n"),
-                LIBVIRTD_CONFIGURATION_FILE,
-                LIBVIRTD_PRIV_UNIX_SOCKET,
-                LIBVIRTD_PRIV_UNIX_SOCKET_RO,
+                SYSCONFDIR "/libvirt/" APP_NAME,
+                LOCALSTATEDIR "/run/libvirt/" SOCK_NAME,
+                LOCALSTATEDIR "/run/libvirt/" SOCK_NAME_RO,
+#ifdef WITH_NET_IP
                 LIBVIRT_CACERT,
                 LIBVIRT_SERVERCERT,
                 LIBVIRT_SERVERKEY,
-                LOCALSTATEDIR);
+#endif
+                LOCALSTATEDIR, APP_NAME);
     } else {
-        fprintf(stderr, "%s",
+        fprintf(stderr,
                 _("\n"
                   "  Default paths:\n"
                   "\n"
                   "    Configuration file (unless overridden by -f):\n"
-                  "      $XDG_CONFIG_HOME/libvirt/libvirtd.conf\n"
+                  "      $XDG_CONFIG_HOME/libvirt/%s.conf\n"
                   "\n"
                   "    Sockets:\n"
-                  "      $XDG_RUNTIME_DIR/libvirt/libvirt-sock\n"
+                  "      $XDG_RUNTIME_DIR/libvirt/%s\n"
                   "\n"
+#ifdef WITH_NET_IP
                   "    TLS:\n"
                   "      CA certificate:     $HOME/.pki/libvirt/cacert.pem\n"
                   "      Server certificate: $HOME/.pki/libvirt/servercert.pem\n"
                   "      Server private key: $HOME/.pki/libvirt/serverkey.pem\n"
+#endif
                   "\n"
                   "    PID file:\n"
-                  "      $XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n"
-                  "\n"));
+                  "      $XDG_RUNTIME_DIR/libvirt/%s.pid\n"
+                  "\n"),
+                APP_NAME,
+                SOCK_NAME,
+                APP_NAME);
     }
 }
 
@@ -1189,11 +1212,13 @@ int main(int argc, char **argv) {
         exit(EXIT_FAILURE);
     }
 
+#ifdef CONFIG_MIGRATE
     if (!privileged &&
         migrateProfile() < 0) {
         VIR_ERROR(_("Exiting due to failure to migrate profile"));
         exit(EXIT_FAILURE);
     }
+#endif
 
     if (daemonSetupHostUUID(config) < 0) {
         VIR_ERROR(_("Can't setup host uuid"));
@@ -1215,7 +1240,7 @@ int main(int argc, char **argv) {
     if (!pid_file &&
         virPidFileConstructPath(privileged,
                                 LOCALSTATEDIR,
-                                "libvirtd",
+                                APP_NAME,
                                 &pid_file) < 0) {
         VIR_ERROR(_("Can't determine pid file path."));
         exit(EXIT_FAILURE);
@@ -1295,7 +1320,7 @@ int main(int argc, char **argv) {
         goto cleanup;
     }
 
-    if (!(srv = virNetServerNew("libvirtd", 1,
+    if (!(srv = virNetServerNew(APP_NAME, 1,
                                 config->min_workers,
                                 config->max_workers,
                                 config->prio_workers,
@@ -1303,7 +1328,11 @@ int main(int argc, char **argv) {
                                 config->max_anonymous_clients,
                                 config->keepalive_interval,
                                 config->keepalive_count,
+#ifdef WITH_NET_IP
                                 config->mdns_adv ? config->mdns_name : NULL,
+#else
+                                NULL,
+#endif
                                 remoteClientNew,
                                 NULL,
                                 remoteClientFree,
@@ -1318,7 +1347,7 @@ int main(int argc, char **argv) {
     }
 
     if (daemonInitialize() < 0) {
-        ret = VIR_DAEMON_ERR_INIT;
+        ret = VIR_DAEMON_ERR_DRIVER;
         goto cleanup;
     }
 
@@ -1442,7 +1471,10 @@ int main(int argc, char **argv) {
                               sock_file,
                               sock_file_ro,
                               sock_file_adm,
-                              ipsock, privileged) < 0) {
+#ifdef WITH_NET_IP
+                              ipsock,
+#endif
+                              privileged) < 0) {
         ret = VIR_DAEMON_ERR_NETWORK;
         goto cleanup;
     }
diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_config.c
index b1516befb4..9759cd9438 100644
--- a/src/remote/remote_daemon_config.c
+++ b/src/remote/remote_daemon_config.c
@@ -79,7 +79,7 @@ int
 daemonConfigFilePath(bool privileged, char **configfile)
 {
     if (privileged) {
-        if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/libvirtd.conf") < 0)
+        if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/" APP_NAME ".conf") < 0)
             goto error;
     } else {
         char *configdir = NULL;
@@ -87,7 +87,7 @@ daemonConfigFilePath(bool privileged, char **configfile)
         if (!(configdir = virGetUserConfigDirectory()))
             goto error;
 
-        if (virAsprintf(configfile, "%s/libvirtd.conf", configdir) < 0) {
+        if (virAsprintf(configfile, "%s/" APP_NAME ".conf", configdir) < 0) {
             VIR_FREE(configdir);
             goto error;
         }
@@ -104,18 +104,22 @@ struct daemonConfig*
 daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
 {
     struct daemonConfig *data;
+#ifdef WITH_NET_IP
     char *localhost;
     int ret;
+#endif
 
     if (VIR_ALLOC(data) < 0)
         return NULL;
 
+#ifdef WITH_NET_IP
     data->listen_tls = 1;
     data->listen_tcp = 0;
 
     if (VIR_STRDUP(data->tls_port, LIBVIRTD_TLS_PORT) < 0 ||
         VIR_STRDUP(data->tcp_port, LIBVIRTD_TCP_PORT) < 0)
         goto error;
+#endif
 
     /* Only default to PolicyKit if running as root */
 #if WITH_POLKIT
@@ -136,14 +140,16 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
         VIR_STRDUP(data->unix_sock_admin_perms, "0700") < 0)
         goto error;
 
-#if WITH_SASL
+#ifdef WITH_NET_IP
+# if WITH_SASL
     data->auth_tcp = REMOTE_AUTH_SASL;
-#else
+# else
     data->auth_tcp = REMOTE_AUTH_NONE;
-#endif
+# endif
     data->auth_tls = REMOTE_AUTH_NONE;
 
     data->mdns_adv = 0;
+#endif
 
     data->min_workers = 5;
     data->max_workers = 20;
@@ -172,6 +178,7 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
 
     data->ovs_timeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT;
 
+#ifdef WITH_NET_IP
     localhost = virGetHostname();
     if (localhost == NULL) {
         /* we couldn't resolve the hostname; assume that we are
@@ -190,6 +197,7 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
     VIR_FREE(localhost);
     if (ret < 0)
         goto error;
+#endif
 
     return data;
 
@@ -206,9 +214,11 @@ daemonConfigFree(struct daemonConfig *data)
     if (!data)
         return;
 
+#ifdef WITH_NET_IP
     VIR_FREE(data->listen_addr);
     VIR_FREE(data->tls_port);
     VIR_FREE(data->tcp_port);
+#endif
     tmp = data->access_drivers;
     while (tmp && *tmp) {
         VIR_FREE(*tmp);
@@ -221,6 +231,7 @@ daemonConfigFree(struct daemonConfig *data)
     VIR_FREE(data->unix_sock_rw_perms);
     VIR_FREE(data->unix_sock_group);
     VIR_FREE(data->unix_sock_dir);
+#ifdef WITH_NET_IP
     VIR_FREE(data->mdns_name);
 
     tmp = data->tls_allowed_dn_list;
@@ -229,6 +240,7 @@ daemonConfigFree(struct daemonConfig *data)
         tmp++;
     }
     VIR_FREE(data->tls_allowed_dn_list);
+#endif
 
     tmp = data->sasl_allowed_username_list;
     while (tmp && *tmp) {
@@ -236,12 +248,15 @@ daemonConfigFree(struct daemonConfig *data)
         tmp++;
     }
     VIR_FREE(data->sasl_allowed_username_list);
+
+#ifdef WITH_NET_IP
     VIR_FREE(data->tls_priority);
 
     VIR_FREE(data->key_file);
     VIR_FREE(data->ca_file);
     VIR_FREE(data->cert_file);
     VIR_FREE(data->crl_file);
+#endif
 
     VIR_FREE(data->host_uuid);
     VIR_FREE(data->host_uuid_source);
@@ -256,6 +271,7 @@ daemonConfigLoadOptions(struct daemonConfig *data,
                         const char *filename,
                         virConfPtr conf)
 {
+#ifdef WITH_NET_IP
     if (virConfGetValueBool(conf, "listen_tcp", &data->listen_tcp) < 0)
         goto error;
     if (virConfGetValueBool(conf, "listen_tls", &data->listen_tls) < 0)
@@ -266,6 +282,7 @@ daemonConfigLoadOptions(struct daemonConfig *data,
         goto error;
     if (virConfGetValueString(conf, "listen_addr", &data->listen_addr) < 0)
         goto error;
+#endif
 
     if (remoteConfigGetAuth(conf, filename, "auth_unix_rw", &data->auth_unix_rw) < 0)
         goto error;
@@ -281,10 +298,12 @@ daemonConfigLoadOptions(struct daemonConfig *data,
 #endif
     if (remoteConfigGetAuth(conf, filename, "auth_unix_ro", &data->auth_unix_ro) < 0)
         goto error;
+#ifdef WITH_NET_IP
     if (remoteConfigGetAuth(conf, filename, "auth_tcp", &data->auth_tcp) < 0)
         goto error;
     if (remoteConfigGetAuth(conf, filename, "auth_tls", &data->auth_tls) < 0)
         goto error;
+#endif
 
     if (virConfGetValueStringList(conf, "access_drivers", false,
                                   &data->access_drivers) < 0)
@@ -302,6 +321,7 @@ daemonConfigLoadOptions(struct daemonConfig *data,
     if (virConfGetValueString(conf, "unix_sock_dir", &data->unix_sock_dir) < 0)
         goto error;
 
+#ifdef WITH_NET_IP
     if (virConfGetValueBool(conf, "mdns_adv", &data->mdns_adv) < 0)
         goto error;
     if (virConfGetValueString(conf, "mdns_name", &data->mdns_name) < 0)
@@ -325,14 +345,14 @@ daemonConfigLoadOptions(struct daemonConfig *data,
                                   &data->tls_allowed_dn_list) < 0)
         goto error;
 
+    if (virConfGetValueString(conf, "tls_priority", &data->tls_priority) < 0)
+        goto error;
+#endif
 
     if (virConfGetValueStringList(conf, "sasl_allowed_username_list", false,
                                   &data->sasl_allowed_username_list) < 0)
         goto error;
 
-    if (virConfGetValueString(conf, "tls_priority", &data->tls_priority) < 0)
-        goto error;
-
     if (virConfGetValueUInt(conf, "min_workers", &data->min_workers) < 0)
         goto error;
     if (virConfGetValueUInt(conf, "max_workers", &data->max_workers) < 0)
diff --git a/src/remote/remote_daemon_config.h b/src/remote/remote_daemon_config.h
index 49ea80104b..86f78e756e 100644
--- a/src/remote/remote_daemon_config.h
+++ b/src/remote/remote_daemon_config.h
@@ -30,11 +30,13 @@ struct daemonConfig {
     char *host_uuid;
     char *host_uuid_source;
 
+# ifdef WITH_NET_IP
     bool listen_tls;
     bool listen_tcp;
     char *listen_addr;
     char *tls_port;
     char *tcp_port;
+# endif
 
     char *unix_sock_admin_perms;
     char *unix_sock_ro_perms;
@@ -44,24 +46,29 @@ struct daemonConfig {
 
     int auth_unix_rw;
     int auth_unix_ro;
+# ifdef WITH_NET_IP
     int auth_tcp;
     int auth_tls;
+# endif
 
     char **access_drivers;
 
+# ifdef WITH_NET_IP
     bool mdns_adv;
     char *mdns_name;
 
     bool tls_no_verify_certificate;
     bool tls_no_sanity_certificate;
     char **tls_allowed_dn_list;
-    char **sasl_allowed_username_list;
     char *tls_priority;
 
     char *key_file;
     char *cert_file;
     char *ca_file;
     char *crl_file;
+# endif
+
+    char **sasl_allowed_username_list;
 
     unsigned int min_workers;
     unsigned int max_workers;
diff --git a/src/remote/remote_driver.h b/src/remote/remote_driver.h
index 4033a3cd2c..ef53179833 100644
--- a/src/remote/remote_driver.h
+++ b/src/remote/remote_driver.h
@@ -37,7 +37,6 @@ unsigned long remoteVersion(void);
 # define LIBVIRTD_PRIV_UNIX_SOCKET LOCALSTATEDIR "/run/libvirt/libvirt-sock"
 # define LIBVIRTD_PRIV_UNIX_SOCKET_RO LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro"
 # define LIBVIRTD_USER_UNIX_SOCKET "libvirt-sock"
-# define LIBVIRTD_CONFIGURATION_FILE SYSCONFDIR "/libvirt/libvirtd.conf"
 
 /* Defaults for PKI directory. */
 # define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux