From nobody Sun Dec 22 08:32:04 2024 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; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1733507390381100.81113548902817; Fri, 6 Dec 2024 09:49:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 73B7A1470; Fri, 6 Dec 2024 12:49:49 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4F4A4147B; Fri, 6 Dec 2024 12:48:02 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3659BBC5; Fri, 6 Dec 2024 12:47:56 -0500 (EST) Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 769A99DF for ; Fri, 6 Dec 2024 12:47:55 -0500 (EST) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-2689e7a941fso747772fac.3 for ; Fri, 06 Dec 2024 09:47:55 -0800 (PST) Received: from home.. ([2603:8081:c640:1::100a]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29f566ea976sm932125fac.15.2024.12.06.09.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:53 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733507274; x=1734112074; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YHlncWZRxZANeskr1HFMqycmVd8PFA4NpVzqT/651ho=; b=f137vrbau3pXF8pt+EWD/XXNWCAxiGg7Z/NAE8WpZL771AbLJEBN/B6DJI6xkxurFB t8Fw6Kezza1VwVBz017n58+/eYrCwTf7/0as/smTWfg7Z7QNw6MPPugyrNgfXtcE4GgQ nQNc7whJGr94KEQv74F35aMO07A1wtYmOXArEFUqEcG8Amz+AAZ5LUGB5fOFA/gTbiwC IdcqUXestOF6sPKAWjQSCOQa8HlcY48LdP7+ejmEIiK3Fx4jLGILQDUlMvIQKEuKF6mo VHaAJ3ZcwcqhG8kzLaVuRxXvHllbAn9VQpiV2AFd7qyksxh1UaK4MeGlCCDAesoUj5Yp A5LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507274; x=1734112074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YHlncWZRxZANeskr1HFMqycmVd8PFA4NpVzqT/651ho=; b=g5XvjuQUNAfywr9UVbhpXOKzwlnFohgSQtAwXTtRZk/bho7qfVCckHuVI5w4uB1UCh 6thEdH6Y7KbDFSoe6U69BWWJG97NUtS7JWcaaoWOBKmroufb7CN5OARh9xo45FFH1VKv 3Vtpx4KZC7SIot+Nh7RzWUtj2It23Ii9nhCiiZXTvz0yEntPjfPc9JtFY4tzKkBh2NwK BR/olar39EIXSUR9YrQNqqRh3aIZpZ6J6pJOP76Mq5ZHx4VaVQbn9nCApF3PhXembYNj sMbBQRjLcZXLejuy/SHE7lcPWBE//qMAPbIwjxbLlXJ1p0FracOZ+iULDa+HaI0G9Lrk Dfvw== X-Gm-Message-State: AOJu0YzCOwDblR3DG8yJoozndgzUjzDMpQ8xAtUFJcLpxVDHWmMQ0mBs OLgyLW/9mw54mNnkQfL7YFW9sLt45fRVP0vJIwiBU1WNGc7QVhITU5m4MKOQ X-Gm-Gg: ASbGncuiUao1H8ee+knCn1AhCvEh1nnGZYHzD1x/l+JZzAYY9DEo5Tb3z5WBQnRBN9Z oUALN2BCMPg03+eH812froHJ8CguuPm68Fh0xh0TuX5eFvvAx+Sgefab1pQ1x0M3mn/JtmAO6RY lY+9xDEh/vzxkmfePOjtrc0YOpMKvNyZj3P53IZhDWjwoZsj1PHe0vBkmiD2KWXRJuXEpR02ibA idNZf9774dyxrhAPePkf1IJ01wDXRpEkQ== X-Google-Smtp-Source: AGHT+IFBwM1ZwGWhutdUtqYLVlhzgfTnu5EAviZaG/3gdhzmA+kkceWpmxw9UmNvUQ5WtDbLKsCcGA== X-Received: by 2002:a05:6870:9605:b0:29e:2801:43e6 with SMTP id 586e51a60fabf-29f73341363mr2544525fac.23.1733507274315; Fri, 06 Dec 2024 09:47:54 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 2/8] hypervisor: drop hypervisor specific args in domainLogContextNew Date: Fri, 6 Dec 2024 11:47:43 -0600 Message-ID: <20241206174749.33455-3-praveenkpaladugu@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206174749.33455-1-praveenkpaladugu@gmail.com> References: <20241206174749.33455-1-praveenkpaladugu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RGTVD7FXCOMEEV2WCZ77JP5EI5YGTPLR X-Message-ID-Hash: RGTVD7FXCOMEEV2WCZ77JP5EI5YGTPLR X-MailFrom: praveenkpaladugu@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: liuwe@microsoft.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1733507390863116600 Content-Type: text/plain; charset="utf-8" Drop Qemu specific arguments from domainLogContextNew. Signed-off-by: Praveen K Paladugu --- src/hypervisor/domain_logcontext.c | 20 ++++++++++++-------- src/hypervisor/domain_logcontext.h | 6 +++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/hypervisor/domain_logcontext.c b/src/hypervisor/domain_log= context.c index 3776d68ab9..41d1bbdf64 100644 --- a/src/hypervisor/domain_logcontext.c +++ b/src/hypervisor/domain_logcontext.c @@ -23,6 +23,8 @@ #include "virlog.h" #include "virstring.h" #include "virutil.h" +#include "virfile.h" +#include "virerror.h" =20 #include =20 @@ -78,26 +80,28 @@ domainLogContextFinalize(GObject *object) =20 =20 domainLogContext * -domainLogContextNew(virQEMUDriver *driver, +domainLogContextNew(bool stdioLogD, + char *logDir, + const char *driver_name, virDomainObj *vm, + bool privileged, const char *basename) { - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); domainLogContext *ctxt =3D DOMAIN_LOG_CONTEXT(g_object_new(DOMAIN_TYPE= _LOG_CONTEXT, NULL)); =20 - VIR_DEBUG("Context new %p stdioLogD=3D%d", ctxt, cfg->stdioLogD); + VIR_DEBUG("Context new %p stdioLogD=3D%d", ctxt, stdioLogD); ctxt->writefd =3D -1; ctxt->readfd =3D -1; =20 - ctxt->path =3D g_strdup_printf("%s/%s.log", cfg->logDir, basename); + ctxt->path =3D g_strdup_printf("%s/%s.log", logDir, basename); =20 - if (cfg->stdioLogD) { - ctxt->manager =3D virLogManagerNew(driver->privileged); + if (stdioLogD) { + ctxt->manager =3D virLogManagerNew(privileged); if (!ctxt->manager) goto error; =20 ctxt->writefd =3D virLogManagerDomainOpenLogFile(ctxt->manager, - "qemu", + driver_name, vm->def->uuid, vm->def->name, ctxt->path, @@ -121,7 +125,7 @@ domainLogContextNew(virQEMUDriver *driver, /* For unprivileged startup we must truncate the file since * we can't rely on logrotate. We don't use O_TRUNC since * it is better for SELinux policy if we truncate afterwards */ - if (!driver->privileged && + if (!privileged && ftruncate(ctxt->writefd, 0) < 0) { virReportSystemError(errno, _("failed to truncate %1$s"), ctxt->path); diff --git a/src/hypervisor/domain_logcontext.h b/src/hypervisor/domain_log= context.h index 0842f994d6..078b9e9459 100644 --- a/src/hypervisor/domain_logcontext.h +++ b/src/hypervisor/domain_logcontext.h @@ -21,12 +21,16 @@ #include #include "logging/log_manager.h" #include "virconftypes.h" +#include "domain_conf.h" =20 #define DOMAIN_TYPE_LOG_CONTEXT domain_log_context_get_type() G_DECLARE_FINAL_TYPE(domainLogContext, domain_log_context, DOMAIN, LOG_CON= TEXT, GObject); =20 -domainLogContext *domainLogContextNew(virQEMUDriver *driver, +domainLogContext *domainLogContextNew(bool stdioLogD, + char *logDir, + const char *driver_name, virDomainObj *vm, + bool privileged, const char *basename); int domainLogContextWrite(domainLogContext *ctxt, const char *fmt, ...) G_GNUC_PRINTF(2, 3); --=20 2.47.0