From: Kaiyang Wu <wukaiyang2003@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Kaiyang Wu <wukaiyang@loongfans.cn>
Subject: [PATCH qemu-server v3 1/3] qemuserver: add pvpanic device
Date: Fri, 9 Oct 2026 14:58:11 +0800 [thread overview]
Message-ID: <20261009065813.109006-2-wukaiyang@loongfans.cn> (raw)
In-Reply-To: <20261009065813.109006-1-wukaiyang@loongfans.cn>
Add pvpanic PCI device to monitor guest system panics. Allow to specify
the action to perform when the guest system panics.
Suggested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Kaiyang Wu <wukaiyang@loongfans.cn>
---
src/PVE/API2/Qemu.pm | 1 +
src/PVE/QemuServer.pm | 42 +++++++++++++++++++++++++++++++++++++++
src/PVE/QemuServer/PCI.pm | 1 +
3 files changed, 44 insertions(+)
diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 922c6599..fb5c2f05 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -818,6 +818,7 @@ my $hwtypeoptions = {
'watchdog' => 1,
'audio0' => 1,
'rng0' => 1,
+ 'pvpanic' => 1,
};
my $generaloptions = {
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index f199371d..8698fb11 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -141,6 +141,23 @@ sub nodename {
return $nodename_cache;
}
+my $pvpanic_fmt = {
+ enabled => {
+ default_key => 1,
+ type => 'boolean',
+ description => "Create a pvpanic device to monitor guest panics.",
+ default => 0,
+ },
+ action => {
+ type => 'string',
+ enum => [qw(none pause shutdown exit-failure)],
+ description =>
+ "The action to perform if the guest panics.",
+ optional => 1,
+ },
+};
+PVE::JSONSchema::register_format('pve-qm-pvpanic', $pvpanic_fmt);
+
my $watchdog_fmt = {
model => {
default_key => 1,
@@ -739,6 +756,12 @@ EODESCR
optional => 1,
default => 1,
},
+ pvpanic => {
+ optional => 1,
+ type => 'string',
+ format => 'pve-qm-pvpanic',
+ description => "Create a panic monitor device.",
+ },
};
my $cicustom_fmt = {
@@ -1674,6 +1697,16 @@ sub print_smbios1 {
PVE::JSONSchema::register_format('pve-qm-smbios1', $smbios1_fmt);
+sub parse_pvpanic {
+ my ($value) = @_;
+
+ return if !$value;
+
+ my $res = eval { parse_property_string($pvpanic_fmt, $value) };
+ warn $@ if $@;
+ return $res;
+}
+
sub parse_watchdog {
my ($value) = @_;
@@ -3556,6 +3589,15 @@ sub config_to_command {
push @$devices, '-device', $ballooncmd;
}
+ if ($conf->{pvpanic}) {
+ my $pvpanicopts = parse_pvpanic($conf->{pvpanic});
+ if ($pvpanicopts->{enabled}) {
+ my $pvpanicpciaddr = print_pci_addr("pvpanic", $arch);
+ push @$devices, '-device', "pvpanic-pci,id=pvpanic$pvpanicpciaddr";
+ }
+ push @$devices, '-action', "panic=$pvpanicopts->{action}" if $pvpanicopts->{action};
+ }
+
if ($conf->{watchdog}) {
my $wdopts = parse_watchdog($conf->{watchdog});
my $pciaddr = print_pci_addr("watchdog", $arch);
diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index d7dc6121..5b0603a0 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -220,6 +220,7 @@ sub get_pci_addr_map {
'pci.4' => { bus => 1, addr => 28 },
'rng0' => { bus => 1, addr => 29 },
'pci.2-igd' => { bus => 1, addr => 30 }, # replaces pci.2 in case a legacy IGD device is passed through
+ 'pvpanic' => { bus => 1, addr => 31 },
'virtio6' => { bus => 2, addr => 1 },
'virtio7' => { bus => 2, addr => 2 },
'virtio8' => { bus => 2, addr => 3 },
--
2.56.0
next prev parent reply other threads:[~2026-10-09 6:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 6:58 [PATCH qemu-server/docs/manager v3 0/3] add pvpanic device support Kaiyang Wu
2026-10-09 6:58 ` Kaiyang Wu [this message]
2026-10-09 6:58 ` [PATCH docs v3 2/3] qm: add document section for the pvpanic device Kaiyang Wu
2026-10-09 6:58 ` [PATCH manager v3 3/3] ui: qemu: add pvpanic device support Kaiyang Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261009065813.109006-2-wukaiyang@loongfans.cn \
--to=wukaiyang2003@gmail.com \
--cc=pve-devel@lists.proxmox.com \
--cc=wukaiyang@loongfans.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox