From nobody Mon Dec 15 09:42:59 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=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1741800260340546.1804734249586; Wed, 12 Mar 2025 10:24:20 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5197B1F4A; Wed, 12 Mar 2025 13:24:19 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E48751ED7; Wed, 12 Mar 2025 13:19:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1B1C11C78; Wed, 12 Mar 2025 13:19:08 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 2C3591E2B for ; Wed, 12 Mar 2025 13:18:47 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-398-dt3FYsr8Pdq2pnpqFW5eoQ-1; Wed, 12 Mar 2025 13:18:41 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 479C41955E8D for ; Wed, 12 Mar 2025 17:18:40 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.57]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2853718001D4; Wed, 12 Mar 2025 17:18:38 +0000 (UTC) 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_INVALID,DKIM_SIGNED, 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=redhat.com; s=mimecast20190719; t=1741799926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WsV0nGTvrUABdXZAxEqftr4IzpYCI5yHmeydEAUjA5Q=; b=ESxz/YCNRbUSf38uo8cQnKzf9bPa8JoDMrxE5uZQ1z4f2iOPqZPh4alc1dU8Bp+G61zEM1 yTiGnIHciXqGyn/NkoibD6bkv00SKcRhPIQbJRoPTvTfugNA0SaixVvSkf+35IK2s7VZJm mbRavG2c6XslT8AWS6CCu/uk/x2NI54= X-MC-Unique: dt3FYsr8Pdq2pnpqFW5eoQ-1 X-Mimecast-MFC-AGG-ID: dt3FYsr8Pdq2pnpqFW5eoQ_1741799920 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: devel@lists.libvirt.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 22/22] hypervisor: emit systemd status & log messages while saving Date: Wed, 12 Mar 2025 17:18:02 +0000 Message-ID: <20250312171802.1854985-23-berrange@redhat.com> In-Reply-To: <20250312171802.1854985-1-berrange@redhat.com> References: <20250312171802.1854985-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Wk3DHTzyWJ1KvN7enMDrP7ROM46cWIS1gGBd_wRH_nM_1741799920 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GYFIA2FRT6IDWVWQO6ACL6WKABPHXUH5 X-Message-ID-Hash: GYFIA2FRT6IDWVWQO6ACL6WKABPHXUH5 X-MailFrom: berrange@redhat.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 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: 1741800261820019100 Content-Type: text/plain; charset="utf-8" Since processing running VMs on OS shutdown can take a while, it is beneficial to send systemd status messages about the progress. The systemd status is a point-in-time message, with no ability to look at the history of received messages. So in the systemd status we include the progress information. For the same reason there is no benefit in sending failure messages, as they'll disappear as soon as a status is sent for the subsequent VM to be processed. The libvirt log statements can be viewed as a complete log record so don't need progress info, but do include warnings about failures (present from earlier commits). Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/hypervisor/domain_driver.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 1105d36388..c7ffd21f05 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -30,6 +30,7 @@ #include "datatypes.h" #include "driver.h" #include "virlog.h" +#include "virsystemd.h" =20 #define VIR_FROM_THIS VIR_FROM_DOMAIN =20 @@ -814,6 +815,10 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdow= nConfig *cfg) (!transient[i] && cfg->trySave =3D=3D VIR_DOMAIN_DRIVER_AU= TO_SHUTDOWN_SCOPE_TRANSIENT)) continue; =20 + virSystemdNotifyStatus("Suspending '%s' (%zu of %d)", + virDomainGetName(domains[i]), i + 1, nu= mDomains); + VIR_INFO("Suspending '%s'", virDomainGetName(domains[i])); + /* * Pause all VMs to make them stop dirtying pages, * so save is quicker. We remember if any VMs were @@ -832,6 +837,10 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdow= nConfig *cfg) } =20 for (i =3D 0; i < numDomains; i++) { + virSystemdNotifyStatus("Saving '%s' (%zu of %d)", + virDomainGetName(domains[i]), i + 1, nu= mDomains); + VIR_INFO("Saving '%s'", virDomainGetName(domains[i])); + if (virDomainManagedSave(domains[i], flags[i]) < 0) { VIR_WARN("Unable to perform managed save of '%s': %s", virDomainGetName(domains[i]), @@ -855,6 +864,10 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdow= nConfig *cfg) (!transient[i] && cfg->tryShutdown =3D=3D VIR_DOMAIN_DRIVE= R_AUTO_SHUTDOWN_SCOPE_TRANSIENT)) continue; =20 + virSystemdNotifyStatus("Shutting down '%s' (%zu of %d)", + virDomainGetName(domains[i]), i + 1, nu= mDomains); + VIR_INFO("Shutting down '%s'", virDomainGetName(domains[i])); + if (virDomainShutdown(domains[i]) < 0) { VIR_WARN("Unable to request graceful shutdown of '%s': %s", virDomainGetName(domains[i]), @@ -864,6 +877,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *cfg) } =20 timer =3D g_timer_new(); + virSystemdNotifyStatus("Waiting %d secs for VM shutdown completion= ", + cfg->waitShutdownSecs); + VIR_INFO("Waiting %d secs for VM shutdown completion", cfg->waitSh= utdownSecs); while (1) { bool anyRunning =3D false; for (i =3D 0; i < numDomains; i++) { @@ -900,6 +916,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *cfg) (!transient[i] && cfg->poweroff =3D=3D VIR_DOMAIN_DRIVER_A= UTO_SHUTDOWN_SCOPE_TRANSIENT)) continue; =20 + virSystemdNotifyStatus("Destroying '%s' (%zu of %d)", + virDomainGetName(domains[i]), i + 1, nu= mDomains); + VIR_INFO("Destroying '%s'", virDomainGetName(domains[i])); /* * NB might fail if we gave up on waiting for * virDomainShutdown, but it then completed anyway, @@ -912,6 +931,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *cfg) } } =20 + virSystemdNotifyStatus("Processed %d domains", numDomains); + VIR_INFO("Processed %d domains", numDomains); + cleanup: if (domains) { /* Anything non-NULL in this list indicates none of --=20 2.48.1