From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server 2/2] virtio-net: fix migration between default/non-default MTUs starting with machine version 10.0+pve1
Date: Wed, 03 Sep 2025 09:22:28 +0200 [thread overview]
Message-ID: <1756882252.49rsx8buc9.astroid@yuna.none> (raw)
In-Reply-To: <20250902134752.112864-3-f.ebner@proxmox.com>
On September 2, 2025 3:44 pm, Fiona Ebner wrote:
> The virtual hardware is generated differently (at least for i440fx
> machines) when host_mtu is set or not set on the netdev command line
> [0]. When the MTU is the same value as the default 1500, Proxmox VE
> did not add a host_mtu parameter. This is problematic for migration
> where host_mtu is present on one end of the migration, but not on the
> other [1]. Migration between command lines where host_mtu is set on
> both ends, even if set to different values, works fine.
>
> Always set the host_mtu parameter starting with machine version
> 10.0+pve1 to avoid this issue going forward. Handling migrations with
> older machine versions is more involved and will be done in separate
> patches. Thanks to Stefan Hanreich and Fabian Grünbichler for
> discussing this with me!
>
> Since print_netdevice_full() is also called for hotplug, it cannot
> always use the $version_guard helper and needs to fallback to
> min_version() then.
>
> [0]: https://bugzilla.redhat.com/show_bug.cgi?id=1449346
> [1]: https://forum.proxmox.com/threads/live-vm-migration-fails.169537/post-796379
>
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> src/PVE/QemuServer.pm | 23 +++++++++++++++++--
> src/PVE/QemuServer/Machine.pm | 6 +++++
> src/test/cfg2cmd/bootorder-empty.conf.cmd | 4 ++--
> src/test/cfg2cmd/bootorder-legacy.conf.cmd | 4 ++--
> src/test/cfg2cmd/bootorder.conf.cmd | 4 ++--
> src/test/cfg2cmd/efidisk-on-rbd.conf.cmd | 4 ++--
> src/test/cfg2cmd/ide.conf.cmd | 4 ++--
> .../cfg2cmd/netdev-7.1-multiqueues.conf.cmd | 2 +-
> src/test/cfg2cmd/netdev-7.1.conf.cmd | 2 +-
> src/test/cfg2cmd/netdev_vxlan.conf.cmd | 2 +-
> src/test/cfg2cmd/q35-ide.conf.cmd | 4 ++--
> .../q35-linux-hostpci-mapping.conf.cmd | 4 ++--
> .../q35-linux-hostpci-multifunction.conf.cmd | 4 ++--
> ...q35-linux-hostpci-x-pci-overrides.conf.cmd | 4 ++--
> src/test/cfg2cmd/q35-linux-hostpci.conf.cmd | 4 ++--
> src/test/cfg2cmd/q35-simple.conf.cmd | 4 ++--
> src/test/cfg2cmd/seabios_serial.conf.cmd | 4 ++--
> src/test/cfg2cmd/simple-btrfs.conf.cmd | 4 ++--
> .../cfg2cmd/simple-disk-passthrough.conf.cmd | 4 ++--
> src/test/cfg2cmd/simple-rbd.conf.cmd | 4 ++--
> src/test/cfg2cmd/simple-virtio-blk.conf.cmd | 4 ++--
> .../cfg2cmd/simple-zfs-over-iscsi.conf.cmd | 4 ++--
> src/test/cfg2cmd/simple1.conf.cmd | 4 ++--
> 23 files changed, 66 insertions(+), 41 deletions(-)
>
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index 38fa3f83..8528f9f3 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -1457,7 +1457,17 @@ sub print_pbs_blockdev {
> }
>
we could avoid the need for $version_guard in print_netdevice_full, if
we do something like:
----8<----
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 8528f9f3..d3c2486d 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1466,7 +1466,6 @@ sub print_netdevice_full {
$use_old_bios_files,
$arch,
$machine_version,
- $version_guard,
) = @_;
my $device = $net->{model};
@@ -1505,10 +1504,7 @@ sub print_netdevice_full {
die "netdev $netid: MTU '$mtu' is bigger than the bridge MTU '$bridge_mtu'\n";
}
- my $always_set_host_mtu =
- $version_guard
- ? $version_guard->(10, 0, 1)
- : min_version($machine_version, 10, 0, 1);
+ my $always_set_host_mtu = min_version($machine_version, 10, 0, 1);
if ($always_set_host_mtu) {
$tmpstr .= ",host_mtu=$mtu";
} else {
@@ -3837,6 +3833,8 @@ sub config_to_command {
my $netdevfull = print_netdev_full($vmid, $conf, $arch, $d, $netname);
push @$devices, '-netdev', $netdevfull;
+ # force +pve1 if machine version 10, for host_mtu differentiation
+ $version_guard->(10, 0, 1);
my $netdevicefull = print_netdevice_full(
$vmid,
$conf,
@@ -3846,7 +3844,6 @@ sub config_to_command {
$use_old_bios_files,
$arch,
$machine_version,
- $version_guard,
);
push @$devices, '-device', $netdevicefull;
---->8----
(with the downside of now bumping to +pve1 for unversioned VMs as soon
as they have a NIC, instead of more fine-grained, but that shouldn't
really hurt?)
that might make it easier to (at some point) move more of this into its
own module (or QemuServer::Network)?
other than this, seems to behave as expected so either variant is fine
for me :)
> sub print_netdevice_full {
> - my ($vmid, $conf, $net, $netid, $bridges, $use_old_bios_files, $arch, $machine_version) = @_;
> + my (
> + $vmid,
> + $conf,
> + $net,
> + $netid,
> + $bridges,
> + $use_old_bios_files,
> + $arch,
> + $machine_version,
> + $version_guard,
> + ) = @_;
>
> my $device = $net->{model};
> if ($net->{model} eq 'virtio') {
> @@ -1495,7 +1505,15 @@ sub print_netdevice_full {
> die "netdev $netid: MTU '$mtu' is bigger than the bridge MTU '$bridge_mtu'\n";
> }
>
> - $tmpstr .= ",host_mtu=$mtu" if $mtu != 1500;
> + my $always_set_host_mtu =
> + $version_guard
> + ? $version_guard->(10, 0, 1)
> + : min_version($machine_version, 10, 0, 1);
> + if ($always_set_host_mtu) {
> + $tmpstr .= ",host_mtu=$mtu";
> + } else {
> + $tmpstr .= ",host_mtu=$mtu" if $mtu != 1500;
> + }
> } elsif (defined($mtu)) {
> warn
> "WARN: netdev $netid: ignoring MTU '$mtu', not using VirtIO or no bridge configured.\n";
> @@ -3828,6 +3846,7 @@ sub config_to_command {
> $use_old_bios_files,
> $arch,
> $machine_version,
> + $version_guard,
> );
>
> push @$devices, '-device', $netdevicefull;
> diff --git a/src/PVE/QemuServer/Machine.pm b/src/PVE/QemuServer/Machine.pm
> index 9d17344a..4c135a20 100644
> --- a/src/PVE/QemuServer/Machine.pm
> +++ b/src/PVE/QemuServer/Machine.pm
> @@ -37,6 +37,12 @@ our $PVE_MACHINE_VERSION = {
> '+pve1' => 'Disables S3/S4 power states by default.',
> },
> },
> + '10.0' => {
> + highest => 1,
> + revisions => {
> + '+pve1' => 'Set host_mtu vNIC option even with default value for migration compat.',
> + },
> + },
> };
>
> my $machine_fmt = {
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-09-03 7:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 13:44 [pve-devel] [PATCH-SERIES qemu-server 0/2] virtio-net: fix migration between default/non-default MTUs, part one Fiona Ebner
2025-09-02 13:44 ` [pve-devel] [PATCH qemu-server 1/2] run make tidy Fiona Ebner
2025-09-02 13:44 ` [pve-devel] [PATCH qemu-server 2/2] virtio-net: fix migration between default/non-default MTUs starting with machine version 10.0+pve1 Fiona Ebner
2025-09-03 7:22 ` Fabian Grünbichler [this message]
2025-09-03 7:58 ` Fiona Ebner
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=1756882252.49rsx8buc9.astroid@yuna.none \
--to=f.gruenbichler@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