From nobody Mon Sep 21 14:51:22 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=1784735870; cv=none; d=zohomail.com; s=zohoarc; b=kfq/bZJ7X4u2PCfr6exraEwSoOWWCTMHkC6g3cP8uamo24qN9sWBUUizxlu2VUbovFJxenlVvHkdyQKXxsnrcCkJgmX50mKz19mgacyrLuorXrTrodXik8dBPBjjIlWN5dzlf477qInZL2ymuWGT1sP6bNr37mJFz7ApA2PuUlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784735870; 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=sWs61hISavozhRr9JbpW2eB6K/Iy2C/o+tcb3XJBFwQ=; b=ZQ9fIUyWnmXwOI5kD9ewdjp0J28qSOV1O17A36iAFGfzSjAdgqGa9QphS/IF2hySetKFaiOy8CurTNdIm6wzVtCanOIKU8ypZvWHJR6yYCeihx9nmWTc6+wF4QXupNO6CTvgeXfICgoAWEcnr9GL78BIpebsVtu96/7U+YQKzQQ= 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 1784735870104734.9408709510022; Wed, 22 Jul 2026 08:57:50 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DEDED41BD8; Wed, 22 Jul 2026 11:57:48 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 25A8C43EB8; Wed, 22 Jul 2026 11:40:26 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 931FC41BBE; Wed, 22 Jul 2026 11:40:16 -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 7C7A841DC0 for ; Wed, 22 Jul 2026 11:38:37 -0400 (EDT) Received: from mx-prod-mc-03.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-280-eBPAfQ0FNM-oU8H2VszBrg-1; Wed, 22 Jul 2026 11:38:35 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 203581945CB7 for ; Wed, 22 Jul 2026 15:38:35 +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 7031FD70 for ; Wed, 22 Jul 2026 15:38:34 +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=1784734717; 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=sWs61hISavozhRr9JbpW2eB6K/Iy2C/o+tcb3XJBFwQ=; b=L8w5hcjRwpj2fq4uSGOeWQK617W/I13cG+fDc7Nd85JLC0Wl3pPEW8Dpi4C+Y2Pd4qKMqW q6ghy5wWYcYZlsLx2qfwsiZC6p69EFtS1yTxRnVClKdl8BDPVKFpak4ztb9zEDXrezggjh G5n89tfabM68MximW4OZE57ROdNqcxE= X-MC-Unique: eBPAfQ0FNM-oU8H2VszBrg-1 X-Mimecast-MFC-AGG-ID: eBPAfQ0FNM-oU8H2VszBrg_1784734715 To: devel@lists.libvirt.org Subject: [PATCH 12/13] qemu: processGuestPanicEvent: Split individual steps under separate conditions Date: Wed, 22 Jul 2026 17:38:17 +0200 Message-ID: <9c2cb0f81dc2f5e71eaa2151e2771003de40912a.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: d-kt_F7b2cD5R11vMbqQ2r1KoVmQp68TvgQiBiW2aDE_1784734715 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MUYN6FGFWVAK4TBFUFSRIUHJLXJT6HUN X-Message-ID-Hash: MUYN6FGFWVAK4TBFUFSRIUHJLXJT6HUN 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: 1784735870612158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Separate the individual steps (setting of VM state, dumping, unlocking, final state transition) under individual switch statements for future extension. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 62 +++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 909d51c8cb..b83225cf38 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3627,26 +3627,64 @@ processGuestPanicEvent(virQEMUDriver *driver, qemuDomainLogAppendMessage(driver, vm, "%s: panic %s\n", times= tamp, msg); } - virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PANICK= ED); - event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_CRASHED, VIR_DOMAIN_EVENT_CRASHED_PAN= ICKED); - virObjectEventStateQueue(driver->domainEventState, event); - qemuDomainSaveStatus(vm); + /* Update VM state */ + switch (vm->def->onCrash) { + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: + virDomainObjSetState(vm, VIR_DOMAIN_CRASHED, VIR_DOMAIN_CRASHED_PA= NICKED); + qemuDomainSaveStatus(vm); + break; - if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockStat= e) < 0) - VIR_WARN("Unable to release lease on %s", vm->def->name); - VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: + break; + } + /* Handle state of leases/locks */ switch (vm->def->onCrash) { case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: + if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lock= State) < 0) + VIR_WARN("Unable to release lease on %s", vm->def->name); + VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState)); + break; + + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: + break; + } + + /* create core dump */ + switch (vm->def->onCrash) { + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: if (doCoreDumpToAutoDumpPath(driver, vm, flags) < 0) goto endjob; - G_GNUC_FALLTHROUGH; + + break; + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: + break; + } + + /* final state update */ + switch (vm->def->onCrash) { + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: qemuProcessStop(vm, VIR_DOMAIN_SHUTOFF_CRASHED, VIR_ASYNC_JOB_DUMP= , 0); event =3D virDomainEventLifecycleNewFromObj(vm, @@ -3659,22 +3697,14 @@ processGuestPanicEvent(virQEMUDriver *driver, break; case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: - if (doCoreDumpToAutoDumpPath(driver, vm, flags) < 0) - goto endjob; - G_GNUC_FALLTHROUGH; - case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: qemuDomainSetFakeReboot(vm, true); ignore_value(qemuProcessShutdownOrReboot(vm)); break; case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: - /* the VM is kept around for debugging */ - break; - case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: - default: break; } --=20 2.55.0