From nobody Fri Jan 3 08:12:45 2025 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 1728667881049160.3054122139165; Fri, 11 Oct 2024 10:31:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F029D1711; Fri, 11 Oct 2024 13:31:19 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B553C14A0; Fri, 11 Oct 2024 13:30:58 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EA93C1393; Fri, 11 Oct 2024 13:30:54 -0400 (EDT) Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 AFFF51442 for ; Fri, 11 Oct 2024 13:30:53 -0400 (EDT) Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-717d4b88ac9so1210196a34.2 for ; Fri, 11 Oct 2024 10:30:53 -0700 (PDT) Received: from home.. ([2603:8081:c640:1::1003]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5eb117170efsm489821eaf.22.2024.10.11.10.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 10:30:51 -0700 (PDT) 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=1728667852; x=1729272652; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=12K9K4PI1wMbglUz6HSeFBydvyq8EOKTsDt8Gp4u2ZY=; b=MXgmVQ9NGWz5D+futYV7azqqq6OBeJ43UtM/xCv5NvEieo6TUbXL6n62So719qsW0R xv4pDS2Uxqlxyr0H3ZYM3nyeGcu+wcdzLjbFIvQiV2hTy4RIarMp0h9rV9TZBxXRdy+P y6eNqw0MX57xNR/SfVxM+Ot+u+rNCOeOhv94ldIZ/E2bqP6qW2ItLzJpMPxWNkiZShe4 oxE12fNQksZCLFhe2S5UF8MD/TH061I91WngdO+an97y39VWc4aprFkXn3sYzP+1FHSx o0u5cPcOZbc65ux+7E4ldPSiL5OGtPZUHUBtuThwoovbQRcZMtFPzIuSCwrcuHGBKdOE p6vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728667852; x=1729272652; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=12K9K4PI1wMbglUz6HSeFBydvyq8EOKTsDt8Gp4u2ZY=; b=f2xWb2DJYtG5cvkFCij5QrW65SwYwlNzGeYP1yL7H19Za2DntRmv8oC8we0/945Lkn z4aNqxHzzCECLRLZkhjNfc3cw2Sq2slXRLuEXE0QqL1iHTVq3kQ6BSCIiz0qidvhRg/k fvWAsXbP2nskg69bDeqm7lnDUImF8T1FwSfH4cfTzB5J9zaycy5V9HhcUvZpg5iE6vPg S2HeAvDcOAdc6dM0R8rHaFmpdJkyzVgAhMKPz1EMS8EN61GDw80LFC1f0iYP7mhfUmT6 TWSBoUNWdgFXAWeN5LQfP+k3Du1br8H9m9/yHXkOl3+B/EdGUyh5JB+zh17jtrRvC3e9 E85g== X-Gm-Message-State: AOJu0YxJGp/IzdRknuLAtcA5Zv5QIUWVzsgE3NG7UIMULKe8iWWMSRq2 Q9xyJT6WjqSod8Dka6LjYEB6MYnX7WnRnCbT57dwWbVTV0q3yCdmnafmTA== X-Google-Smtp-Source: AGHT+IEKYMrh09jcV/U+5bHyLMXmXtiUZRW5fLFQf6RyLAQfWQkoAZrKc2/4gEIDuPX/DNtxwEGJAw== X-Received: by 2002:a05:6830:380a:b0:710:f797:984b with SMTP id 46e09a7af769-717d64c3a8emr2823452a34.32.1728667852310; Fri, 11 Oct 2024 10:30:52 -0700 (PDT) From: Praveen K Paladugu X-Google-Original-From: Praveen K Paladugu To: devel@lists.libvirt.org Subject: [PATCH] ch: Enable a logfile for ch guests Date: Fri, 11 Oct 2024 12:30:49 -0500 Message-ID: <20241011173049.6503-1-prapal@linux.microsoft.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MB5XO23OIV4TGCPKTMQJQYUWS3UE7ESO X-Message-ID-Hash: MB5XO23OIV4TGCPKTMQJQYUWS3UE7ESO 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: 1728667881945116600 Content-Type: text/plain; charset="utf-8" Create a logfile to capture output from cloud-hypervisor whenever a guest is started. Signed-off-by: Praveen K Paladugu --- src/ch/ch_monitor.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 3e49902791..7421a550b6 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -541,6 +541,9 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g) g_autoptr(virCHMonitor) mon =3D NULL; g_autoptr(virCommand) cmd =3D NULL; const char *socketdir =3D cfg->stateDir; + const char *logdir =3D cfg->logDir; + g_autofree char *logfile =3D NULL; + int socket_fd =3D 0; =20 if (virCHMonitorInitialize() < 0) @@ -564,6 +567,14 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *c= fg) return NULL; } =20 + logfile =3D g_strdup_printf("%s/%s.log", logdir, vm->def->name); + if (g_mkdir_with_parents(logdir, 0777) < 0) { + virReportSystemError(errno, + _("Cannot create log directory '%1$s'"), + logdir); + return NULL; + } + if (g_mkdir_with_parents(cfg->saveDir, 0777) < 0) { virReportSystemError(errno, _("Cannot create save directory '%1$s'"), @@ -583,6 +594,9 @@ virCHMonitorNew(virDomainObj *vm, virCHDriverConfig *cf= g) =20 virCommandAddArg(cmd, "--api-socket"); virCommandAddArgFormat(cmd, "fd=3D%d", socket_fd); + virCommandAddArg(cmd, "-v"); + virCommandAddArg(cmd, "--log-file"); + virCommandAddArgFormat(cmd, "%s", logfile); virCommandPassFD(cmd, socket_fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); =20 /* launch Cloud-Hypervisor socket */ --=20 2.44.0