From nobody Mon Dec 15 09:41:39 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 1741800472572144.3409776165331; Wed, 12 Mar 2025 10:27:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EBA981E6E; Wed, 12 Mar 2025 13:27:51 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 78A4D1F64; Wed, 12 Mar 2025 13:26:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8982E1F0B; Wed, 12 Mar 2025 13:26:22 -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 EDDD31B45 for ; Wed, 12 Mar 2025 13:25:40 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-396-KOYpcbUEO1KvMir5zIYRUA-1; Wed, 12 Mar 2025 13:25:39 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D206F190A28C for ; Wed, 12 Mar 2025 17:18:13 +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 C903918001DE; Wed, 12 Mar 2025 17:18:12 +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=1741800340; 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=YcXwwckCMyA/RTNh9fCC31QZBIOMxAiH9NOoskixP0o=; b=gwNt0aPSxjU1E+0knSNnIYFSxrKEpRaFuG+0mnAabyzlWiel8oL6XvrU+PSubOivb023yD E/UeP4pBvtE5d1W2A/kd3HZPC2IAE1DzYgvoK0327eauvLgcxd3FrPMpd0g6HundhqDcwr ZTa6jBSa5EE+9YPUrovZ8uw0dMX6W4U= X-MC-Unique: KOYpcbUEO1KvMir5zIYRUA-1 X-Mimecast-MFC-AGG-ID: KOYpcbUEO1KvMir5zIYRUA_1741800338 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 06/22] qemu: improve shutdown defaults for session daemon Date: Wed, 12 Mar 2025 17:17:46 +0000 Message-ID: <20250312171802.1854985-7-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: y0-a8RUX8vBs-2DYfnXIqQaUPpV35mkocSDtwyJtT5Q_1741800338 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZMBE2KU7VLU2P34F7GQLAJ25BP66ZW3W X-Message-ID-Hash: ZMBE2KU7VLU2P34F7GQLAJ25BP66ZW3W 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: 1741800474208019000 Content-Type: text/plain; charset="utf-8" Currently the session daemon will try a managed save on all VMs, leaving them running if that fails. This limits the managed save just to persistent VMs, as there will usually not be any way to restore transient VMs later. It also enables graceful shutdown and then forced poweroff, should save fail for some reason. These new defaults can be overridden in the config file if needed. Reviewed-by: Peter Krempa Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu.conf.in | 10 ++++++---- src/qemu/qemu_conf.c | 4 ++-- src/qemu/test_libvirtd_qemu.aug.in | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in index a674e11388..c9bebf1e7d 100644 --- a/src/qemu/qemu.conf.in +++ b/src/qemu/qemu.conf.in @@ -664,22 +664,24 @@ # managed save. If managed save is enabled, shutdown will # be tried only on failure to perform managed save. # -# Defaults to "none" +# Defaults to "all" for session daemons and "none" for +# system daemons # # If 'libvirt-guests.service' is enabled, then this must be # set to 'none' for system daemons to avoid dueling actions -#auto_shutdown_try_shutdown =3D "none" +#auto_shutdown_try_shutdown =3D "all" =20 # As above, but with a forced poweroff instead of managed # save. If managed save or graceful shutdown are enabled, # forced poweroff will be tried only on failure of the # other options. # -# Defaults to "none" +# Defaults to "all" for session daemons and "none" for +# system daemons. # # If 'libvirt-guests.service' is enabled, then this must be # set to 'none' for system daemons to avoid dueling actions -#auto_shutdown_poweroff =3D "none" +#auto_shutdown_poweroff =3D "all" =20 # If provided by the host and a hugetlbfs mount point is configured, # a guest may request huge page backing. When this mount point is diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 8554558201..f069ed00b1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -315,8 +315,8 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privil= eged, cfg->autoShutdownPoweroff =3D VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOP= E_NONE; } else { cfg->autoShutdownTrySave =3D VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOPE= _PERSISTENT; - cfg->autoShutdownTryShutdown =3D VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_S= COPE_NONE; - cfg->autoShutdownPoweroff =3D VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOP= E_NONE; + cfg->autoShutdownTryShutdown =3D VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_S= COPE_ALL; + cfg->autoShutdownPoweroff =3D VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_SCOP= E_ALL; } =20 return g_steal_pointer(&cfg); diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index bb216483a7..3bc8104d7a 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -77,8 +77,8 @@ module Test_libvirtd_qemu =3D { "auto_start_bypass_cache" =3D "0" } { "auto_start_delay" =3D "0" } { "auto_shutdown_try_save" =3D "persistent" } -{ "auto_shutdown_try_shutdown" =3D "none" } -{ "auto_shutdown_poweroff" =3D "none" } +{ "auto_shutdown_try_shutdown" =3D "all" } +{ "auto_shutdown_poweroff" =3D "all" } { "hugetlbfs_mount" =3D "/dev/hugepages" } { "bridge_helper" =3D "qemu-bridge-helper" } { "set_process_name" =3D "1" } --=20 2.48.1