[pve-devel] [PATCH qemu-server v3 06/14] api2: qemu: add module exposing node migration capabilities

Christoph Heiss c.heiss at proxmox.com
Thu Jul 3 13:54:08 CEST 2025


Similar to the already existing ones for CPU and QEMU machine support.

Very simple for now, only provides one property for now:

  'has-dbus-vmstate' - Whether the dbus-vmstate is available/installed

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
Changes v1 -> v2:
  * no changes

Changes v2 -> v3:
  * moved module from PVE::API2::Qemu::Migration to
    PVE::API2::NodeCapabilities::Qemu::Migration, based on Fiona's
    suggestion
  * formatted using perltidy

 src/PVE/API2/Makefile                         |  1 +
 src/PVE/API2/NodeCapabilities/Makefile        |  9 ++++
 .../API2/NodeCapabilities/Qemu/Migration.pm   | 48 +++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 src/PVE/API2/NodeCapabilities/Makefile
 create mode 100644 src/PVE/API2/NodeCapabilities/Qemu/Migration.pm

diff --git a/src/PVE/API2/Makefile b/src/PVE/API2/Makefile
index f8fce567..4620703c 100644
--- a/src/PVE/API2/Makefile
+++ b/src/PVE/API2/Makefile
@@ -7,3 +7,4 @@ install:
 	install -d -m 0755 $(DESTDIR)$(PERLDIR)/PVE/API2
 	install -D -m 0644 Qemu.pm $(DESTDIR)$(PERLDIR)/PVE/API2/Qemu.pm
 	$(MAKE) -C Qemu install
+	$(MAKE) -C NodeCapabilities install
diff --git a/src/PVE/API2/NodeCapabilities/Makefile b/src/PVE/API2/NodeCapabilities/Makefile
new file mode 100644
index 00000000..b35f5529
--- /dev/null
+++ b/src/PVE/API2/NodeCapabilities/Makefile
@@ -0,0 +1,9 @@
+DESTDIR=
+PREFIX=/usr
+PERLDIR=$(PREFIX)/share/perl5
+
+SOURCES := Qemu/Migration.pm
+
+.PHONY: install
+install: $(SOURCES)
+	for i in $(SOURCES); do install -D -m 0644 $$i $(DESTDIR)$(PERLDIR)/PVE/API2/NodeCapabilities/$$i; done
diff --git a/src/PVE/API2/NodeCapabilities/Qemu/Migration.pm b/src/PVE/API2/NodeCapabilities/Qemu/Migration.pm
new file mode 100644
index 00000000..98d683c3
--- /dev/null
+++ b/src/PVE/API2/NodeCapabilities/Qemu/Migration.pm
@@ -0,0 +1,48 @@
+package PVE::API2::NodeCapabilities::Qemu::Migration;
+
+use strict;
+use warnings;
+
+use JSON;
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTHandler;
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method({
+    name => 'capabilities',
+    path => '',
+    method => 'GET',
+    proxyto => 'node',
+    description => 'Get node-specific QEMU migration capabilities of the node.'
+        . " Requires the 'Sys.Audit' permission on '/nodes/<node>'.",
+    permissions => {
+        check => ['perm', '/nodes/{node}', ['Sys.Audit']],
+    },
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            node => get_standard_option('pve-node'),
+        },
+    },
+    returns => {
+        type => 'object',
+        additionalProperties => 0,
+        properties => {
+            'dbus-vmstate' => {
+                type => 'boolean',
+                description => 'Whether the host supports live-migrating additional'
+                    . ' VM state via the dbus-vmstate helper.',
+            },
+        },
+    },
+    code => sub {
+        return {
+            'has-dbus-vmstate' => -f '/usr/libexec/qemu-server/dbus-vmstate'
+            ? JSON::true
+            : JSON::false,
+        };
+    },
+});
+
+1;
-- 
2.49.0





More information about the pve-devel mailing list