all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v5 10/11] ui: window: Migrate: add checkbox for migrating VM conntrack state
Date: Wed, 30 Jul 2025 11:45:44 +0200	[thread overview]
Message-ID: <20250730094549.263805-11-c.heiss@proxmox.com> (raw)
In-Reply-To: <20250730094549.263805-1-c.heiss@proxmox.com>

Adds a new checkbox to the migration dialog, if it is a
live/online-migration and both the source and target nodes have support
for our dbus-vmstate helper.

If the checkbox is active, it passes along the `with-conntrack-state`
parameter to the migrate API call.

Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v1 -> v2:
  * rebased on latest master

Changes v2 -> v3:
  * reformatted using biome
  * log warning in case /capabilities/qemu/migration is not (yet)
    supported by the target node

Changes v3 -> v4:
  * no changes

Changes v4 -> v5:
  * no changes

 www/manager6/window/Migrate.js | 82 ++++++++++++++++++++++++++++++++--
 1 file changed, 79 insertions(+), 3 deletions(-)

diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index 4103ad135..8b52f9e90 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -29,9 +29,10 @@ Ext.define('PVE.window.Migrate', {
                 allowedNodes: undefined,
                 overwriteLocalResourceCheck: false,
                 hasLocalResources: false,
+                withConntrackState: true,
+                bothHaveDbusVmstate: false,
             },
         },
-
         formulas: {
             setMigrationMode: function (get) {
                 if (get('running')) {
@@ -62,6 +63,10 @@ Ext.define('PVE.window.Migrate', {
                     return false;
                 }
             },
+            conntrackStateCheckboxHidden: (get) =>
+                !get('running') ||
+                get('vmtype') !== 'qemu' ||
+                !get('migration.bothHaveDbusVmstate'),
         },
     },
 
@@ -141,6 +146,10 @@ Ext.define('PVE.window.Migrate', {
                 params.force = 1;
             }
 
+            if (vm.get('migration.bothHaveDbusVmstate') && vm.get('migration.withConntrackState')) {
+                params['with-conntrack-state'] = 1;
+            }
+
             Proxmox.Utils.API2Request({
                 params: params,
                 url:
@@ -227,12 +236,29 @@ Ext.define('PVE.window.Migrate', {
                     method: 'GET',
                 });
                 migrateStats = result.data;
-                me.fetchingNodeMigrateInfo = false;
             } catch (error) {
                 Ext.Msg.alert(Proxmox.Utils.errorText, error.htmlStatus);
+                me.fetchingNodeMigrateInfo = false;
                 return;
             }
 
+            const target = me.lookup('pveNodeSelector').value;
+            let targetCapabilities = {};
+
+            try {
+                const { result } = await Proxmox.Async.api2({
+                    url: `/nodes/${target}/capabilities/qemu/migration`,
+                    method: 'GET',
+                });
+                targetCapabilities = result.data;
+            } catch (err) {
+                // Only emit a warning in the case the target node does not (yet) support the
+                // `capabilites/qemu/migration` endpoint and simply treat all features as unsupported.
+                console.warn(`failed to query /capabilites/qemu/migration on '${target}': ${err}`);
+            }
+
+            me.fetchingNodeMigrateInfo = false;
+
             if (migrateStats.running) {
                 vm.set('running', true);
             }
@@ -242,7 +268,6 @@ Ext.define('PVE.window.Migrate', {
                 migration.possible = true;
             }
             migration.preconditions = [];
-            let target = me.lookup('pveNodeSelector').value;
             let disallowed = migrateStats.not_allowed_nodes?.[target] ?? {};
 
             if (migrateStats.allowed_nodes && !vm.get('running')) {
@@ -361,6 +386,36 @@ Ext.define('PVE.window.Migrate', {
                 });
             }
 
+            migration.bothHaveDbusVmstate =
+                migrateStats['has-dbus-vmstate'] && targetCapabilities['has-dbus-vmstate'];
+            if (vm.get('running')) {
+                if (migration.withConntrackState && !migrateStats['has-dbus-vmstate']) {
+                    migration.preconditions.push({
+                        text: gettext(
+                            'Cannot migrate conntrack state, source node is lacking support. Active network connections might get dropped.',
+                        ),
+                        severity: 'warning',
+                    });
+                }
+                if (migration.withConntrackState && !targetCapabilities['has-dbus-vmstate']) {
+                    migration.preconditions.push({
+                        text: gettext(
+                            'Cannot migrate conntrack state, target node is lacking support. Active network connections might get dropped.',
+                        ),
+                        severity: 'warning',
+                    });
+                }
+
+                if (migration.bothHaveDbusVmstate && !migration.withConntrackState) {
+                    migration.preconditions.push({
+                        text: gettext(
+                            'Conntrack state migration disabled. Active network connections might get dropped.',
+                        ),
+                        severity: 'warning',
+                    });
+                }
+            }
+
             vm.set('migration', migration);
         },
         checkLxcPreconditions: function (resetMigrationPossible) {
@@ -456,6 +511,27 @@ Ext.define('PVE.window.Migrate', {
                                 },
                             },
                         },
+                        {
+                            xtype: 'proxmoxcheckbox',
+                            name: 'withConntrackState',
+                            fieldLabel: gettext('Conntrack state'),
+                            autoEl: {
+                                tag: 'div',
+                                'data-qtip': gettext(
+                                    'Enables live migration of conntrack entries for this VM.',
+                                ),
+                            },
+                            bind: {
+                                hidden: '{conntrackStateCheckboxHidden}',
+                                value: '{migration.withConntrackState}',
+                            },
+                            listeners: {
+                                change: {
+                                    fn: 'checkMigratePreconditions',
+                                    extraArg: true,
+                                },
+                            },
+                        },
                     ],
                 },
             ],
-- 
2.49.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-07-30  9:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30  9:45 [pve-devel] [PATCH firewall/qemu-server/manager/docs v5 00/11] fix #5180: migrate conntrack state on live migration Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH proxmox-firewall v5 01/11] firewall: add connmark rule with VMID to all guest chains Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH firewall v5 02/11] " Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH firewall v5 03/11] firewall: helpers: add sub for flushing conntrack entries by mark Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH qemu-server v5 04/11] qmp helpers: allow passing structured args via qemu_objectadd() Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH qemu-server v5 05/11] api2: qemu: add module exposing node migration capabilities Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH qemu-server v5 06/11] fix #5180: dbus-vmstate: add daemon for QEMUs dbus-vmstate interface Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH qemu-server v5 07/11] fix #5180: migrate: integrate helper for live-migrating conntrack info Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH qemu-server v5 08/11] migrate: flush old VM conntrack entries after successful migration Christoph Heiss
2025-07-30  9:45 ` [pve-devel] [PATCH manager v5 09/11] api2: capabilities: expose new qemu/migration endpoint Christoph Heiss
2025-07-30  9:45 ` Christoph Heiss [this message]
2025-07-30  9:45 ` [pve-devel] [PATCH docs v5 11/11] qm: document conntrack state migration for live migrations Christoph Heiss
2025-07-30 23:48   ` [pve-devel] applied: " Thomas Lamprecht
2025-07-30 22:45 ` [pve-devel] applied-series: [PATCH firewall/qemu-server/manager/docs v5 00/11] fix #5180: migrate conntrack state on live migration Thomas Lamprecht

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=20250730094549.263805-11-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal