From nobody Sun Feb 8 16:49:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562861132; cv=none; d=zoho.com; s=zohoarc; b=KoYYJgMsU+AMjU4VZpHr70Ygfm9Pl1V+C32wXky7u5tCPUMGnYuLA9VzZ46wbK7RikTGhQ+e/2thKvC5fjE1H8TtdvSTumdSd/w0WqVHwZdnnOIhLRqySUuyDGRXKl+DNDf3NARzmxpnLGg+b3Na8huS0mrgbuEi9HWxNIFKqwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562861132; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YRXG9XV8iG9+g0j3v50cd8UboW7UjdfFqnXFxmU77f0=; b=cPq17qCLwqJ4bjrwE1bEXns/8MQ47Jjar+h3wa+KjjkBiJK36uD4geVcZ1QpkUTEsoT43iuesgetnkkOVeolO3CN8HfbzQypuEzOTfPhfPrBmcArVWVh5LUmR629SMonNFb746zDq9ShzT1feYvuCWlxG5dmq3z5NwWcwHp762s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156286113258535.03329402975612; Thu, 11 Jul 2019 09:05:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4FD3C055678; Thu, 11 Jul 2019 16:05:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BEBAA60148; Thu, 11 Jul 2019 16:05:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 76BD11833006; Thu, 11 Jul 2019 16:05:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6BG5OhW020337 for ; Thu, 11 Jul 2019 12:05:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 67D9E4FA33; Thu, 11 Jul 2019 16:05:24 +0000 (UTC) Received: from dhcp-17-95.lcy.redhat.com (unknown [10.42.17.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id D68DD5D9CC; Thu, 11 Jul 2019 16:05:23 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 11 Jul 2019 17:04:52 +0100 Message-Id: <20190711160516.2130-6-berrange@redhat.com> In-Reply-To: <20190711160516.2130-1-berrange@redhat.com> References: <20190711160516.2130-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/29] remote: conditionalize daemon name in libvirtd daemon X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 11 Jul 2019 16:05:31 +0000 (UTC) Prepare for reusing libvirtd source to create other daemons by making the daemon name conditionally defined by the make rules. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/Makefile.inc.am | 1 + src/remote/remote_daemon.c | 34 +++++++++++++++++-------------- src/remote/remote_daemon_config.c | 5 +++-- src/remote/remote_driver.h | 1 - 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index b41f14222a..ba385aac4d 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -146,6 +146,7 @@ libvirtd_CFLAGS =3D \ -DSOCK_NAME=3D"\"libvirt-sock\"" \ -DSOCK_NAME_RO=3D"\"libvirt-sock-ro\"" \ -DSOCK_NAME_ADMIN=3D"\"libvirt-admin-sock\"" \ + -DDAEMON_NAME=3D"\"libvirtd\"" \ $(NULL) =20 libvirtd_LDFLAGS =3D \ diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 8ab3c21ef8..1a301a1e14 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -63,7 +63,7 @@ =20 #include "virdbus.h" =20 -VIR_LOG_INIT("daemon.libvirtd"); +VIR_LOG_INIT("daemon." DAEMON_NAME); =20 #if WITH_SASL virNetSASLContextPtr saslCtxt =3D NULL; @@ -564,7 +564,7 @@ daemonSetupNetDevOpenvswitch(struct daemonConfig *confi= g) =20 /* * Set up the logging environment - * By default if daemonized all errors go to the logfile libvirtd.log, + * By default if daemonized all errors go to journald/a logfile * but if verbose or error debugging is asked for then also output * informational and debug messages. Default size if 64 kB. */ @@ -577,7 +577,7 @@ daemonSetupLogging(struct daemonConfig *config, virLogReset(); =20 /* - * Libvirtd's order of precedence is: + * Logging setup order of precedence is: * cmdline > environment > config * * Given the precedence, we must process the variables in the opposite @@ -605,7 +605,7 @@ daemonSetupLogging(struct daemonConfig *config, /* Define the default output. This is only applied if there was no set= ting * from either the config or the environment. */ - if (virLogSetDefaultOutput("libvirtd", godaemon, privileged) < 0) + if (virLogSetDefaultOutput(DAEMON_NAME, godaemon, privileged) < 0) return -1; =20 if (virLogGetNbOutputs() =3D=3D 0) @@ -717,7 +717,7 @@ static void daemonStopWorker(void *opaque) =20 VIR_DEBUG("Completed stop dmn=3D%p", dmn); =20 - /* Exit libvirtd cleanly */ + /* Exit daemon cleanly */ virNetDaemonQuit(dmn); } =20 @@ -796,7 +796,7 @@ static void daemonRunStateInit(void *opaque) driversInitialized =3D true; =20 #ifdef WITH_DBUS - /* Tie the non-privileged libvirtd to the session/shutdown lifecycle */ + /* Tie the non-privileged daemons to the session/shutdown lifecycle */ if (!virNetDaemonIsPrivileged(dmn)) { =20 sessionBus =3D virDBusGetSessionBus(); @@ -895,7 +895,7 @@ daemonUsage(const char *argv0, bool privileged) " Default paths:\n" "\n" " Configuration file (unless overridden by -f):\n" - " %s\n" + " %s/libvirt/%s.conf\n" "\n" " Sockets:\n" " %s\n" @@ -907,22 +907,24 @@ daemonUsage(const char *argv0, bool privileged) " Server private key: %s\n" "\n" " PID file (unless overridden by -p):\n" - " %s/run/libvirtd.pid\n" + " %s/run/%s.pid\n" "\n"), - LIBVIRTD_CONFIGURATION_FILE, + SYSCONFDIR, + DAEMON_NAME, LOCALSTATEDIR "/run/libvirt/" SOCK_NAME, LOCALSTATEDIR "/run/libvirt/" SOCK_NAME_RO, LIBVIRT_CACERT, LIBVIRT_SERVERCERT, LIBVIRT_SERVERKEY, - LOCALSTATEDIR); + LOCALSTATEDIR, + DAEMON_NAME); } else { 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/%s\n" @@ -933,9 +935,11 @@ daemonUsage(const char *argv0, bool privileged) " Server private key: $HOME/.pki/libvirt/serverkey.= pem\n" "\n" " PID file:\n" - " $XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n" + " $XDG_RUNTIME_DIR/libvirt/%s.pid\n" "\n"), - SOCK_NAME); + DAEMON_NAME, + SOCK_NAME, + DAEMON_NAME); } } =20 @@ -1099,7 +1103,7 @@ int main(int argc, char **argv) { if (!pid_file && virPidFileConstructPath(privileged, LOCALSTATEDIR, - "libvirtd", + DAEMON_NAME, &pid_file) < 0) { VIR_ERROR(_("Can't determine pid file path.")); exit(EXIT_FAILURE); @@ -1179,7 +1183,7 @@ int main(int argc, char **argv) { goto cleanup; } =20 - if (!(srv =3D virNetServerNew("libvirtd", 1, + if (!(srv =3D virNetServerNew(DAEMON_NAME, 1, config->min_workers, config->max_workers, config->prio_workers, diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_c= onfig.c index 537b90a855..3e62b4203f 100644 --- a/src/remote/remote_daemon_config.c +++ b/src/remote/remote_daemon_config.c @@ -77,7 +77,8 @@ int daemonConfigFilePath(bool privileged, char **configfile) { if (privileged) { - if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/libvirtd.conf") <= 0) + if (VIR_STRDUP(*configfile, + SYSCONFDIR "/libvirt/" DAEMON_NAME ".conf") < 0) goto error; } else { char *configdir =3D NULL; @@ -85,7 +86,7 @@ daemonConfigFilePath(bool privileged, char **configfile) if (!(configdir =3D virGetUserConfigDirectory())) goto error; =20 - if (virAsprintf(configfile, "%s/libvirtd.conf", configdir) < 0) { + if (virAsprintf(configfile, "%s/%s.conf", configdir, DAEMON_NAME) = < 0) { VIR_FREE(configdir); goto error; } diff --git a/src/remote/remote_driver.h b/src/remote/remote_driver.h index 8c7da6b000..132e478ef3 100644 --- a/src/remote/remote_driver.h +++ b/src/remote/remote_driver.h @@ -34,7 +34,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-s= ock-ro" #define LIBVIRTD_USER_UNIX_SOCKET "libvirt-sock" -#define LIBVIRTD_CONFIGURATION_FILE SYSCONFDIR "/libvirt/libvirtd.conf" =20 /* Defaults for PKI directory. */ #define LIBVIRT_PKI_DIR SYSCONFDIR "/pki" --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list