From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH container v2 14/14] migration: intra-cluster: check config can be parsed on target node
Date: Wed, 25 Feb 2026 16:18:37 +0100 [thread overview]
Message-ID: <20260225151931.176335-15-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260225151931.176335-1-f.ebner@proxmox.com>
For remote migration, we already check that the config can be parsed
on the target. Do the same for intra-cluster migration, to avoid
issues with future new settings unexpectedly being ignored if the
target is too old. For example, migrating a container with a
mountpoint with 'keepattrs' to a node with a too old pve-container
version, results in the mountpoint not being mounted on the target.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Dependency bump for guest-common needed!
New in v2.
src/PVE/API2/LXC.pm | 11 +++++++++++
src/PVE/LXC/Migrate.pm | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 7841215..ec0b815 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1618,6 +1618,14 @@ __PACKAGE__->register_method({
minimum => '0',
default => 'migrate limit from datacenter or storage config',
},
+ force => {
+ type => 'boolean',
+ description =>
+ "For intra-cluster migration: allow migration even if there are configuration"
+ . " options not understood by the target. Only root may use this option.",
+ optional => 1,
+ default => 0,
+ },
},
},
returns => {
@@ -1644,6 +1652,9 @@ __PACKAGE__->register_method({
my $vmid = extract_param($param, 'vmid');
+ raise_param_exc({ force => "Only root may use this option." })
+ if $param->{force} && $authuser ne 'root@pam';
+
# test if VM exists
PVE::LXC::Config->load_config($vmid);
diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm
index d243d90..1786e15 100644
--- a/src/PVE/LXC/Migrate.pm
+++ b/src/PVE/LXC/Migrate.pm
@@ -159,6 +159,43 @@ sub prepare {
my $cmd = [@{ $self->{rem_ssh} }, '/bin/true'];
eval { $self->cmd_quiet($cmd); };
die "Can't connect to destination address using public key\n" if $@;
+
+ if (!$self->{opts}->{force}) {
+ my $skip;
+
+ # TODO PVE 10 - simplify by assuming that 'pct mtunnel' command is supported
+ my $log_and_check_supported = sub {
+ my ($level, $msg) = @_;
+ # Skip if the target is too old to support 'pct mtunnel' and avoid printing the
+ # whole 'pct' usage output
+ return if $skip;
+ if ($msg =~ m/unknown command 'pct mtunnel'/) {
+ $skip = 1;
+ return;
+ }
+ $self->log($level, $msg);
+ };
+
+ my $tunnel = eval {
+ PVE::Tunnel::fork_ssh_tunnel(
+ $self->{rem_ssh}, ['pct', 'mtunnel'], undef, $log_and_check_supported);
+ };
+ my $err = $@;
+ if ($skip) {
+ $self->log('info', "skipping strict configuration check - target too old");
+ } else {
+ die $err if $err;
+
+ my $nodename = PVE::INotify::nodename();
+ eval { PVE::Tunnel::write_tunnel($tunnel, 10, "config $vmid $nodename"); };
+ if (my $err = $@) {
+ chomp($err);
+ die "$err - use --force to migrate regardless\n";
+ }
+ eval { PVE::Tunnel::finish_tunnel($tunnel); };
+ $self->log('warn', "failed to finish tunnel in prepare() - $@") if $@;
+ }
+ }
}
# in restart mode, we shutdown the container before migrating
--
2.47.3
prev parent reply other threads:[~2026-02-25 15:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 15:18 [PATCH-SERIES qemu-server/guest-common/container v2 00/14] migration: strict config check for intra-cluster migration Fiona Ebner
2026-02-25 15:18 ` [PATCH qemu-server v2 01/14] d/control: bump versioned build dependency for libpve-common-perl to 9.0.12 Fiona Ebner
2026-02-25 15:18 ` [PATCH qemu-server v2 02/14] tests: migration: get rid of mocking for removed PVE::QemuMigrate::read_tunnel() Fiona Ebner
2026-02-25 15:18 ` [PATCH qemu-server v2 03/14] qm: mtunnel: avoid using deprecated check_running() helper Fiona Ebner
2026-02-25 15:18 ` [PATCH qemu-server v2 04/14] mtunnel: add 'conf' command to do strict configuration parsing Fiona Ebner
2026-02-25 15:18 ` [PATCH qemu-server v2 05/14] qm: mtunnel: reply when a command is unknown Fiona Ebner
2026-02-25 15:18 ` [PATCH qemu-server v2 06/14] migration: intra-cluster: check config can be parsed on target node Fiona Ebner
2026-02-25 15:18 ` [PATCH guest-common v2 07/14] tunnel: add missing IO::File module import Fiona Ebner
2026-02-25 15:18 ` [PATCH guest-common v2 08/14] tunnel: end module with true value as recommended by perlcritic Fiona Ebner
2026-02-25 15:18 ` [PATCH guest-common v2 09/14] tunnel: redirect stderr to log function Fiona Ebner
2026-02-25 15:18 ` [PATCH container v2 10/14] pct: add missing module imports and group according to style guide Fiona Ebner
2026-02-25 15:18 ` [PATCH container v2 11/14] migrate: add missing module imports Fiona Ebner
2026-02-25 15:18 ` [PATCH container v2 12/14] pct: introduce mtunnel command Fiona Ebner
2026-02-25 15:18 ` [PATCH container v2 13/14] d/control: bump versioned build dependency for libpve-common-perl to 9.0.12 Fiona Ebner
2026-02-25 15:18 ` Fiona Ebner [this message]
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=20260225151931.176335-15-f.ebner@proxmox.com \
--to=f.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox