From nobody Mon Feb 2 05:57:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1768486033; cv=none; d=zohomail.com; s=zohoarc; b=ieGMA9xb7KkrcMJ3z8l5lCEJLins8PIFM+kGAsyILHhYchkLAxhZhsHXj8888h62lyv3pov4N2df1uRyxaDCiewTG9iMvq7ghzVIW3lITO5S/hQxtYFTdKog/pUFo3/RhVJv1wnhdhQF38cqh5sy1mjkOi+hppiCRKWcd9987M0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768486033; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=WbXxTXf61ezsdu7r6F6M5rR6A6hZ38rQcgSe7mCia3o=; b=mcxvYoPYk0dM6kC4rFRzJb/1byKKbEFFF8S+P4bAEJTVMwBRRtanJ+CczWHfLgkVkFB/ax/lfFQHHvkNHOO4af1WDgj8juAzBnAki4rh5HsSSJU8aLSqLpGMY6CLh/pIq49tjST1Av1x7BvV/5Wx/JGdxh/EpFo1VV6wiy4CJm4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1768486033735190.58621564246005; Thu, 15 Jan 2026 06:07:13 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id ACD183F95F; Thu, 15 Jan 2026 09:07:12 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 5E7EB41B99; Thu, 15 Jan 2026 09:06:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 01BA73F30D; Thu, 15 Jan 2026 09:06:16 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4862D3F304 for ; Thu, 15 Jan 2026 09:06:15 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-572-j1S3EvJQOF2gQJAasjFqkA-1; Thu, 15 Jan 2026 09:06:13 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E60FE1956088 for ; Thu, 15 Jan 2026 14:06:12 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4F115180049F for ; Thu, 15 Jan 2026 14:06:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768485975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WbXxTXf61ezsdu7r6F6M5rR6A6hZ38rQcgSe7mCia3o=; b=APp3B2QmaF7QTtmcAmuZCuLLN8/IhcPQqXNyxT6N2BKONmrRCJGx4aebBHTwY2xS92xMbJ R5WwaUIS+DBMvxihOGOk8Sm2ztz2DxJuG5F+SkdnJojGj4eBubReim8yos3/iJTpXHAMm1 Ny+pbWOxKJpCzoyFvPM0/ACubcYRla0= X-MC-Unique: j1S3EvJQOF2gQJAasjFqkA-1 X-Mimecast-MFC-AGG-ID: j1S3EvJQOF2gQJAasjFqkA_1768485973 To: devel@lists.libvirt.org Subject: [PATCH] domain_logcontext: Don't assume remote driver is always available Date: Thu, 15 Jan 2026 15:03:29 +0100 Message-ID: <4c917e91cb4524ccad87e536b672b8527d5ddcd8.1768485809.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: N_yFcRozlfBYEplXCB1zYoybFjLIGPhT4yI9_Pehkmw_1768485973 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7HSM5JB5C7GLBJWXH5A2N2NNAGWXRQFC X-Message-ID-Hash: 7HSM5JB5C7GLBJWXH5A2N2NNAGWXRQFC X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1768486035616158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Some functions inside of domain_logcontext call virLogManager APIs. But that one is available only when remote driver is enabled (from src/logging/meson.build): if conf.has('WITH_REMOTE') log_driver_lib =3D static_library( 'virt_log_driver', [ log_driver_sources, log_protocol_generated, ], ... Guard calls to virLogManager APIs with #ifdef WITH_REMOTE. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/842 Signed-off-by: Michal Privoznik --- src/hypervisor/domain_logcontext.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/hypervisor/domain_logcontext.c b/src/hypervisor/domain_log= context.c index 41d1bbdf64..92f942eb81 100644 --- a/src/hypervisor/domain_logcontext.c +++ b/src/hypervisor/domain_logcontext.c @@ -71,7 +71,9 @@ domainLogContextFinalize(GObject *object) domainLogContext *ctxt =3D DOMAIN_LOG_CONTEXT(object); VIR_DEBUG("ctxt=3D%p", ctxt); =20 +#ifdef WITH_REMOTE virLogManagerFree(ctxt->manager); +#endif VIR_FREE(ctxt->path); VIR_FORCE_CLOSE(ctxt->writefd); VIR_FORCE_CLOSE(ctxt->readfd); @@ -82,8 +84,8 @@ domainLogContextFinalize(GObject *object) domainLogContext * domainLogContextNew(bool stdioLogD, char *logDir, - const char *driver_name, - virDomainObj *vm, + const char *driver_name G_GNUC_UNUSED, + virDomainObj *vm G_GNUC_UNUSED, bool privileged, const char *basename) { @@ -96,6 +98,7 @@ domainLogContextNew(bool stdioLogD, ctxt->path =3D g_strdup_printf("%s/%s.log", logDir, basename); =20 if (stdioLogD) { +#ifdef WITH_REMOTE ctxt->manager =3D virLogManagerNew(privileged); if (!ctxt->manager) goto error; @@ -110,6 +113,11 @@ domainLogContextNew(bool stdioLogD, &ctxt->pos); if (ctxt->writefd < 0) goto error; +#else /* !WITH_REMOTE */ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("logd stdio handler is not supported")); + goto error; +#endif /* !WITH_REMOTE */ } else { if ((ctxt->writefd =3D open(ctxt->path, O_WRONLY | O_CREAT | O_APP= END, S_IRUSR | S_IWUSR)) < 0) { virReportSystemError(errno, _("failed to create logfile %1$s"), @@ -202,6 +210,7 @@ domainLogContextRead(domainLogContext *ctxt, (unsigned long long)ctxt->pos); =20 if (ctxt->manager) { +#ifdef WITH_REMOTE buf =3D virLogManagerDomainReadLogFile(ctxt->manager, ctxt->path, ctxt->inode, @@ -211,6 +220,11 @@ domainLogContextRead(domainLogContext *ctxt, if (!buf) return -1; buflen =3D strlen(buf); +#else /* !WITH_REMOTE */ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("logd stdio handler is not supported")); + return -1; +#endif /* !WITH_REMOTE */ } else { ssize_t got; =20 @@ -315,14 +329,17 @@ domainLogContextGetWriteFD(domainLogContext *ctxt) void domainLogContextMarkPosition(domainLogContext *ctxt) { - if (ctxt->manager) + if (ctxt->manager) { +#ifdef WITH_REMOTE virLogManagerDomainGetLogFilePosition(ctxt->manager, ctxt->path, 0, &ctxt->inode, &ctxt->pos); - else +#endif /* WITH_REMOTE */ + } else { ctxt->pos =3D lseek(ctxt->writefd, 0, SEEK_END); + } } =20 =20 --=20 2.52.0