From nobody Sun Dec 22 02:45:10 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 1733507361909700.591263312325; Fri, 6 Dec 2024 09:49:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id E4E2313A9; Fri, 6 Dec 2024 12:49:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 46EAC1470; Fri, 6 Dec 2024 12:48:00 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6073BBC5; Fri, 6 Dec 2024 12:47:55 -0500 (EST) Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (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 0FF5F9DE for ; Fri, 6 Dec 2024 12:47:54 -0500 (EST) Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-29e5aedbebdso1209814fac.0 for ; Fri, 06 Dec 2024 09:47:54 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:52 -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_H2,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=1733507273; x=1734112073; 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=s1UtpOT8Cwhv8BvqJakmv1cxaiS6BNPPLzXXuOLjPkQ=; b=IuaHeLy+BdHG0Q02usptbJRnix7lFT8aTrXBgnpoofb/E0K2OFFyFpYJqv0oZY2C76 m8nxD0h4yaYmn3S9V4AuROellfHRUPxI2ElaSVfqKlGIRTRmX226cC5VXPW7fafsoL9U hOt1fxuJgtJJfVNkhcGs92ezBHgw6cD7ZBgeByiWMUZhIJ/8dF1HlaQqpbsrUx52rwpv Yz8gfDcc2UXbCzxkZyos//xi+iqBx4V10Fq6k7KAHJ5RtStLJQum+RV6omWCkHeM0tLY VvuOkiNEOFtHmy4EKUOrVwuzHW9pWYbyuxoM+8XYY9E/w2yi8UzsaidZlabKauG4wx2w d//A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507273; x=1734112073; 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=s1UtpOT8Cwhv8BvqJakmv1cxaiS6BNPPLzXXuOLjPkQ=; b=DiL3uNhxqQ2LEmmKTCzfi7F0EOZRFmlzSt5H4x/WTZQeECrTFFPpPDJxATHHqgBHF5 Iw9AZFzReCLqat1O+qdw3Pp/jXRsnc0pnzK2XyZWNzMP0Ne0Ye5KCyRfMFceaEu+AsWr LiVm/VDSIWUhVJfIsZShe54Okj9dOBvaH7EIUAOJbj4Wco4FYEUZ2gAzTGoGJIYs/xv5 pJlDylTiMG4ulCIf/lQ4wkMsd+ka51UpSLX1jUA3+7iMFcCJPplDYFHHxG8d3dEsCnow dS1mL0BPL3XyrKIee1F0yi+0VQoeUaXwaODJ980GnRUQqYoKV5U9NdkPvtctzfAL5aog J37Q== X-Gm-Message-State: AOJu0YyvOXhYohhBs7/7IbgdG1CLIHJhQTy1mT3ilGpq0UyIUlEOz0TJ 7hQGahfaukJ3rlifRoJtipDHnSfJVGdQQpSbIfbTTEWAiuW1zeXQ6mdqkyr7 X-Gm-Gg: ASbGnctas+NbmArpt9iR5Y9sRpJ3t+rbQGrUjhJ6xGE9kPd34DNlpuXlzXJ64Vdgagb cwguzONdzyxUi80NnHhyDd9wPvzFmQmfJUpL91NJYU7RZDdldMah276D8Yx6kColAEgEsn17/C1 7RBQg+KMJ8btJrjPmBmRAkhLuMKoxinqYZk9MSMzCOTawU4InoemZva9WJLPPeUQFn/NVZs2Rmj zZEbOq09LE/M0KNMq/ndq/AbOFc+L4/Fg== X-Google-Smtp-Source: AGHT+IElFSEeF1bbX/IEyAV4JncNJqoPkYuauU4pJg+AtOb3U2NhWmnqMVXDorqcy2E9atI98ytogw== X-Received: by 2002:a05:6870:dc4b:b0:288:a953:a5c7 with SMTP id 586e51a60fabf-29f732d8925mr2036970fac.14.1733507273022; Fri, 06 Dec 2024 09:47:53 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 1/8] domain: move logcontext mgmt from qemu to hypervisor Date: Fri, 6 Dec 2024 11:47:42 -0600 Message-ID: <20241206174749.33455-2-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: K3I2PKYPDPC5W2RIPBNJ2UCNGXDEGAXT X-Message-ID-Hash: K3I2PKYPDPC5W2RIPBNJ2UCNGXDEGAXT 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: 1733507362655116600 Content-Type: text/plain; charset="utf-8" Move logcontext management from qemu to hypevisor to be shared across hypervisors. This commit only replaces the names. Build fixes will follow in next commit. Signed-off-by: Praveen K Paladugu --- .../domain_logcontext.c} | 60 +++++++++---------- src/hypervisor/domain_logcontext.h | 41 +++++++++++++ src/hypervisor/meson.build | 1 + src/qemu/meson.build | 1 - src/qemu/qemu_domain.c | 28 ++++----- src/qemu/qemu_domain.h | 12 ++-- src/qemu/qemu_logcontext.h | 41 ------------- src/qemu/qemu_nbdkit.c | 8 +-- src/qemu/qemu_process.c | 43 ++++++------- 9 files changed, 118 insertions(+), 117 deletions(-) rename src/{qemu/qemu_logcontext.c =3D> hypervisor/domain_logcontext.c} (8= 4%) create mode 100644 src/hypervisor/domain_logcontext.h delete mode 100644 src/qemu/qemu_logcontext.h diff --git a/src/qemu/qemu_logcontext.c b/src/hypervisor/domain_logcontext.c similarity index 84% rename from src/qemu/qemu_logcontext.c rename to src/hypervisor/domain_logcontext.c index 6e20f58bfa..3776d68ab9 100644 --- a/src/qemu/qemu_logcontext.c +++ b/src/hypervisor/domain_logcontext.c @@ -1,5 +1,5 @@ /* - * qemu_logcontext.c: QEMU log context + * domain_logcontext.c: Domain log context * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ =20 #include =20 -#include "qemu_logcontext.h" +#include "domain_logcontext.h" #include "viralloc.h" #include "virlog.h" #include "virstring.h" @@ -26,12 +26,12 @@ =20 #include =20 -#define VIR_FROM_THIS VIR_FROM_QEMU +#define VIR_FROM_THIS VIR_FROM_DOMAIN =20 -VIR_LOG_INIT("qemu.qemu_logcontext"); +VIR_LOG_INIT("domain.domain_logcontext"); =20 =20 -struct _qemuLogContext { +struct _domainLogContext { GObject parent; =20 int writefd; @@ -42,48 +42,48 @@ struct _qemuLogContext { virLogManager *manager; }; =20 -G_DEFINE_TYPE(qemuLogContext, qemu_log_context, G_TYPE_OBJECT); +G_DEFINE_TYPE(domainLogContext, domain_log_context, G_TYPE_OBJECT); =20 static void -qemuLogContextFinalize(GObject *obj); +domainLogContextFinalize(GObject *obj); =20 =20 static void -qemu_log_context_init(qemuLogContext *logctxt G_GNUC_UNUSED) +domain_log_context_init(domainLogContext *logctxt G_GNUC_UNUSED) { } =20 =20 static void -qemu_log_context_class_init(qemuLogContextClass *klass) +domain_log_context_class_init(domainLogContextClass *klass) { GObjectClass *obj =3D G_OBJECT_CLASS(klass); =20 - obj->finalize =3D qemuLogContextFinalize; + obj->finalize =3D domainLogContextFinalize; } =20 =20 static void -qemuLogContextFinalize(GObject *object) +domainLogContextFinalize(GObject *object) { - qemuLogContext *ctxt =3D QEMU_LOG_CONTEXT(object); + domainLogContext *ctxt =3D DOMAIN_LOG_CONTEXT(object); VIR_DEBUG("ctxt=3D%p", ctxt); =20 virLogManagerFree(ctxt->manager); VIR_FREE(ctxt->path); VIR_FORCE_CLOSE(ctxt->writefd); VIR_FORCE_CLOSE(ctxt->readfd); - G_OBJECT_CLASS(qemu_log_context_parent_class)->finalize(object); + G_OBJECT_CLASS(domain_log_context_parent_class)->finalize(object); } =20 =20 -qemuLogContext * -qemuLogContextNew(virQEMUDriver *driver, - virDomainObj *vm, - const char *basename) +domainLogContext * +domainLogContextNew(virQEMUDriver *driver, + virDomainObj *vm, + const char *basename) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - qemuLogContext *ctxt =3D QEMU_LOG_CONTEXT(g_object_new(QEMU_TYPE_LOG_C= ONTEXT, NULL)); + 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); ctxt->writefd =3D -1; @@ -155,8 +155,8 @@ qemuLogContextNew(virQEMUDriver *driver, =20 =20 int -qemuLogContextWrite(qemuLogContext *ctxt, - const char *fmt, ...) +domainLogContextWrite(domainLogContext *ctxt, + const char *fmt, ...) { va_list argptr; g_autofree char *message =3D NULL; @@ -186,8 +186,8 @@ qemuLogContextWrite(qemuLogContext *ctxt, =20 =20 ssize_t -qemuLogContextRead(qemuLogContext *ctxt, - char **msg) +domainLogContextRead(domainLogContext *ctxt, + char **msg) { char *buf; size_t buflen; @@ -238,7 +238,7 @@ qemuLogContextRead(qemuLogContext *ctxt, =20 =20 /** - * qemuLogContextFilter: Read and filter log for relevant messages + * domainLogContextFilter: Read and filter log for relevant messages * @ctxt: the domain log context * @msg: pointer to buffer to store the read messages in * @max: maximum length of the message returned in @msg after filtering @@ -249,9 +249,9 @@ qemuLogContextRead(qemuLogContext *ctxt, * after a new line if possible. */ int -qemuLogContextReadFiltered(qemuLogContext *ctxt, - char **msg, - size_t max) +domainLogContextReadFiltered(domainLogContext *ctxt, + char **msg, + size_t max) { char *buf; char *eol; @@ -259,7 +259,7 @@ qemuLogContextReadFiltered(qemuLogContext *ctxt, size_t skip; ssize_t got; =20 - if ((got =3D qemuLogContextRead(ctxt, &buf)) < 0) + if ((got =3D domainLogContextRead(ctxt, &buf)) < 0) return -1; =20 /* Filter out debug messages from intermediate libvirt process */ @@ -302,14 +302,14 @@ qemuLogContextReadFiltered(qemuLogContext *ctxt, =20 =20 int -qemuLogContextGetWriteFD(qemuLogContext *ctxt) +domainLogContextGetWriteFD(domainLogContext *ctxt) { return ctxt->writefd; } =20 =20 void -qemuLogContextMarkPosition(qemuLogContext *ctxt) +domainLogContextMarkPosition(domainLogContext *ctxt) { if (ctxt->manager) virLogManagerDomainGetLogFilePosition(ctxt->manager, @@ -323,7 +323,7 @@ qemuLogContextMarkPosition(qemuLogContext *ctxt) =20 =20 virLogManager * -qemuLogContextGetManager(qemuLogContext *ctxt) +domainLogContextGetManager(domainLogContext *ctxt) { return ctxt->manager; } diff --git a/src/hypervisor/domain_logcontext.h b/src/hypervisor/domain_log= context.h new file mode 100644 index 0000000000..0842f994d6 --- /dev/null +++ b/src/hypervisor/domain_logcontext.h @@ -0,0 +1,41 @@ +/* + * domain_logcontext.h: Domin log context + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#pragma once + +#include +#include "logging/log_manager.h" +#include "virconftypes.h" + +#define DOMAIN_TYPE_LOG_CONTEXT domain_log_context_get_type() +G_DECLARE_FINAL_TYPE(domainLogContext, domain_log_context, DOMAIN, LOG_CON= TEXT, GObject); + +domainLogContext *domainLogContextNew(virQEMUDriver *driver, + virDomainObj *vm, + const char *basename); +int domainLogContextWrite(domainLogContext *ctxt, + const char *fmt, ...) G_GNUC_PRINTF(2, 3); +ssize_t domainLogContextRead(domainLogContext *ctxt, + char **msg); +int domainLogContextReadFiltered(domainLogContext *ctxt, + char **msg, + size_t max); +int domainLogContextGetWriteFD(domainLogContext *ctxt); +void domainLogContextMarkPosition(domainLogContext *ctxt); + +virLogManager *domainLogContextGetManager(domainLogContext *ctxt); diff --git a/src/hypervisor/meson.build b/src/hypervisor/meson.build index 819a9a82a2..c32703af88 100644 --- a/src/hypervisor/meson.build +++ b/src/hypervisor/meson.build @@ -2,6 +2,7 @@ hypervisor_sources =3D [ 'domain_cgroup.c', 'domain_driver.c', 'domain_interface.c', + 'domain_logcontext.c', 'virclosecallbacks.c', 'virhostdev.c', ] diff --git a/src/qemu/meson.build b/src/qemu/meson.build index 2a85e2e604..43a8ad7c3b 100644 --- a/src/qemu/meson.build +++ b/src/qemu/meson.build @@ -22,7 +22,6 @@ qemu_driver_sources =3D [ 'qemu_hotplug.c', 'qemu_interface.c', 'qemu_interop_config.c', - 'qemu_logcontext.c', 'qemu_migration.c', 'qemu_migration_cookie.c', 'qemu_migration_params.c', diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1fc4e2f33f..411e80e94e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5399,7 +5399,7 @@ static void G_GNUC_PRINTF(5, 6) qemuDomainObjTaintMsg(virQEMUDriver *driver, virDomainObj *obj, virDomainTaintFlags taint, - qemuLogContext *logCtxt, + domainLogContext *logCtxt, const char *fmt, ...) { virErrorPtr orig_err =3D NULL; @@ -5452,12 +5452,12 @@ qemuDomainObjTaintMsg(virQEMUDriver *driver, goto cleanup; =20 if (logCtxt) { - rc =3D qemuLogContextWrite(logCtxt, - "%s: Domain id=3D%d is tainted: %s%s%s%s\= n", - timestamp, - obj->def->id, - virDomainTaintTypeToString(taint), - extraprefix, extramsg, extrasuffix); + rc =3D domainLogContextWrite(logCtxt, + "%s: Domain id=3D%d is tainted: %s%s%s%= s\n", + timestamp, + obj->def->id, + virDomainTaintTypeToString(taint), + extraprefix, extramsg, extrasuffix); } else { rc =3D qemuDomainLogAppendMessage(driver, obj, "%s: Domain id=3D%d is tainted: %s= %s%s%s\n", @@ -5478,7 +5478,7 @@ qemuDomainObjTaintMsg(virQEMUDriver *driver, void qemuDomainObjTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainTaintFlags taint, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { qemuDomainObjTaintMsg(driver, obj, taint, logCtxt, NULL); qemuDomainSaveStatus(obj); @@ -5487,7 +5487,7 @@ void qemuDomainObjTaint(virQEMUDriver *driver, static void qemuDomainObjCheckMachineTaint(virQEMUDriver *driver, virDomainObj *obj, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { qemuDomainObjPrivate *priv =3D obj->privateData; virQEMUCaps *qemuCaps =3D priv->qemuCaps; @@ -5505,7 +5505,7 @@ qemuDomainObjCheckMachineTaint(virQEMUDriver *driver, static void qemuDomainObjCheckCPUTaint(virQEMUDriver *driver, virDomainObj *obj, - qemuLogContext *logCtxt, + domainLogContext *logCtxt, bool incomingMigration) { qemuDomainObjPrivate *priv =3D obj->privateData; @@ -5537,7 +5537,7 @@ qemuDomainObjCheckCPUTaint(virQEMUDriver *driver, =20 void qemuDomainObjCheckTaint(virQEMUDriver *driver, virDomainObj *obj, - qemuLogContext *logCtxt, + domainLogContext *logCtxt, bool incomingMigration) { size_t i; @@ -5593,7 +5593,7 @@ void qemuDomainObjCheckTaint(virQEMUDriver *driver, void qemuDomainObjCheckDiskTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainDiskDef *disk, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { if (disk->rawio =3D=3D VIR_TRISTATE_BOOL_YES) qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES, @@ -5610,7 +5610,7 @@ void qemuDomainObjCheckDiskTaint(virQEMUDriver *drive= r, void qemuDomainObjCheckHostdevTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainHostdevDef *hostdev, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { if (!virHostdevIsSCSIDevice(hostdev)) return; @@ -5623,7 +5623,7 @@ void qemuDomainObjCheckHostdevTaint(virQEMUDriver *dr= iver, void qemuDomainObjCheckNetTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainNetDef *net, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { /* script is only useful for NET_TYPE_ETHERNET (qemu) and * NET_TYPE_BRIDGE (xen), but could be (incorrectly) specified for diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index e810f79599..dba2696a27 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -26,13 +26,13 @@ #include "virperf.h" #include "domain_addr.h" #include "domain_conf.h" +#include "domain_logcontext.h" #include "qemu_monitor.h" #include "qemu_agent.h" #include "qemu_blockjob.h" #include "qemu_domainjob.h" #include "qemu_conf.h" #include "qemu_capabilities.h" -#include "qemu_logcontext.h" #include "qemu_migration_params.h" #include "qemu_nbdkit.h" #include "qemu_slirp.h" @@ -641,24 +641,24 @@ char *qemuDomainDefFormatLive(virQEMUDriver *driver, void qemuDomainObjTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainTaintFlags taint, - qemuLogContext *logCtxt); + domainLogContext *logCtxt); =20 void qemuDomainObjCheckTaint(virQEMUDriver *driver, virDomainObj *obj, - qemuLogContext *logCtxt, + domainLogContext *logCtxt, bool incomingMigration); void qemuDomainObjCheckDiskTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainDiskDef *disk, - qemuLogContext *logCtxt); + domainLogContext *logCtxt); void qemuDomainObjCheckHostdevTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainHostdevDef *disk, - qemuLogContext *logCtxt); + domainLogContext *logCtxt); void qemuDomainObjCheckNetTaint(virQEMUDriver *driver, virDomainObj *obj, virDomainNetDef *net, - qemuLogContext *logCtxt); + domainLogContext *logCtxt); =20 int qemuDomainLogAppendMessage(virQEMUDriver *driver, virDomainObj *vm, diff --git a/src/qemu/qemu_logcontext.h b/src/qemu/qemu_logcontext.h deleted file mode 100644 index 738e908bc3..0000000000 --- a/src/qemu/qemu_logcontext.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * qemu_logcontext.h: QEMU log context - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - */ - -#pragma once - -#include -#include "qemu_conf.h" -#include "logging/log_manager.h" - -#define QEMU_TYPE_LOG_CONTEXT qemu_log_context_get_type() -G_DECLARE_FINAL_TYPE(qemuLogContext, qemu_log_context, QEMU, LOG_CONTEXT, = GObject); - -qemuLogContext *qemuLogContextNew(virQEMUDriver *driver, - virDomainObj *vm, - const char *basename); -int qemuLogContextWrite(qemuLogContext *ctxt, - const char *fmt, ...) G_GNUC_PRINTF(2, 3); -ssize_t qemuLogContextRead(qemuLogContext *ctxt, - char **msg); -int qemuLogContextReadFiltered(qemuLogContext *ctxt, - char **msg, - size_t max); -int qemuLogContextGetWriteFD(qemuLogContext *ctxt); -void qemuLogContextMarkPosition(qemuLogContext *ctxt); - -virLogManager *qemuLogContextGetManager(qemuLogContext *ctxt); diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index f099f35e1e..de7c62a037 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -1185,7 +1185,7 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, g_autofree char *uristring =3D NULL; g_autofree char *basename =3D g_strdup_printf("%s-nbdkit-%i", vm->def-= >name, proc->source->id); int logfd =3D -1; - g_autoptr(qemuLogContext) logContext =3D NULL; + g_autoptr(domainLogContext) logContext =3D NULL; #if WITH_NBDKIT struct nbd_handle *nbd =3D NULL; #endif @@ -1200,12 +1200,12 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, if (!(cmd =3D qemuNbdkitProcessBuildCommand(proc))) return -1; =20 - if (!(logContext =3D qemuLogContextNew(driver, vm, basename))) { + if (!(logContext =3D domainLogContextNew(driver, vm, basename))) { virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); return -1; } =20 - logfd =3D qemuLogContextGetWriteFD(logContext); + logfd =3D domainLogContextGetWriteFD(logContext); =20 VIR_DEBUG("starting nbdkit process for %s", qemuBlockStorageSourceGetS= torageNodename(proc->source)); virCommandSetErrorFD(cmd, &logfd); @@ -1283,7 +1283,7 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, if ((uri =3D qemuBlockStorageSourceGetURI(proc->source))) uristring =3D virURIFormat(uri); =20 - if (qemuLogContextReadFiltered(logContext, &errbuf, 1024) < 0) + if (domainLogContextReadFiltered(logContext, &errbuf, 1024) < 0) VIR_WARN("Unable to read from nbdkit log"); =20 virReportError(VIR_ERR_OPERATION_FAILED, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bee7a39e4e..d182206f20 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1840,7 +1840,7 @@ qemuProcessMonitorReportLogError(qemuMonitor *mon, static void qemuProcessMonitorLogFree(void *opaque) { - qemuLogContext *logCtxt =3D opaque; + domainLogContext *logCtxt =3D opaque; g_clear_object(&logCtxt); } =20 @@ -1866,7 +1866,7 @@ static int qemuConnectMonitor(virQEMUDriver *driver, virDomainObj *vm, int asyncJob, - qemuLogContext *logCtxt, + domainLogContext *logCtxt, bool reconnect) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -1918,13 +1918,13 @@ qemuConnectMonitor(virQEMUDriver *driver, =20 =20 static int -qemuProcessReportLogError(qemuLogContext *logCtxt, +qemuProcessReportLogError(domainLogContext *logCtxt, const char *msgprefix) { g_autofree char *logmsg =3D NULL; =20 /* assume that 1024 chars of qemu log is the right balance */ - if (qemuLogContextReadFiltered(logCtxt, &logmsg, 1024) < 0) + if (domainLogContextReadFiltered(logCtxt, &logmsg, 1024) < 0) return -1; =20 virResetLastError(); @@ -1943,7 +1943,7 @@ qemuProcessMonitorReportLogError(qemuMonitor *mon G_G= NUC_UNUSED, const char *msg, void *opaque) { - qemuLogContext *logCtxt =3D opaque; + domainLogContext *logCtxt =3D opaque; qemuProcessReportLogError(logCtxt, msg); } =20 @@ -2244,7 +2244,7 @@ static int qemuProcessWaitForMonitor(virQEMUDriver *driver, virDomainObj *vm, int asyncJob, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { int ret =3D -1; g_autoptr(GHashTable) info =3D NULL; @@ -4740,7 +4740,7 @@ static void qemuLogOperation(virDomainObj *vm, const char *msg, virCommand *cmd, - qemuLogContext *logCtxt) + domainLogContext *logCtxt) { g_autofree char *timestamp =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; @@ -4754,20 +4754,21 @@ qemuLogOperation(virDomainObj *vm, if ((timestamp =3D virTimeStringNow()) =3D=3D NULL) return; =20 - if (qemuLogContextWrite(logCtxt, - "%s: %s %s, qemu version: %d.%d.%d%s, kernel: = %s, hostname: %s\n", - timestamp, msg, VIR_LOG_VERSION_STRING, - (qemuVersion / 1000000) % 1000, - (qemuVersion / 1000) % 1000, - qemuVersion % 1000, - NULLSTR_EMPTY(package), - uts.release, - NULLSTR_EMPTY(hostname)) < 0) + if (domainLogContextWrite(logCtxt, + "%s: %s %s, qemu version: %d.%d.%d%s, kernel= : %s, + hostname: %s\n", + timestamp, msg, VIR_LOG_VERSION_STRING, + (qemuVersion / 1000000) % 1000, + (qemuVersion / 1000) % 1000, + qemuVersion % 1000, + NULLSTR_EMPTY(package), + uts.release, + NULLSTR_EMPTY(hostname)) < 0) return; =20 if (cmd) { g_autofree char *args =3D virCommandToString(cmd, true); - qemuLogContextWrite(logCtxt, "%s\n", args); + domainLogContextWrite(logCtxt, "%s\n", args); } } =20 @@ -7765,7 +7766,7 @@ qemuProcessLaunch(virConnectPtr conn, int ret =3D -1; int rv; int logfile =3D -1; - g_autoptr(qemuLogContext) logCtxt =3D NULL; + g_autoptr(domainLogContext) logCtxt =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virCommand) cmd =3D NULL; struct qemuProcessHookData hookData; @@ -7815,11 +7816,11 @@ qemuProcessLaunch(virConnectPtr conn, hookData.cfg =3D cfg; =20 VIR_DEBUG("Creating domain log file"); - if (!(logCtxt =3D qemuLogContextNew(driver, vm, vm->def->name))) { + if (!(logCtxt =3D domainLogContextNew(driver, vm, vm->def->name))) { virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); goto cleanup; } - logfile =3D qemuLogContextGetWriteFD(logCtxt); + logfile =3D domainLogContextGetWriteFD(logCtxt); =20 if (qemuProcessGenID(vm, flags) < 0) goto cleanup; @@ -7855,7 +7856,7 @@ qemuProcessLaunch(virConnectPtr conn, =20 qemuDomainObjCheckTaint(driver, vm, logCtxt, incoming !=3D NULL); =20 - qemuLogContextMarkPosition(logCtxt); + domainLogContextMarkPosition(logCtxt); =20 if (qemuProcessEnableDomainNamespaces(driver, vm) < 0) goto cleanup; --=20 2.47.0 From nobody Sun Dec 22 02:45:10 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 From nobody Sun Dec 22 02:45:10 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 1733507428519256.3277181070391; Fri, 6 Dec 2024 09:50:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 933461429; Fri, 6 Dec 2024 12:50:27 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 27E9C139A; Fri, 6 Dec 2024 12:48:06 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 94B1BC64; Fri, 6 Dec 2024 12:47:58 -0500 (EST) Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (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 51A72A74 for ; Fri, 6 Dec 2024 12:47:56 -0500 (EST) Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-27d0e994ae3so1305684fac.3 for ; Fri, 06 Dec 2024 09:47:56 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:54 -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=1733507275; x=1734112075; 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=VWfcDpcyesClfmcLFvkUwnqVLuI6/proSN2wjh7KIfU=; b=D8HzcuVla9LT0cJ5RX7yemdZDms6diizhsmsb+2AaXcAxJoFy6FLXB8ezVT8MkA3tC DKeEbw1YKU3rZUC1mefBWe1EEMGAl7E5X/VLBa6vbvQZbMehV4pDrcHkwf+bMhqYWfrg Ip5IwOWcIWLnh697/nEr3+FxoXKHDurIq6qpTeuHgLWipiaAy/2hN6QV1ROnzxu58Z5Z FKOzpAO8MBPWEfDaa48/e4zD+FQrpNPHzDklpMB6kaXusG5VO9+OnfaHKwAC9RlWB1RC yO9doChEpDV51Xkv1YhqYIWxSKrRGsKIURQoyHQcwByG/I1Brtj/Bf+fMDwW0VQnVN9r 2a5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507275; x=1734112075; 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=VWfcDpcyesClfmcLFvkUwnqVLuI6/proSN2wjh7KIfU=; b=W7KGRpI5Qsyxyue4G+2mbk1FcGxhPfOPWOkLuO5MwKsQd1SOgcFbVOEwdIroQWBrcf P+egvnOv807USUraD5cZwE2nk3YUhRE1KQ311RGEK7Tg6WGrYuRidygt0mR8ZCFGDaD5 XAKuqyLKuCy6Sc5S4f14ylSceYRwkkUfVzTT42TCEMo+Mvzn1CopUame/pcJ4gl66G41 caZiQbvwaLALoCcG18yS75Fg2KwSRLYc/ZE+dcUgwexZoaX8zMvaGFQ1d+MyvZ0epI25 TZU5p96PZodMrFEJHbjf0a1Q9KsF0ayjdM87lMBiyHZSKp6vIzri4rEvcNz1OzLWc8E2 9aAg== X-Gm-Message-State: AOJu0Yx7s7q+7HWeFBGeuVnrMKIEVC7zaHID5XOEHvDC9NuoQt1hhoAS Igwr7sz9FZi9WP1jeHlm1ULSqqggwheMI9BAl6Q7Q233jt8/azsfnPP0CBlr X-Gm-Gg: ASbGncsOFwgFEIUcQTvqnKhDK2t92vMIVAiL3ZP1/k2aHMNZVqaF3qlL+eJLa8WAL3P UKtG6MmYD5LIaGIQZIv9MFyV1ktcyKd3hJfpVf7ROlbDRGn1heizgJk1a4fedzhlAxvph7yh8bj B/CXneIh2Y7eEhetl8zFnRqvKCQAGajLsyC3zuzh6+0MeG5j50qjXvcrQwZFp8fUMoJqgVwPWDB IATR5zk2ZH9tV9lyeoDRADtEIe5Pt1pKw== X-Google-Smtp-Source: AGHT+IE29JMZumQa+Ufop5+nZCEWHTtKb6vCVy7pAtESAmL+CVlQfJy0iW8iRIrQ7Y3OMM3uw+n0qg== X-Received: by 2002:a05:6870:dc4b:b0:29e:63b3:8e2b with SMTP id 586e51a60fabf-29f735a1d74mr2031720fac.37.1733507275301; Fri, 06 Dec 2024 09:47:55 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 3/8] qemu: Fix domainLogContextNew invocations in qemu driver Date: Fri, 6 Dec 2024 11:47:44 -0600 Message-ID: <20241206174749.33455-4-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: GN5N4B5LU773HKHNYP7AZ6EVV6QUZ7WC X-Message-ID-Hash: GN5N4B5LU773HKHNYP7AZ6EVV6QUZ7WC 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: 1733507428933116600 Content-Type: text/plain; charset="utf-8" Fix the invocations of domainLogContextNew in qemu driver to use hypervisor agnostic arguments. Signed-off-by: Praveen K Paladugu --- src/qemu/qemu_nbdkit.c | 6 +++++- src/qemu/qemu_process.c | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index de7c62a037..65c98de017 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -1177,6 +1177,7 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, virQEMUDriver *driver) { g_autoptr(virCommand) cmd =3D NULL; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); int rc; int exitstatus =3D 0; g_autofree char *errbuf =3D NULL; @@ -1200,7 +1201,10 @@ qemuNbdkitProcessStart(qemuNbdkitProcess *proc, if (!(cmd =3D qemuNbdkitProcessBuildCommand(proc))) return -1; =20 - if (!(logContext =3D domainLogContextNew(driver, vm, basename))) { + if (!(logContext =3D domainLogContextNew(cfg->stdioLogD, cfg->logDir, + QEMU_DRIVER_NAME, + vm, driver->privileged, + basename))) { virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); return -1; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d182206f20..d02105cf44 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4755,8 +4755,7 @@ qemuLogOperation(virDomainObj *vm, return; =20 if (domainLogContextWrite(logCtxt, - "%s: %s %s, qemu version: %d.%d.%d%s, kernel= : %s, - hostname: %s\n", + "%s: %s %s, qemu version: %d.%d.%d%s, kernel= : %s, hostname: %s\n", timestamp, msg, VIR_LOG_VERSION_STRING, (qemuVersion / 1000000) % 1000, (qemuVersion / 1000) % 1000, @@ -7816,7 +7815,10 @@ qemuProcessLaunch(virConnectPtr conn, hookData.cfg =3D cfg; =20 VIR_DEBUG("Creating domain log file"); - if (!(logCtxt =3D domainLogContextNew(driver, vm, vm->def->name))) { + if (!(logCtxt =3D domainLogContextNew(cfg->stdioLogD, cfg->logDir, + QEMU_DRIVER_NAME, + vm, driver->privileged, + vm->def->name))) { virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); goto cleanup; } --=20 2.47.0 From nobody Sun Dec 22 02:45:10 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 1733507446827597.2408530044872; Fri, 6 Dec 2024 09:50:46 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id E0EA713E1; Fri, 6 Dec 2024 12:50:45 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C016714A7; Fri, 6 Dec 2024 12:48:09 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 5D86B141C; Fri, 6 Dec 2024 12:48:06 -0500 (EST) Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 8DB01141C for ; Fri, 6 Dec 2024 12:47:57 -0500 (EST) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-29e71d653fbso1247812fac.3 for ; Fri, 06 Dec 2024 09:47:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:55 -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_MSPIKE_H2, 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=1733507276; x=1734112076; 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=1TQfwtdhiqUlXIEzN+JD3zPSYEqcLBkxYFuVyC37kDA=; b=XTJbV9pL19TnkgX3Ocx/DblDeqcfoQKKZWqED9tTvE3c0CumpyyUYNJ92NO4+ufgSk xtUHb1FbQSmQ+6ADG0TOq1xCB8Cfa+TlELFHokpD6GH6ZdCYf9T+nZIn6ENdQPVJiDgW 6+yaIB7Zhto2JwzSim1YwyMARHt+y6HSHM4PXY9+PuMt5uuRFDn00iLTI1TMIfxkXZy0 32P+ZCrLg6zZAUnsfoWQ6yxMNHlBxs8lUwEjjfBKLW2ASSPbpGDgL6KfbQj8xAaDRfqV NVDaYxu7IOg4gDczQLK0eqnzjpey5YZLL/GtTqp19bMRiuPyOrEEAe+VzlqHFfX1r4L2 Zg7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507276; x=1734112076; 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=1TQfwtdhiqUlXIEzN+JD3zPSYEqcLBkxYFuVyC37kDA=; b=jUe7Id4Sxzxisy2G6b22W8xZiVazM5NU1j8fEQbHan7hUs0wiKGHzGcZhT4ZM36W1v FuM0pKnvGXPSwFaJW+L4U1tvp6TiY/kJJiUHzjLYAsLSLklqO/xzpFtuY5FSflU4z1NK 3f7+uRlKtxxpVJ4h4bsOqPdUzNuDopolunPEfCOAvlJzbDHltmX2UbjrDyRpaknGJoLx nc6KWii2SpaoDH+EEqXZaa2rZoas/OTEk48B5yTNumZ4L8/Il2N1wGqoPsd70zT7G9IT qVm41PTX28I+qq8dyT1eNB8gtoyAOhOEFzc0c7hP5CT+OFh3Io+zJg5FCNto2RK5mfmY C7+g== X-Gm-Message-State: AOJu0Yy3EBaciK8fDkU6rRVWVFbc4Lq8M/C7l0Nfp5NzQYOtsBsKu7gp WgwBM4vbnVjQLMQxJoTQ8O857w2MONoOXuSkzAUL5FZlSPbOlEbPODhVY9C8 X-Gm-Gg: ASbGncsFAUPxkbRM+oZBAnGK4udOY1adN8vNxdc/zSNaN0Lp/7iEBatFMxwx8gkwo/m WGkP6mPaHhRQ/SEOz3FuWVoETGDFds6YYA4nrncTNvml2p4eL4OuJBy9zUuxmwDJLpBATcSDq0o yRQpDXEBGwLjIxqOJtDJNrgUwxM5CSpL6CfECFRrCIhQF16RfX8LiCq7LAbUS/TpqaE3SQlgS2w ehycD2acQ7X0Z+vtc4CrRlWlASKG5Vrbg== X-Google-Smtp-Source: AGHT+IGO6g/sIAVKnBVJQtsGJWfVdUNtt5qU2N99uaZMs2VgldePP1sKEY3UmhKpns3LnWv22rRutA== X-Received: by 2002:a05:6870:b411:b0:288:e7f2:e9da with SMTP id 586e51a60fabf-29f732f9cd7mr4081021fac.20.1733507276625; Fri, 06 Dec 2024 09:47:56 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 4/8] libvirt_private: export symbols from domain_logcontext Date: Fri, 6 Dec 2024 11:47:45 -0600 Message-ID: <20241206174749.33455-5-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: DKFMIV4RU2CVBCHFXMK4B2QPIB6KDWTT X-Message-ID-Hash: DKFMIV4RU2CVBCHFXMK4B2QPIB6KDWTT 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: 1733507446978116600 Content-Type: text/plain; charset="utf-8" Export required symbols from domain_logcontext.c for builds to pass. Signed-off-by: Praveen K Paladugu --- src/libvirt_private.syms | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c931003fad..ad90f46c18 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1665,6 +1665,12 @@ virDomainInterfaceStopDevice; virDomainInterfaceStopDevices; virDomainInterfaceVportRemove; =20 +# hypervisor/domain_logcontext.h +domainLogContextGetWriteFD; +domainLogContextMarkPosition; +domainLogContextNew; +domainLogContextReadFiltered; +domainLogContextWrite; =20 # hypervisor/virclosecallbacks.h virCloseCallbacksDomainAdd; --=20 2.47.0 From nobody Sun Dec 22 02:45:10 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 1733507468020116.98149793613084; Fri, 6 Dec 2024 09:51:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2282B13A8; Fri, 6 Dec 2024 12:51:07 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id ADF2614AD; Fri, 6 Dec 2024 12:48:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4BC96144C; Fri, 6 Dec 2024 12:48:10 -0500 (EST) Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 E31DE145D for ; Fri, 6 Dec 2024 12:47:58 -0500 (EST) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-29737adb604so1377526fac.1 for ; Fri, 06 Dec 2024 09:47:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:57 -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_MSPIKE_H2, 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=1733507278; x=1734112078; 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=X/jRs+ITLF6Cpatadx0rVSI1774Uf3GSc87OtPw/4eI=; b=fYEkepiicHviJOo2x9uCp6d6/1w5AWZOrvhncAzmRiNDLhoIqbGv2I/XcTRF6ou0Tz D9AerdL16leM3O/DSADd1nLj94lrjEDD1Ol7MvvnQkM4jBXmkwfl5IKkCjTR65JtaGDo EcBSkvdIfcU5SVmyHMgVRK3djeg5KUCnFhONk0TyjXwbccVQYh2SwesKnW9EtuwahxiN yMFT4KwVg96frpB4YIHK7gbVJzCYwwSeo/lT3evgLuLW3rbDnyjm/Zl1xo60YaJNoGFL 005mCvyvCqa5R1SsVfNlANybjJJXOGnH0xMi3gaZNj1a2Ns4Rxfq/VBwVOgFiL9bPmpl ONvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507278; x=1734112078; 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=X/jRs+ITLF6Cpatadx0rVSI1774Uf3GSc87OtPw/4eI=; b=RKzQEf60f98AN34s/apAkL1HRiXtA5mzzAHf+RI1ci+9lm5Oonqbj+SyhSkZkD1Ct/ 0RLBqoilUggiELTTfg0LRdu9PRTWN3p7+PKpiMI2VlZGFqR0wl6Kgsz2SHrEWqIEE5SW CsM41l5t9HnlWn0IBH/lDx525nNw42/tAMkFx3pZM3WtQGgVQvnKtThIms7VctYoEg8r TjQyuiuRJ//Nu6C3nejYt2x2x4UhvHrsBr95CGoeXl69/VIFpUlreNU/QJoKU7unSkLZ vKX9M8jqZBgb4MPpgRftfLzIU70imsr7FGAf99UB2/XY7bYKeGL+GLCl9hr01uIX0fbO hrDw== X-Gm-Message-State: AOJu0YwSIEpdUqlgB0unFRcpmtRJOtx7DPXpOJoI9UDPqTcJqV8EO6Xg xTrQYCrZ9w1EmK60V4Vqd3hTKvsSSMLn30JQnLwGFRHlEURZUxDo2jUTJoV9 X-Gm-Gg: ASbGncuMO13mfX36iG2gKfkL9sb90kpGbltnnXZUJubQpMfRptBlxe1cNSfE2TnPgEx 5q8GznCdbPa6/ARfidNZtYginFL3U/VgprlgaRNzVVXTxeJe0FeZA2yF/gTT0LBo/H3/Vj9ymhN dXmd6DzlVubmRkr98i8GHHjbRxwQkHGTiLPBiF+KxkqJSvuhdwHCdNSOD7k5kcVcoSHJqV6zyx3 bUc1SSY8btUZfBRHKtURDhVMAW5MLEBlA== X-Google-Smtp-Source: AGHT+IENTl1Z/AtDauyw2fTE+v18vg9Um2UQdWCYa7pWbeXcWCc/b6BQjT8xKELaq/kFMYukuY9Wmg== X-Received: by 2002:a05:6870:c03:b0:29e:4ba5:4ddc with SMTP id 586e51a60fabf-29f73346d6dmr4306351fac.24.1733507277919; Fri, 06 Dec 2024 09:47:57 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 5/8] po: Update POTFILES Date: Fri, 6 Dec 2024 11:47:46 -0600 Message-ID: <20241206174749.33455-6-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: VOY4PMJAR4U6G36UHEP5YLKSXUQO6IET X-Message-ID-Hash: VOY4PMJAR4U6G36UHEP5YLKSXUQO6IET 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: 1733507469078116600 Content-Type: text/plain; charset="utf-8" Drop qemu_logcontext.c and add domain_logcontext.c to POTFILES. Signed-off-by: Praveen K Paladugu --- po/POTFILES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/POTFILES b/po/POTFILES index 3514aa3dca..041a494fb3 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -95,6 +95,7 @@ src/hyperv/hyperv_wmi.c src/hypervisor/domain_cgroup.c src/hypervisor/domain_driver.c src/hypervisor/domain_interface.c +src/hypervisor/domain_logcontext.c src/hypervisor/virhostdev.c src/interface/interface_backend_netcf.c src/interface/interface_backend_udev.c @@ -180,7 +181,6 @@ src/qemu/qemu_hostdev.c src/qemu/qemu_hotplug.c src/qemu/qemu_interface.c src/qemu/qemu_interop_config.c -src/qemu/qemu_logcontext.c src/qemu/qemu_migration.c src/qemu/qemu_migration_cookie.c src/qemu/qemu_migration_params.c --=20 2.47.0 From nobody Sun Dec 22 02:45:10 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 1733507494390863.1619139247596; Fri, 6 Dec 2024 09:51:34 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 68D0D14A9; Fri, 6 Dec 2024 12:51:33 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 98B6F14B4; Fri, 6 Dec 2024 12:48:17 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 17A651474; Fri, 6 Dec 2024 12:48:11 -0500 (EST) Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (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 140D1C64 for ; Fri, 6 Dec 2024 12:48:00 -0500 (EST) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-29e2a50586dso1522283fac.0 for ; Fri, 06 Dec 2024 09:48:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:58 -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=1733507279; x=1734112079; 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=Q5fgYIVbZi9WYYQNQ2uIJb3lDEE7CZnZhIdQym+FSuM=; b=aboMGWOhDN80UPytwJ0+qgHCG0JVkqwuZ1dSfASTiP6OAd8MNyWwodIChUjHMpFnYg iKQ2wm6nOqBgo5xNo5vzN9QH/DuNNSjWkZYhhppnbbCTWWO2RzHtJ4BLup6H3pvpRrzG B9MUPaRWq6lBjao43vgB9FyaGEOhw14tP9BuvNt9Qw1uaQJJPywE3aZJ+C7At9fC9pav AXIQSXPO1qnAoT/G8LwKJw7ouZO35xE0DLX9Exq/uMMSHXMaYo43VU+5bxcOMvcoAP0M xxHXNKNVXBHYX/tQIKhtMzBJjyLyZPtnv0aiOGJQ6M0BeyVbeuWfxtHIWUH5fN+MKJJz Nhww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507279; x=1734112079; 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=Q5fgYIVbZi9WYYQNQ2uIJb3lDEE7CZnZhIdQym+FSuM=; b=VQLOMG3DpgjijEJDKROEIN5aP6sXAB/2g9/Wo3waesaVfLTbB4tEdGMNja7tVNPwYu RcFmKxCPFq9U3lzxTZTXOQNFEpB7q8BiAJody/17Z14S1MHKlqIJqeUaWPPgBCWv9mwH lZX+jYQ/CxyTct9NlUVMfC/wnOXwAeueCC9qdRnSHVbKkVHrG9UyntnzronD0OtL4JEN NtV9p8WSXHMna4VhKA2MCjr/pvvtJJON06NZI2DFvkyLAYOB3amCpBHaj0K3pU+rLNzi V6Xyrm0hRmElyGDUFnYFKU/H/DfuB3Cxk1Ah5sajKkLKm7ykcrkAB+sXi3U05nK08UK6 Y34Q== X-Gm-Message-State: AOJu0Yz2+kQwXZJOViZ6+qABKcu+AoW44/hXVISBrqEPTM+WbGSc6ck1 Lg39s/M88zGRDZXpwztldn8T6WO7byGCEK8cOLOSJUGcre96CQd0YQsEzM57 X-Gm-Gg: ASbGncuefEzTOXM1mRN8IW3N29v0El2+009NwtDIGxETNz2/zQQN2Q1XxHUU1up3/8L kNYiM6qebH05zQkx4D5I8aorXSm47zUW6hqq39UQGdHaCosXf98nGhXcURGZgpk8iAWuCBnFHal tz1RBhxfQpQUg20TaSjh51t/neIOkjZo3KchnwncJPlNhfmTfFYvVrgcUM+tva/9cfskRC35nX/ ZyzEkfoe6ChVufl8CjFsx2SsEl1FRahIg== X-Google-Smtp-Source: AGHT+IFRYABdtGDekXG+iTxM9ZGJMWVUhJhdehuiHfXZ79kYFys8hjLovtCEt9pQiX2UouAF5hyIBA== X-Received: by 2002:a05:6870:e9b:b0:297:28e3:db63 with SMTP id 586e51a60fabf-29f732f0a61mr4537367fac.19.1733507278928; Fri, 06 Dec 2024 09:47:58 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 6/8] ch: Enable logging for ch domains Date: Fri, 6 Dec 2024 11:47:47 -0600 Message-ID: <20241206174749.33455-7-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: 5PIYGXSGMINBFDFLL6SQXP7XVO4L4ZMK X-Message-ID-Hash: 5PIYGXSGMINBFDFLL6SQXP7XVO4L4ZMK 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: 1733507495373116600 Content-Type: text/plain; charset="utf-8" Use domainLogContext to enable logging for ch domain process during create and restore steps. Signed-off-by: Praveen K Paladugu --- src/ch/ch_conf.h | 2 ++ src/ch/ch_monitor.c | 5 ++++- src/ch/ch_monitor.h | 3 ++- src/ch/ch_process.c | 34 ++++++++++++++++++++++++++++++---- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/ch/ch_conf.h b/src/ch/ch_conf.h index bac82a0170..b08573476e 100644 --- a/src/ch/ch_conf.h +++ b/src/ch/ch_conf.h @@ -45,6 +45,8 @@ struct _virCHDriverConfig { =20 uid_t user; gid_t group; + + bool stdioLogD; }; =20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCHDriverConfig, virObjectUnref); diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 690aea37c8..c9b08b0f75 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -536,7 +536,7 @@ chMonitorCreateSocket(const char *socket_path) } =20 virCHMonitor * -virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cfg) +virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cfg, int logfile) { g_autoptr(virCHMonitor) mon =3D NULL; g_autoptr(virCommand) cmd =3D NULL; @@ -572,6 +572,9 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g) } =20 cmd =3D virCommandNew(vm->def->emulator); + virCommandSetOutputFD(cmd, &logfile); + virCommandSetErrorFD(cmd, &logfile); + virCommandNonblockingFDs(cmd); virCommandSetUmask(cmd, 0x002); socket_fd =3D chMonitorCreateSocket(mon->socketpath); if (socket_fd < 0) { diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index 9ec58e5b20..5c02447116 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -103,7 +103,8 @@ struct _virCHMonitor { virCHMonitorThreadInfo *threads; }; =20 -virCHMonitor *virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cfg); +virCHMonitor *virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cfg, + int logfile); void virCHMonitorClose(virCHMonitor *mon); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCHMonitor, virCHMonitorClose); =20 diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 61e263b62b..af44aa81a2 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -29,6 +29,7 @@ #include "ch_process.h" #include "domain_cgroup.h" #include "domain_interface.h" +#include "domain_logcontext.h" #include "viralloc.h" #include "virerror.h" #include "virfile.h" @@ -49,12 +50,13 @@ VIR_LOG_INIT("ch.ch_process"); =20 static virCHMonitor * virCHProcessConnectMonitor(virCHDriver *driver, - virDomainObj *vm) + virDomainObj *vm, + int logfile) { virCHMonitor *monitor =3D NULL; virCHDriverConfig *cfg =3D virCHDriverGetConfig(driver); =20 - monitor =3D virCHMonitorNew(vm, cfg); + monitor =3D virCHMonitorNew(vm, cfg, logfile); =20 virObjectUnref(cfg); return monitor; @@ -890,6 +892,8 @@ virCHProcessStart(virCHDriver *driver, g_autoptr(virCHDriverConfig) cfg =3D virCHDriverGetConfig(priv->driver= ); g_autofree int *nicindexes =3D NULL; size_t nnicindexes =3D 0; + g_autoptr(domainLogContext) logCtxt =3D NULL; + int logfile =3D -1; =20 if (virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -901,6 +905,16 @@ virCHProcessStart(virCHDriver *driver, return -1; } =20 + VIR_DEBUG("Creating domain log file for %s domain", vm->def->name); + if (!(logCtxt =3D domainLogContextNew(cfg->stdioLogD, cfg->logDir, + CH_DRIVER_NAME, + vm, driver->privileged, + vm->def->name))) { + virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); + return -1; + } + logfile =3D domainLogContextGetWriteFD(logCtxt); + if (virCHProcessPrepareDomain(vm) < 0) { return -1; } @@ -910,7 +924,7 @@ virCHProcessStart(virCHDriver *driver, =20 if (!priv->monitor) { /* And we can get the first monitor connection now too */ - if (!(priv->monitor =3D virCHProcessConnectMonitor(driver, vm))) { + if (!(priv->monitor =3D virCHProcessConnectMonitor(driver, vm, log= file))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to create connection to CH socket")); goto cleanup; @@ -1047,10 +1061,22 @@ virCHProcessStartRestore(virCHDriver *driver, virDo= mainObj *vm, const char *from size_t ntapfds =3D 0; size_t nnicindexes =3D 0; int ret =3D -1; + g_autoptr(domainLogContext) logCtxt =3D NULL; + int logfile =3D -1; + + VIR_DEBUG("Creating domain log file for %s domain", vm->def->name); + if (!(logCtxt =3D domainLogContextNew(cfg->stdioLogD, cfg->logDir, + CH_DRIVER_NAME, + vm, driver->privileged, + vm->def->name))) { + virLastErrorPrefixMessage("%s", _("can't connect to virtlogd")); + return -1; + } + logfile =3D domainLogContextGetWriteFD(logCtxt); =20 if (!priv->monitor) { /* Get the first monitor connection if not already */ - if (!(priv->monitor =3D virCHProcessConnectMonitor(driver, vm))) { + if (!(priv->monitor =3D virCHProcessConnectMonitor(driver, vm, log= file))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to create connection to CH socket")); goto cleanup; --=20 2.47.0 From nobody Sun Dec 22 02:45:10 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 1733507522246461.9153125886768; Fri, 6 Dec 2024 09:52:02 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4D61714B3; Fri, 6 Dec 2024 12:52:01 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1CCE41486; Fri, 6 Dec 2024 12:48:23 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 5BB6113DB; Fri, 6 Dec 2024 12:48:17 -0500 (EST) Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (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 42C621396 for ; Fri, 6 Dec 2024 12:48:01 -0500 (EST) Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-29e842cb9b4so796241fac.2 for ; Fri, 06 Dec 2024 09:48:01 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:47:59 -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=1733507280; x=1734112080; 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=bojBlHnVxj6Z+nPV/q7fA57/Mzt/aIQbkAmLIJx1Oy4=; b=LMI5rgV31RZUmk8RMlFvnQ64aQsJZKc4QLsk/4i5DlEixCWiCPxkmIw/PjX5+Kk8j6 j0df4vA2wHAwCOwCKFYIyD8cwDWUlIbi4sGVYh0qUBooOAG6N8RLAcb+0sQex0Qeh1zJ 9Ne7IRXW39eoNx1MWN8ypPNqRFV4c9M15aR7EvOzhjWRtJccFcUaIGKCpcZIhA8OcKCl AnpcKy1jYV7cXsnJd7qAA7S7AXjb5vTfz/Wqma4W4Yl2QPJaL8pz9SdOTuglAZfSmkBr Fapb2GwLrj6HSulzrgRQHNf8pY473P6ey+Ut7GHvyeFKoZCL/zcB3z4fNP4YR5sfk/rJ l9AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507280; x=1734112080; 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=bojBlHnVxj6Z+nPV/q7fA57/Mzt/aIQbkAmLIJx1Oy4=; b=qfYH9lol6j0I1C440LkFjMN7WL+fvyd3FulesDxfntdaNqGjIjHJKGfBKC7YLsPvQw PgVLDXPQWft/XTaWt5X/n2YmXodNOnGRA4hCn/q0wviFWOxfLi1Q4q8wM3JIOwheOXJB L+Y3JhKwiXl2xpgcJmLQMXqItUHqMFVKYfMjL6g57Fp1GPUsqqZ8PAJrrj7JCMlwL+62 f55XCS7hb3xjAXnIjQwGHE4kamkkKz5KuC+C4qxsuy7HNNtE1gyAkTgvYCujNv1R7NF7 L5gBR7und4ZAdMKSQiJ5PS86yF3MO+nQuG1S74/IBNuwVp5J7j/0wujB8DV7lSeNMC85 87FA== X-Gm-Message-State: AOJu0Yyw54k/MOaUylrFP8UhwFXP7iY3+XJu+vYkZYPtUI4NJIjacJUy EIHys4sIXFrNcjBd9AW+e4NZbpabRo2PXd11lf6poCJ2tg8yPxHr9r1kOQH3 X-Gm-Gg: ASbGncuQbXYeXFj3MjRlGqVB1eSBdB9YBw6I0RdXDXTeyDRdLqQK28zd75NKwZkE9mS Fvlgzkx5dl/vS5tGR11kvZsl7R+Bqz0IFeB0hJG/hUkuGIFeTDZGjPXLGA7bhSyDMSmUDTG4j9j l6RRheaBN6gD/aSZOzsd/MNUUh+WXLEMor0kJIhEIELXgwQ4x2XTTNE9d4d3PPFcMe14c0oJ25e mOmoGMSrcgziclikk5z+Kcx5zCU3ereyw== X-Google-Smtp-Source: AGHT+IHNFp0bvTwgT1ccLO/y+VlvJVn2hcWsH/EkAmFAGU5gu0seR3SK8qIRtknLC1AW1+vK65mSFA== X-Received: by 2002:a05:6871:7a1:b0:29d:c624:7cad with SMTP id 586e51a60fabf-29f732413d2mr2137226fac.3.1733507280190; Fri, 06 Dec 2024 09:48:00 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 7/8] ch: move curl_data and curl_callback definitions Date: Fri, 6 Dec 2024 11:47:48 -0600 Message-ID: <20241206174749.33455-8-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: TBJLBRAEIMSB5FEFRLDSTHEQ7EXJEBLZ X-Message-ID-Hash: TBJLBRAEIMSB5FEFRLDSTHEQ7EXJEBLZ 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: 1733507523356116600 Content-Type: text/plain; charset="utf-8" Move the definitions of curl_data and curl_callback to be used virCHMonitorPutNoContent. Signed-off-by: Praveen K Paladugu --- src/ch/ch_monitor.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index c9b08b0f75..88df9d4a03 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -671,6 +671,28 @@ virCHMonitorCurlPerform(CURL *handle) return responseCode; } =20 +struct curl_data { + char *content; + size_t size; +}; + +static size_t +curl_callback(void *contents, size_t size, size_t nmemb, void *userp) +{ + size_t content_size =3D size * nmemb; + struct curl_data *data =3D userp; + + if (content_size =3D=3D 0) + return content_size; + + data->content =3D g_realloc(data->content, data->size + content_size); + + memcpy(&(data->content[data->size]), contents, content_size); + data->size +=3D content_size; + + return content_size; +} + int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint) { @@ -698,28 +720,6 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char= *endpoint) return ret; } =20 -struct curl_data { - char *content; - size_t size; -}; - -static size_t -curl_callback(void *contents, size_t size, size_t nmemb, void *userp) -{ - size_t content_size =3D size * nmemb; - struct curl_data *data =3D userp; - - if (content_size =3D=3D 0) - return content_size; - - data->content =3D g_realloc(data->content, data->size + content_size); - - memcpy(&(data->content[data->size]), contents, content_size); - data->size +=3D content_size; - - return content_size; -} - static int virCHMonitorGet(virCHMonitor *mon, const char *endpoint, virJSONValue **re= sponse) { --=20 2.47.0 From nobody Sun Dec 22 02:45:10 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 1733507548576382.90267622201645; Fri, 6 Dec 2024 09:52:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id A8E55139A; Fri, 6 Dec 2024 12:52:27 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 04F96146F; Fri, 6 Dec 2024 12:48:25 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B38F4140E; Fri, 6 Dec 2024 12:48:18 -0500 (EST) Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) (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 33D40147A for ; Fri, 6 Dec 2024 12:48:02 -0500 (EST) Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-294ec8e1d8aso2216828fac.1 for ; Fri, 06 Dec 2024 09:48:02 -0800 (PST) Received: from home.. ([2603:8081:c640:1::100a]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29f566ea976sm932125fac.15.2024.12.06.09.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 09:48: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.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=1733507281; x=1734112081; 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=0GJOq4kM4UcnXAhLXl68hU71Afy29qcZO5F/JWYQvYw=; b=NkNZN/FRUMX1/t9g5dEzlxQk/ysyxjhO30F5SLNSJ+uLTFLnsVnPuHyVYgStmwlzLI fKzXjiWkzT093+O6f8rhILEv8d7mCA/IAI903DRPj7Mxb65x9GaMcZM0jPf3vbWzvLq4 mIO1ziBpYVOoRdN9211JDM3N956x39r5gQigYC3qL8Tum5gBIIurSwaUolFkRZPZXqOl KfEpHhRhYlF/0NSQwKdv6ZM1t99+FOWCKd9BSa8/HXoVBhAEhVqHlD9KdEoNzOw26Oni CYcNk/g/bEJL8iu0VFBd97Se5bQKFT9Hi2AoLfI/pnbJy8oLZldXsfOkf6dLGvfZRccy wb6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733507281; x=1734112081; 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=0GJOq4kM4UcnXAhLXl68hU71Afy29qcZO5F/JWYQvYw=; b=fLdTv/bWCBFXKSoKGbobRifFVbnwl+C6Wk/v7cH8JQWrcJVGuHEYX5bzykAitCnBYY oex5v0fVCMRUjtmZAv3XPXAvkRpAQDYpI5hr0lEgPl56LRuHgRXPow0cyuiq3ztilbQg zI1TfJs6R7ebexUVfbjWwwwadTwNxNvnBkkrhWXXWUivFZOERoOANnHnr26HFeuFOXEQ sTsuwdaW8IlhA33R5wGGGZke5Jl/CMxEGyF3m1DhJJhqp5rIz7eSj8YYJNXdvKPjGMsA tcPcTGRL7tBLEROZBk8K59a5/TGPw8JDBzMzKVtFbQkpTCHgXZnGzFN9dV1Nug2XYPuV tZMw== X-Gm-Message-State: AOJu0YzSNvA3nmzbeXw0c+JllfGoGI3M3Xvdcp3whpPL4liwaiUjkNIU rgXDaaj1qVwHHROyYNpy0BeRmQDhZGNGtOKvh6bk0bYC0r847s5k8ePG5MmD X-Gm-Gg: ASbGncuDQwcSLgq4k0FadiE3gQ/yJvpLC155StYK0i3YXPtS8/bEOjTi8oHJeTKIQTO 51Zk3UDWaGVoFobmiBuVem83irxcCN4pggRyjaWuSVJu958NchzJ9xeQYi6ee0DvCPTZYyoWqjG /kwSWx9xvAHHHkWXlH6UMdQskd5aBkaJ6WXkGYE1XSYrCEW9Hmv21+SSRvLeQKn4fBi8WK7lEN0 S3pE6Ba8k0oc8nbbbnEE4K6T3TnMleQIQ== X-Google-Smtp-Source: AGHT+IGkRBXx6MVFr64aDNkDnKfuCijg5E3+rP33xFIZo95IjnV3GM2ArKT6R9MLuvEI9sSshUS3tQ== X-Received: by 2002:a05:6871:4182:b0:28c:8476:dd76 with SMTP id 586e51a60fabf-29f73540f3amr2566820fac.29.1733507281263; Fri, 06 Dec 2024 09:48:01 -0800 (PST) From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH 8/8] ch: Enable logging curl responses from ch Date: Fri, 6 Dec 2024 11:47:49 -0600 Message-ID: <20241206174749.33455-9-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: FME4ZLSGXK6DVQJZP5PG7NQQ3E224CWR X-Message-ID-Hash: FME4ZLSGXK6DVQJZP5PG7NQQ3E224CWR 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: 1733507549534116600 Content-Type: text/plain; charset="utf-8" Log curl responses from cloud-hypervisor process during Boot request, using domain's logContext. Signed-off-by: Praveen K Paladugu --- src/ch/ch_monitor.c | 35 ++++++++++++++++++++++++++--------- src/ch/ch_monitor.h | 3 ++- src/ch/ch_process.c | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 88df9d4a03..d3f969e01a 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -56,7 +56,8 @@ static int virCHMonitorOnceInit(void) VIR_ONCE_GLOBAL_INIT(virCHMonitor); =20 int virCHMonitorShutdownVMM(virCHMonitor *mon); -int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint); +int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint, + domainLogContext *logCtxt); =20 static int virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef) @@ -694,12 +695,15 @@ curl_callback(void *contents, size_t size, size_t nme= mb, void *userp) } =20 int -virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint) +virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint, + domainLogContext *logCtxt) { VIR_LOCK_GUARD lock =3D virObjectLockGuard(mon); g_autofree char *url =3D NULL; int responseCode =3D 0; int ret =3D -1; + struct curl_data data =3D {0}; + struct curl_slist *headers =3D NULL; =20 url =3D g_strdup_printf("%s/%s", URL_ROOT, endpoint); =20 @@ -712,8 +716,21 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char= *endpoint) curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL); curl_easy_setopt(mon->handle, CURLOPT_INFILESIZE, 0L); =20 + headers =3D curl_slist_append(headers, "Accept: application/json"); + curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(mon->handle, CURLOPT_WRITEFUNCTION, curl_callback); + curl_easy_setopt(mon->handle, CURLOPT_WRITEDATA, (void *)&data); + responseCode =3D virCHMonitorCurlPerform(mon->handle); =20 + if (logCtxt && data.size) { + /* Do this to append a NULL char at the end of data */ + data.content =3D g_realloc(data.content, data.size + 1); + data.content[data.size] =3D 0; + domainLogContextWrite(logCtxt, "HTTP response code from CH: %d\n",= responseCode); + domainLogContextWrite(logCtxt, "Response =3D %s\n", data.content); + } + if (responseCode =3D=3D 200 || responseCode =3D=3D 204) ret =3D 0; =20 @@ -863,7 +880,7 @@ virCHMonitorGetThreadInfo(virCHMonitor *mon, int virCHMonitorShutdownVMM(virCHMonitor *mon) { - return virCHMonitorPutNoContent(mon, URL_VMM_SHUTDOWN); + return virCHMonitorPutNoContent(mon, URL_VMM_SHUTDOWN, NULL); } =20 int @@ -903,33 +920,33 @@ virCHMonitorCreateVM(virCHDriver *driver, virCHMonito= r *mon) } =20 int -virCHMonitorBootVM(virCHMonitor *mon) +virCHMonitorBootVM(virCHMonitor *mon, domainLogContext *logCtxt) { - return virCHMonitorPutNoContent(mon, URL_VM_BOOT); + return virCHMonitorPutNoContent(mon, URL_VM_BOOT, logCtxt); } =20 int virCHMonitorShutdownVM(virCHMonitor *mon) { - return virCHMonitorPutNoContent(mon, URL_VM_SHUTDOWN); + return virCHMonitorPutNoContent(mon, URL_VM_SHUTDOWN, NULL); } =20 int virCHMonitorRebootVM(virCHMonitor *mon) { - return virCHMonitorPutNoContent(mon, URL_VM_REBOOT); + return virCHMonitorPutNoContent(mon, URL_VM_REBOOT, NULL); } =20 int virCHMonitorSuspendVM(virCHMonitor *mon) { - return virCHMonitorPutNoContent(mon, URL_VM_Suspend); + return virCHMonitorPutNoContent(mon, URL_VM_Suspend, NULL); } =20 int virCHMonitorResumeVM(virCHMonitor *mon) { - return virCHMonitorPutNoContent(mon, URL_VM_RESUME); + return virCHMonitorPutNoContent(mon, URL_VM_RESUME, NULL); } =20 int diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h index 5c02447116..ca23301723 100644 --- a/src/ch/ch_monitor.h +++ b/src/ch/ch_monitor.h @@ -25,6 +25,7 @@ #include "virobject.h" #include "virjson.h" #include "domain_conf.h" +#include "domain_logcontext.h" #include "ch_conf.h" =20 #define URL_ROOT "http://localhost/api/v1" @@ -110,7 +111,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCHMonitor, virCHMonito= rClose); =20 =20 int virCHMonitorCreateVM(virCHDriver *driver, virCHMonitor *mon); -int virCHMonitorBootVM(virCHMonitor *mon); +int virCHMonitorBootVM(virCHMonitor *mon, domainLogContext *logCtxt); int virCHMonitorShutdownVM(virCHMonitor *mon); int virCHMonitorRebootVM(virCHMonitor *mon); int virCHMonitorSuspendVM(virCHMonitor *mon); diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index af44aa81a2..9a85f7869e 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -964,7 +964,7 @@ virCHProcessStart(virCHDriver *driver, if (virDomainInterfaceStartDevices(vm->def) < 0) return -1; =20 - if (virCHMonitorBootVM(priv->monitor) < 0) { + if (virCHMonitorBootVM(priv->monitor, logCtxt) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to boot guest VM")); goto cleanup; --=20 2.47.0