From nobody Sun Feb 8 09:30:44 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=1563897841; cv=none; d=zoho.com; s=zohoarc; b=e3DpgV21IO4naNfq8oQyJ4I1j7vLUZDyCu6y9krc6Czk1VGpMG6HorM4tff5mijj/2VlljOh6rH8SRgrirnTnKZycb4DPSMhTDIQqZh1fqUNE+1NVXqgUekcm7FspKyrGmn9Oae0gnsNrzT3jAXVo/fiX51jzibfiBq+ovPIMSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563897841; 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=WYxEFnP/N9DLprP08AN5hf+aCB2LY/e7B1ZXagUvWSI=; b=JBHAGQborer+xQh22sgWE/ZbZIP7DtuvSR6O32Yv45Mz4D7p0h2Mneu/TmHa04WA8G6oOeZDJ8LHAqRS58TZFGWZvV3YV2kCysvZDTw0RJftXMhwls9yQx7eECRziFI/r4xgLpD0Q+p21RUTAvEhJH2Xvp77i4SMhfMGvY3gTiI= 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 1563897841239148.87276959892267; Tue, 23 Jul 2019 09:04:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67AAB30C0DCF; Tue, 23 Jul 2019 16:03:59 +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 3AC5F5D6A9; Tue, 23 Jul 2019 16:03:59 +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 E8036180020C; Tue, 23 Jul 2019 16:03:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6NG3v18024647 for ; Tue, 23 Jul 2019 12:03:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 664305C234; Tue, 23 Jul 2019 16:03:57 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 128435C28C; Tue, 23 Jul 2019 16:03:55 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 23 Jul 2019 17:02:46 +0100 Message-Id: <20190723160319.18153-9-berrange@redhat.com> In-Reply-To: <20190723160319.18153-1-berrange@redhat.com> References: <20190723160319.18153-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/41] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 23 Jul 2019 16:04:00 +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 | 48 +++++++++++++++++-------------- src/remote/remote_daemon_config.c | 5 ++-- src/remote/remote_driver.h | 1 - 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index ced940d3c1..b72186109a 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -147,6 +147,7 @@ libvirtd_CFLAGS =3D \ -I$(srcdir)/conf \ -I$(srcdir)/rpc \ -DSOCK_PREFIX=3D"\"libvirt\"" \ + -DDAEMON_NAME=3D"\"libvirtd\"" \ $(NULL) =20 libvirtd_LDFLAGS =3D \ diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 056ae2ba91..0982e281de 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -64,7 +64,11 @@ =20 #include "virdbus.h" =20 -VIR_LOG_INIT("daemon.libvirtd"); +VIR_LOG_INIT("daemon." DAEMON_NAME); + +#ifndef SOCK_PREFIX +# define SOCK_PREFIX DAEMON_NAME +#endif =20 #if WITH_SASL virNetSASLContextPtr saslCtxt =3D NULL; @@ -375,11 +379,11 @@ daemonSetupNetworking(virNetServerPtr srv, int ret =3D -1; VIR_AUTOPTR(virSystemdActivation) act =3D NULL; virSystemdActivationMap actmap[] =3D { - { .name =3D "libvirtd.socket", .family =3D AF_UNIX, .path =3D sock= _path }, - { .name =3D "libvirtd-ro.socket", .family =3D AF_UNIX, .path =3D s= ock_path_ro }, - { .name =3D "libvirtd-admin.socket", .family =3D AF_UNIX, .path = =3D sock_path_adm }, - { .name =3D "libvirtd-tcp.socket", .family =3D AF_INET }, - { .name =3D "libvirtd-tls.socket", .family =3D AF_INET }, + { .name =3D DAEMON_NAME ".socket", .family =3D AF_UNIX, .path =3D = sock_path }, + { .name =3D DAEMON_NAME "-ro.socket", .family =3D AF_UNIX, .path = =3D sock_path_ro }, + { .name =3D DAEMON_NAME "-admin.socket", .family =3D AF_UNIX, .pat= h =3D sock_path_adm }, + { .name =3D DAEMON_NAME "-tcp.socket", .family =3D AF_INET }, + { .name =3D DAEMON_NAME "-tls.socket", .family =3D AF_INET }, }; =20 if ((actmap[3].port =3D virSocketAddrResolveService(config->tcp_port))= < 0) @@ -413,7 +417,7 @@ daemonSetupNetworking(virNetServerPtr srv, =20 if (virNetServerAddServiceUNIX(srv, act, - "libvirtd.socket", + DAEMON_NAME ".socket", sock_path, unix_sock_rw_mask, unix_sock_gid, @@ -426,7 +430,7 @@ daemonSetupNetworking(virNetServerPtr srv, if (sock_path_ro && virNetServerAddServiceUNIX(srv, act, - "libvirtd-ro.socket", + DAEMON_NAME "-ro.socket", sock_path_ro, unix_sock_ro_mask, unix_sock_gid, @@ -440,7 +444,7 @@ daemonSetupNetworking(virNetServerPtr srv, if (sock_path_adm && virNetServerAddServiceUNIX(srvAdm, act, - "libvirtd-admin.socket", + DAEMON_NAME "-admin.socket", sock_path_adm, unix_sock_adm_mask, unix_sock_gid, @@ -454,7 +458,7 @@ daemonSetupNetworking(virNetServerPtr srv, if (((ipsock && config->listen_tcp) || act) && virNetServerAddServiceTCP(srv, act, - "libvirtd-tcp.socket", + DAEMON_NAME "-tcp.socket", config->listen_addr, config->tcp_port, AF_UNSPEC, @@ -511,7 +515,7 @@ daemonSetupNetworking(virNetServerPtr srv, config->listen_addr, config->tls_port); if (virNetServerAddServiceTCP(srv, act, - "libvirtd-tls.socket", + DAEMON_NAME "-tls.socket", config->listen_addr, config->tls_port, AF_UNSPEC, @@ -556,7 +560,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. */ @@ -569,7 +573,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 @@ -597,7 +601,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) @@ -709,7 +713,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 @@ -788,7 +792,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 +899,7 @@ daemonUsage(const char *argv0, bool privileged) fprintf(stderr, "\n"); =20 fprintf(stderr, " %s:\n", _("Configuration file (unless overridden = by -f)")); - fprintf(stderr, " %s/libvirt/libvirtd.conf\n", + fprintf(stderr, " %s/libvirt/" DAEMON_NAME ".conf\n", privileged ? SYSCONFDIR : "$XDG_CONFIG_HOME"); fprintf(stderr, "\n"); =20 @@ -922,9 +926,9 @@ daemonUsage(const char *argv0, bool privileged) =20 fprintf(stderr, " %s:\n", _("PID file (unless overridden by -p)")); - fprintf(stderr, " %s\n", - privileged ? LOCALSTATEDIR "/run/libvirtd.pid": - "$XDG_RUNTIME_DIR/libvirt/libvirtd.pid"); + fprintf(stderr, " %s/\n", + privileged ? LOCALSTATEDIR "/run/" DAEMON_NAME ".pid": + "$XDG_RUNTIME_DIR/libvirt/" DAEMON_NAME ".pid"); fprintf(stderr, "\n"); } =20 @@ -1088,7 +1092,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); @@ -1168,7 +1172,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