all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Fiona Ebner <f.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server v3 stable-bookworm 8/8] migration: preserve host_mtu for virtio-net devices
Date: Thu, 4 Sep 2025 20:11:55 +0200	[thread overview]
Message-ID: <f50074d8-6c3f-4752-b5c0-3081d473bf7d@proxmox.com> (raw)
In-Reply-To: <20250904124113.81772-9-f.ebner@proxmox.com>

Am 04.09.25 um 14:42 schrieb Fiona Ebner:
> 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]. Moreover, the effective setting in the guest (state) will
> still be the host_mtu from the source side, even if a different value
> is used for host_mtu on the target instance's commandline. This will
> not lead to an error loading the migration stream in QEMU, but having
> a larger host_mtu than the bridge MTU is still problematic for certain
> network traffic like
>> iperf3 -c 10.10.10.11 -u -l 2k
> when host_mtu=9000 and bridge MTU=1500.
> 
> Pass the values from the source to the target during migration to be
> able to preserve them.

Which breaks migration from new to old, which can be fine, but seems
avoidable given that we got a tunnel that we can query stuff over.

Maybe we could at least catch the "Unknown option: nets-host-mtu"
error explicitly and add some context that the target likely just
needs to be updated to make the migration work.

> 
> [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>
> ---
> 
> Changes in v3:
> * Adapt to moved/changed get_nets_host_mtu() helper. The Network
>   module does not exist yet in PVE 8, and parse_net() lives in
>   QemuServer itself, so the helper is also moved there.
> 
>  src/PVE/QemuMigrate.pm                    |  8 +++++++
>  src/PVE/QemuServer.pm                     | 27 +++++++++++++++++++++++
>  src/test/MigrationTest/QemuMigrateMock.pm | 15 +++++++++++++
>  3 files changed, 50 insertions(+)
> 
> diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
> index 28d7ac56..3cd7069a 100644
> --- a/src/PVE/QemuMigrate.pm
> +++ b/src/PVE/QemuMigrate.pm
> @@ -959,6 +959,10 @@ sub phase2_start_local_cluster {
>          push @$cmd, '--force-cpu', $start->{forcecpu};
>      }
>  
> +    if ($start->{'nets-host-mtu'}) {
> +        push @$cmd, '--nets-host-mtu', $start->{'nets-host-mtu'};
> +    }
> +
>      if ($self->{storage_migration}) {
>          push @$cmd, '--targetstorage', ($self->{opts}->{targetstorage} // '1');
>      }
> @@ -1144,6 +1148,10 @@ sub phase2 {
>          },
>      };
>  
> +    if (my $nets_host_mtu = PVE::QemuServer::get_nets_host_mtu($vmid, $conf)) {
> +        $params->{start_params}->{'nets-host-mtu'} = $nets_host_mtu;
> +    }
> +
>      my ($tunnel_info, $spice_port);
>  
>      my @online_local_volumes = $self->filter_local_volumes('online');
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index 47c96726..5b08b3e3 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -9533,4 +9533,31 @@ sub delete_ifaces_ipams_ips {
>      }
>  }
>  
> +sub get_nets_host_mtu {
> +    my ($vmid, $conf) = @_;
> +
> +    my $nets_host_mtu = [];
> +    for my $opt (sort keys $conf->%*) {
> +        next if $opt !~ m/^net(\d+)$/;
> +        my $net = parse_net($conf->{$opt});
> +        next if $net->{model} ne 'virtio';
> +
> +        my $host_mtu = eval {
> +            mon_cmd(
> +                $vmid, 'qom-get',
> +                path => "/machine/peripheral/$opt",
> +                property => 'host_mtu',
> +            );
> +        };
> +        if (my $err = $@) {
> +            log_warn("$opt: could not query host_mtu - $err");
> +        } elsif (defined($host_mtu)) {
> +            push $nets_host_mtu->@*, "${opt}=${host_mtu}";
> +        } else {
> +            log_warn("$opt: got undefined value when querying host_mtu");
> +        }
> +    }
> +    return join(',', $nets_host_mtu->@*);
> +}
> +
>  1;
> diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm
> index f678f9ec..05b2c5c1 100644
> --- a/src/test/MigrationTest/QemuMigrateMock.pm
> +++ b/src/test/MigrationTest/QemuMigrateMock.pm
> @@ -175,6 +175,21 @@ $MigrationTest::Shared::qemu_server_module->mock(
>          delete $expected_calls->{'vm_stop'};
>      },
>      del_nets_bridge_fdb => sub { return; },
> +    mon_cmd => sub {
> +        my ($vmid, $command, %params) = @_;
> +
> +        if ($command eq 'qom-get') {
> +            if (
> +                $params{path} =~ m|^/machine/peripheral/net\d+$|
> +                && $params{property} eq 'host_mtu'
> +            ) {
> +                return 1500;
> +            }
> +            die "mon_cmd (mocked) - implement me: $command for path '$params{path}' property"
> +                . " '$params{property}'";
> +        }
> +        die "mon_cmd (mocked) - implement me: $command";
> +    },
>  );
>  
>  my $qemu_server_cpuconfig_module = Test::MockModule->new("PVE::QemuServer::CPUConfig");



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


  reply	other threads:[~2025-09-04 18:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 12:40 [pve-devel] [PATCH-SERIES qemu-server v3 0/8] virtio-net: fix migration between default/non-default MTUs Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 1/8] virtio-net: fix migration between default/non-default MTUs starting with machine version 10.0+pve1 Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 2/8] api: vm start: introduce nets-host-mtu parameter for migration compat Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 3/8] migration: preserve host_mtu for virtio-net devices Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 4/8] snapshot: save vmstate: avoid using deprecated check_running() function Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 5/8] snapshot: save vmstate: die when PID cannot be obtained Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 6/8] snapshot: introduce running-nets-host-mtu property Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 stable-bookworm 7/8] api: vm start: introduce nets-host-mtu parameter for migration compat Fiona Ebner
2025-09-04 12:40 ` [pve-devel] [PATCH qemu-server v3 stable-bookworm 8/8] migration: preserve host_mtu for virtio-net devices Fiona Ebner
2025-09-04 18:11   ` Thomas Lamprecht [this message]
2025-09-05  8:54     ` Fiona Ebner
2025-09-05  9:09       ` Thomas Lamprecht
2025-09-05  9:17         ` Fiona Ebner
2025-09-04 13:06 ` [pve-devel] [PATCH-SERIES qemu-server v3 0/8] virtio-net: fix migration between default/non-default MTUs Fabian Grünbichler
2025-09-04 18:16 ` [pve-devel] applied: " 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=f50074d8-6c3f-4752-b5c0-3081d473bf7d@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=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 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