From nobody Sun Dec 22 07:59:41 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 1734628209979565.3791478760794; Thu, 19 Dec 2024 09:10:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id F3477180A; Thu, 19 Dec 2024 12:10:08 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 09AF017DF; Thu, 19 Dec 2024 12:08:10 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id E567C1786; Thu, 19 Dec 2024 12:08:02 -0500 (EST) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 1FA2B167B for ; Thu, 19 Dec 2024 12:08:02 -0500 (EST) Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-71e15717a2dso502567a34.3 for ; Thu, 19 Dec 2024 09:08:02 -0800 (PST) Received: from home.. ([2603:8081:c640:1::1009]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71fc9807c0fsm325938a34.41.2024.12.19.09.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 09:08:00 -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.5 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=1734628081; x=1735232881; 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=RMwdLvBqzR51bCQ8OnjTHZWcXmN8hdkyA5thOHZ7LlY=; b=XdSr7IPIAnB01vH/bnePSHErfuvhI6FnKeru7XpHz9k5UsAE5864eEqyq+hlfriRrF BEb6n0+xjvvWTulSNO8Bzx7KQweqy/Yu7eBqoNeaS/KgTQO57x5N5S53QMfPE95ydXGe S4IezxHB64FsqJmoeKrg1M0Lho11wMUH8x5IPPl5bF3x68mt0zIBHaeDh07pcNMsWVbd QHn6yxP5i6lyiq/cExcb45EEFUYYm2g301PHKID/gUUkwb9gD6+PFtLVk7QyL5oZJjAq /xfk5y++wc9ps+Fju4NNbUnT5ctT2x8iR9SoQfySCL6RbKhZuIG7ADdGMv7qnLEf7NME 2R7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734628081; x=1735232881; 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=RMwdLvBqzR51bCQ8OnjTHZWcXmN8hdkyA5thOHZ7LlY=; b=bAqa387aXoFjx3tzs2EI97HgTy2spcC5n40oIzaLtsKbI3J9qlwuUiHF+aQt6I4GBl 12hOTFr9dMfKgFPJqrsVIZ3KVYnjweo38KhemXOCL25kCP+6r9nJ4nSaehq48D7COJpR 8IZRNj8wnZQXmjQq0NN3QJbt75jkW926wt68s7zpsN2D4fxmRhapNtxgcT4ZemO4OxyN a7eSt2v25OXipxZp1CVrgZBux7lmk+202E9PNE3ltjBz2BYO8D9KQn40qqU9s4ErLe/J E0rzzI3u6xWjfhesLo4Nr16RbPH6bPbfQz4vLJXeSMjkdUJ+OT/isymLwKwfZZCoV05q LnmA== X-Gm-Message-State: AOJu0Yw38D+VRpIHBwsuKpSsZXXM4E1LrZwPRDZDBIip3pg6U/PlrFQa GAYtew3huE3UAQL7YEBIiWHbnML7Yx/HF1k49L4srEanFAHmbLbtSYUZ3DtK X-Gm-Gg: ASbGncuTlTI2mn5WcCW7ZaA53M0rvfmvI2As51bHH3BBiMnUrX//UmrGbPnamYPBSwj q+FIcZe6F64pZiNlzhpbuWV094f8aKtHfsXqHQrW+L6lh3/Azztv/wgF6SZXK86wiw27hnytY3d 7M4WIOKmR8W4PD3NhdQHWeE4KUGfxJkmq29siihnxPEdodyEdqs1BH8AeUiROr7481Wc326S4Uh h2nlHt3I9aNZB5xYCP8nRdEDq9ut2jDU2KZhqK0 X-Google-Smtp-Source: AGHT+IERn6uDWq1VNGBJTVqTcduwjM1iiy8jM55e+0Z7OkLf/YFXC+ID5u7SkT7DkNVifHTTvXd5RQ== X-Received: by 2002:a05:6830:370d:b0:71e:ae7:3530 with SMTP id 46e09a7af769-720fe6a5387mr86681a34.17.1734628081197; Thu, 19 Dec 2024 09:08:01 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH v2 03/11] hypervisor: drop qemu specific args in domainLogContextNew Date: Thu, 19 Dec 2024 11:07:48 -0600 Message-ID: <20241219170756.30810-4-praveenkpaladugu@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241219170756.30810-1-praveenkpaladugu@gmail.com> References: <20241219170756.30810-1-praveenkpaladugu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: LIHFDQVIFM6LT4FMM7UG6J3UJ2ZDZANF X-Message-ID-Hash: LIHFDQVIFM6LT4FMM7UG6J3UJ2ZDZANF 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: 1734628211415116600 Content-Type: text/plain; charset="utf-8" Drop Qemu specific arguments from domainLogContextNew and replace them with hypervisor agnostic ones. Signed-off-by: Praveen K Paladugu --- src/hypervisor/domain_logcontext.c | 20 ++++++++++++-------- src/hypervisor/domain_logcontext.h | 8 ++++++-- 2 files changed, 18 insertions(+), 10 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 8bb7c3d217..07c93fcf65 100644 --- a/src/hypervisor/domain_logcontext.h +++ b/src/hypervisor/domain_logcontext.h @@ -19,14 +19,18 @@ #pragma once =20 #include -#include "qemu_conf.h" #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