From nobody Mon Sep 21 20:54:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; 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 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1784735393; cv=none; d=zohomail.com; s=zohoarc; b=dWac4LgIYQL5RVz5VqTo/L4YTQGOY6MPQ4/bQigiz1Aj5Z0G3+KZgib/7n4f1XLDWV4SeD/9VrxuNVMaykeK7NiBONBYvb+87T5UmR/lLqlqfZ9O3iOlrBF4o8VK5vRqR6rDx+owpZBna14aDsYA6BvmBdAP2rOEGEUuva0z8xg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784735393; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=sZhF+n28ALgfLRKHOQijyZtzsxV55i8QYkUGTrva2TY=; b=CLkGkywp6AgVrQoyiqeQ2DEQMAueqP8vwQ9UyKG0r8WxMtFe0n5CPGtSy0kokfy6MUIER7/xt3LbFEphBGvOoqg1q4CIEHymXSkvrCgf5Sw6+8LJBQex4UJkj8Ya8TobAOduDttD2zZBwh4a6knigUTMwK7SwqzyVlk4SuDP9rU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1784735393721258.8936630393922; Wed, 22 Jul 2026 08:49:53 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 922DE3F976; Wed, 22 Jul 2026 11:49:52 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 5C6CA41E1E; Wed, 22 Jul 2026 11:39:14 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C4AF441C5C; Wed, 22 Jul 2026 11:38:54 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4813741C30 for ; Wed, 22 Jul 2026 11:38:32 -0400 (EDT) Received: from mx-prod-mc-01.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-478-vUD484_UMcOW1Z0LdfK6Wg-1; Wed, 22 Jul 2026 11:38:30 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9D155195FDF3 for ; Wed, 22 Jul 2026 15:38:29 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.24.17]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DEA1C1586 for ; Wed, 22 Jul 2026 15:38:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784734712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sZhF+n28ALgfLRKHOQijyZtzsxV55i8QYkUGTrva2TY=; b=hZpf4ygvvC6XZbZKAXiB1Y5014FbxQIhyPw0BNl8Ya1b2v2qbVriPQmxqqsrA5D5bhHaKc vA2tijc+eVf3W10kgwcUfNiydzvAgfE3NlpaiB2oAo2axfst/bt0BxDWZovnf3fYb9cXGE DQTdIYQm6imxR+Nfnf2+8Oa/zfW7iL0= X-MC-Unique: vUD484_UMcOW1Z0LdfK6Wg-1 X-Mimecast-MFC-AGG-ID: vUD484_UMcOW1Z0LdfK6Wg_1784734709 To: devel@lists.libvirt.org Subject: [PATCH 07/13] qemuDomainModifyLifecycleActionLive: Prepare to handle other actions Date: Wed, 22 Jul 2026 17:38:12 +0200 Message-ID: <8d848d44eccd03de456d80c0ba1758735e4e2bbf.1784734635.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: raXMw875xM8SGtlmQTpDd_hg9AxCCgfZpLTX-aHd_Wg_1784734709 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ECBBXMQU6MTC6Q72SQEQYISCU5KIIKS2 X-Message-ID-Hash: ECBBXMQU6MTC6Q72SQEQYISCU5KIIKS2 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1784735394746158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Rework the code so that it'll be possible to easily extend it to set other lifecycle actions in qemu. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 71308770f6..c64e5bb4f5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19544,42 +19544,51 @@ qemuDomainModifyLifecycleActionLive(virDomainObj = *vm, virDomainLifecycle type, virDomainLifecycleAction action) { - qemuMonitorActionReboot monReboot =3D QEMU_MONITOR_ACTION_REBOOT_KEEP; + qemuMonitorActionShutdown shutdown =3D QEMU_MONITOR_ACTION_SHUTDOWN_KE= EP; + qemuMonitorActionReboot reboot =3D QEMU_MONITOR_ACTION_REBOOT_KEEP; + qemuMonitorActionWatchdog watchdog =3D QEMU_MONITOR_ACTION_WATCHDOG_KE= EP; + qemuMonitorActionPanic panic =3D QEMU_MONITOR_ACTION_PANIC_KEEP; qemuDomainObjPrivate *priv =3D vm->privateData; int rc; - /* For now we only update 'reboot' action here as we want to keep the - * shutdown action as is (we're emulating the outcome anyways)) */ - if (type !=3D VIR_DOMAIN_LIFECYCLE_REBOOT || - vm->def->onReboot =3D=3D action) - return 0; + switch (type) { + case VIR_DOMAIN_LIFECYCLE_REBOOT: + if (vm->def->onReboot =3D=3D action) + break; + switch (action) { + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: + reboot =3D QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN; + break; - switch (action) { - case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: - monReboot =3D QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN; - break; + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + reboot =3D QEMU_MONITOR_ACTION_REBOOT_RESET; + break; - case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: - monReboot =3D QEMU_MONITOR_ACTION_REBOOT_RESET; + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: + break; + } break; - case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: - case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: - case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: - case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: - case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: - return 0; + case VIR_DOMAIN_LIFECYCLE_POWEROFF: + case VIR_DOMAIN_LIFECYCLE_CRASH: + case VIR_DOMAIN_LIFECYCLE_LAST: + break; } + if (shutdown =3D=3D QEMU_MONITOR_ACTION_SHUTDOWN_KEEP && + reboot =3D=3D QEMU_MONITOR_ACTION_REBOOT_KEEP && + watchdog =3D=3D QEMU_MONITOR_ACTION_WATCHDOG_KEEP && + panic =3D=3D QEMU_MONITOR_ACTION_PANIC_KEEP) + return 0; qemuDomainObjEnterMonitor(vm); - rc =3D qemuMonitorSetAction(priv->mon, - QEMU_MONITOR_ACTION_SHUTDOWN_KEEP, - monReboot, - QEMU_MONITOR_ACTION_WATCHDOG_KEEP, - QEMU_MONITOR_ACTION_PANIC_KEEP); + rc =3D qemuMonitorSetAction(priv->mon, shutdown, reboot, watchdog, pan= ic); qemuDomainObjExitMonitor(vm); if (rc < 0) --=20 2.55.0