From nobody Tue Jan 21 07:46:12 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 1736366150384864.9787005219476; Wed, 8 Jan 2025 11:55:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6AFE9139E; Wed, 8 Jan 2025 14:55:49 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E0475145F; Wed, 8 Jan 2025 14:44:29 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A3401380; Wed, 8 Jan 2025 14:44:03 -0500 (EST) 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 6FDA71488 for ; Wed, 8 Jan 2025 14:43:36 -0500 (EST) Received: from mx-prod-mc-05.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-44-9beh5W4OND6cO9VFB2EI5g-1; Wed, 08 Jan 2025 14:43:34 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C531719560A2 for ; Wed, 8 Jan 2025 19:43:33 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.103]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D57FC3000199; Wed, 8 Jan 2025 19:43:32 +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.5 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=1736365416; 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=Hb/b6zQ1MRKhieNTTNc4AZJTyIlH1DmSyL8FmuqWYRM=; b=fkf5IShijyun7U0FfoAoelzhSeicG5ZDlCxMmPHMhmvRJltdpgr7o3CVMKc5XOpiPrjuez wGA+YT+S6upz5PhF8nozTVFgyS0zPX60xTnCva8jr8FFuYEr+jAa+lh/aSFKuGbUTYxcL0 0LSVYFe+yB7oRjajwskfjgNxH8Osoe0= X-MC-Unique: 9beh5W4OND6cO9VFB2EI5g-1 X-Mimecast-MFC-AGG-ID: 9beh5W4OND6cO9VFB2EI5g 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 26/26] hypervisor: send systemd status messages while saving Date: Wed, 8 Jan 2025 19:42:59 +0000 Message-ID: <20250108194259.1171990-27-berrange@redhat.com> In-Reply-To: <20250108194259.1171990-1-berrange@redhat.com> References: <20250108194259.1171990-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RJnbk4Ru3cbcQYAsYDiODZpkQRcwVUqautTCyMAK16g_1736365413 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PTDUG56ZIPJY4JZQDX2FZESC7ZY57IF2 X-Message-ID-Hash: PTDUG56ZIPJY4JZQDX2FZESC7ZY57IF2 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: 1736366152660116600 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. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/hypervisor/domain_driver.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 2f89b8c841..421cc16574 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 @@ -791,6 +792,8 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *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); /* * Pause all VMs to make them stop dirtying pages, * so save is quicker. We remember if any VMs were @@ -808,6 +811,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *cfg) } =20 for (i =3D 0; i < numDomains; i++) { + virSystemdNotifyStatus("Saving '%s' (%zu of %d)", + virDomainGetName(domains[i]), i + 1, nu= mDomains); + if (virDomainManagedSave(domains[i], flags[i]) < 0) { VIR_WARN("Unable to perform managed save of '%s': %s", virDomainGetName(domains[i]), @@ -829,6 +835,9 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *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); + if (virDomainShutdown(domains[i]) < 0) { VIR_WARN("Unable to perform graceful shutdown of '%s': %s", virDomainGetName(domains[i]), @@ -838,6 +847,8 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdown= Config *cfg) } =20 timer =3D g_timer_new(); + virSystemdNotifyStatus("Waiting %d secs for VM shutdown completion= ", + cfg->waitShutdownSecs); while (1) { bool anyRunning =3D false; for (i =3D 0; i < numDomains; i++) { @@ -874,10 +885,14 @@ virDomainDriverAutoShutdown(virDomainDriverAutoShutdo= wnConfig *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); virDomainDestroy(domains[i]); } } =20 + virSystemdNotifyStatus("Processed %d domains", numDomains); + cleanup: if (domains) { for (i =3D 0; i < numDomains; i++) { --=20 2.47.1