From nobody Sun Sep 20 18:54:29 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=1784736056; cv=none; d=zohomail.com; s=zohoarc; b=H7OLabHj4TogIn6TGeqRzpz52Qy04IgC073bCwK3bjnNe5jMSQg3RB1f0DXes1f4N4i9ZWV3IkBoYDoIEc4HUlquLKTPrLjRAZlk8JQkyeH1iR6o+nS8IujdV6a4+zCggVaKw5NfZBup3MmAGL3p5UrQOFvwOrHb0PjLdfBOXrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784736056; 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=A4cQGn76JkvBWvcZmCsBukqYyTkyfyJaIAWYyQHS5UQ=; b=Ju9TsvOR1bo7GTfZXbjm0G1bQKdTD0qXGvnHECYxKFTrx/xzUygkH12QiK7XFPY4QreibaYSBH9313kP+ZnfIZRp3V209kbc+O9ckOxlC2iBFoJybzHkFozyJiwOwFeG4s1e651cOVSyL2l0YAW7s1ccP4i2hIgHNNUyqjEI/7M= 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 17847360567721005.6271148099727; Wed, 22 Jul 2026 09:00:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 83E5D41B0B; Wed, 22 Jul 2026 12:00:55 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 0F32843FBB; Wed, 22 Jul 2026 11:41:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6777541BCC; Wed, 22 Jul 2026 11:40:56 -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 CD23A41DDD for ; Wed, 22 Jul 2026 11:38:38 -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-380-ug0Du7VePAO1MndBrlLrEQ-1; Wed, 22 Jul 2026 11:38:37 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 33A431800772 for ; Wed, 22 Jul 2026 15:38:36 +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 85A3E42F for ; Wed, 22 Jul 2026 15:38:35 +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=-2.7 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,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784734718; 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=A4cQGn76JkvBWvcZmCsBukqYyTkyfyJaIAWYyQHS5UQ=; b=BqVhJhXsy2bFY/lDUwa9Dd55xLpIU9DQYoQJLRD3jQacr0hmdV61igA1MxS21+nwKtGF5q aFMHNvrnQCTy2h8MqEKV7DC72Qd0jOBsWH+H3libcllcIwZorGh/VEFGyXO3whAN+1RCCv ZqKtnOZcZLbZ7HzSzqEFlsvMsZb0rnU= X-MC-Unique: ug0Du7VePAO1MndBrlLrEQ-1 X-Mimecast-MFC-AGG-ID: ug0Du7VePAO1MndBrlLrEQ_1784734716 To: devel@lists.libvirt.org Subject: [PATCH 13/13] Add support for keeping VM running when panic notifier is used Date: Wed, 22 Jul 2026 17:38:18 +0200 Message-ID: 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: YOVm3JmY1-kntsw-KB3VshThRDn-WmcR-mpaxQSVfkM_1784734716 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BGFBB2I737QZYBCUPTATBR2FDCCSGT4D X-Message-ID-Hash: BGFBB2I737QZYBCUPTATBR2FDCCSGT4D 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: 1784736058290158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Some guest OSes (e.g. windows) can do an internal crash dump and reboot after a crash. They unfortunately notify the OS before doing the crash dump though so we need a new possibility for the action to keep the VM as is. This patch introduces 'preserve-running' mode for on_crash and wires it up into the qemu driver. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 3 ++ include/libvirt/libvirt-domain.h | 1 + src/conf/domain_conf.c | 2 ++ src/conf/schemas/domaincommon.rng | 2 ++ src/libxl/libxl_conf.c | 1 + src/libxl/libxl_domain.c | 3 ++ src/qemu/qemu_driver.c | 34 ++++++++++++++++++- src/qemu/qemu_process.c | 18 ++++++++++ .../async-teardown.x86_64-latest.xml | 2 +- tests/qemuxmlconfdata/async-teardown.xml | 2 +- tests/qemuxmlconftest.c | 1 + tools/virsh-domain.c | 3 +- 12 files changed, 68 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index a861f9f177..fa5b62200b 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2044,6 +2044,9 @@ The ``on_crash`` event supports these additional acti= ons :since:`since 0.8.4`. ``coredump-restart`` The crashed domain's core will be dumped, and then the domain will be restarted with the same configuration +``preserve-running`` + The crashed domain will continue to run. This is useful if the guest OS= can + do an internal crash dump and reboot itself. :since:`Since 12.6.0` :since:`Since 3.9.0`, the lifecycle events can be configured via the `virDomainSetLifecycleAction `__ diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 5b67f8f897..f4dfe9fb1a 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -8228,6 +8228,7 @@ typedef enum { VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE =3D 3, /* (Since: 3.9.0) */ VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY =3D 4, /* (Since: 3.9.0) = */ VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART =3D 5, /* (Since: 3.9.0) = */ + VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE_RUNNING =3D 6, /* (Since: 12.6.0)= */ # ifdef VIR_ENUM_SENTINELS VIR_DOMAIN_LIFECYCLE_ACTION_LAST /* (Since: 3.9.0) */ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ab5138acbc..45235d74bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -303,6 +303,7 @@ VIR_ENUM_IMPL(virDomainLifecycleAction, "preserve", "coredump-destroy", "coredump-restart", + "preserve-running", ); VIR_ENUM_IMPL(virDomainLockFailure, @@ -5534,6 +5535,7 @@ virDomainDefLifecycleActionAllowed(virDomainLifecycle= type, return true; case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE_RUNNING: break; } break; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 121e4e06a6..81ffbfc2fa 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -5035,6 +5035,7 @@ destroy: The domain is cleaned up restart: A new domain is started in place of the old one preserve: The domain will remain in memory until it is destroyed man= ually + preserve-running: Keep the domain as is, let the guest handle the cr= ash. rename-restart: a variant of the previous one but where the old doma= in is renamed before being saved to allow a restart coredump-destroy: The crashed domain's core will be dumped, and then= the @@ -5051,6 +5052,7 @@ rename-restart coredump-destroy coredump-restart + preserve-running