From: Fiona Ebner <f.ebner@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>,
"Proxmox VE development discussion" <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server v2 2/4] api: vm start: introduce nets-host-mtu parameter for migration compat
Date: Thu, 4 Sep 2025 12:03:17 +0200 [thread overview]
Message-ID: <0669826e-71f4-4419-97e0-d1b88fa2c0b2@proxmox.com> (raw)
In-Reply-To: <1756978663.tpmtqmxakz.astroid@yuna.none>
Am 04.09.25 um 11:52 AM schrieb Fabian Grünbichler:
> On September 4, 2025 11:28 am, Fiona Ebner wrote:
>> Am 04.09.25 um 11:11 AM schrieb Fabian Grünbichler:
>>> On September 3, 2025 4:22 pm, Fiona Ebner wrote:
>>>> diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
>>>> index b571e6c1..95db271b 100644
>>>> --- a/src/PVE/API2/Qemu.pm
>>>> +++ b/src/PVE/API2/Qemu.pm
>>>> @@ -1484,10 +1494,37 @@ sub print_netdevice_full {
>>>>
>>>> my $mtu = $net->{mtu};
>>>>
>>>> - if ($net->{model} eq 'virtio' && $net->{bridge}) {
>>>> + if (defined($host_mtu_migration)) {
>>>> + if ($host_mtu_migration) {
>>>> + if (defined($mtu) && $mtu != 1) {
>>>> + if ($mtu != $host_mtu_migration) {
>>>> + log_warn(
>>>> + "netdev $netid: using 'host_mtu=$host_mtu_migration' for migration compat,"
>>>> + . " but value different from value in configuration '$mtu'");
>>>> + } # else avoid being overly verbose if there is an explicit setting
>>>
>>> can this happen in practice (without manually editing the config or
>>> manual QMP commands)?
>>
>> I don't think so. But since we have the info, I though it'd be good to
>> warn about it.
>>
>
> I just figured it makes the code harder to parse ;)
Ack, yes, I guess it's not really that important.
>>>
>>>> + } else {
>>>> + print "netdev $netid: using 'host_mtu=$host_mtu_migration' for migration compat\n";
>>>> + }
>>>> + } else {
>>>> + print "netdev $netid: not adding 'host_mtu' parameter for migration compat\n";
>>>> + }
>>>> + }
>>>
>>> this if here
>>>
>>>> +
>>>> + if (
>>>> + $net->{model} eq 'virtio'
>>>> + && $net->{bridge}
>>>> + && (!defined($host_mtu_migration) || $host_mtu_migration)
>>>> + ) {
>>>> my $bridge_mtu = PVE::Network::read_bridge_mtu($net->{bridge});
>>>>
>>>> - if (!defined($mtu) || $mtu == 1) {
>>>> + if ($host_mtu_migration) {
>>>
>>> and this if here could be combined?
>>
>> How? You mean setting $mtu = $host_mtu_migration; early if there is a
>> non-zero value?
>
> something like this (untested):
>
> ----8<----
> diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
> index 77b8e9c4..a76a134a 100644
> --- a/src/PVE/QemuServer.pm
> +++ b/src/PVE/QemuServer.pm
> @@ -1494,7 +1494,13 @@ sub print_netdevice_full {
>
> my $mtu = $net->{mtu};
>
> - if (defined($host_mtu_migration)) {
> + if (
> + $net->{model} eq 'virtio'
> + && $net->{bridge}
> + && (!defined($host_mtu_migration) || $host_mtu_migration)
> + ) {
> + my $bridge_mtu = PVE::Network::read_bridge_mtu($net->{bridge});
> +
> if ($host_mtu_migration) {
> if (defined($mtu) && $mtu != 1) {
> if ($mtu != $host_mtu_migration) {
> @@ -1505,26 +1511,10 @@ sub print_netdevice_full {
> } else {
> print "netdev $netid: using 'host_mtu=$host_mtu_migration' for migration compat\n";
> }
> - } else {
> - print "netdev $netid: not adding 'host_mtu' parameter for migration compat\n";
> - }
> - }
> -
> - if (
> - $net->{model} eq 'virtio'
> - && $net->{bridge}
> - && (!defined($host_mtu_migration) || $host_mtu_migration)
> - ) {
> - my $bridge_mtu = PVE::Network::read_bridge_mtu($net->{bridge});
> -
> - if ($host_mtu_migration) {
> $mtu = $host_mtu_migration;
> - # TODO PVE 10 - upgrade to failure? Certain network traffic can break like
> - # iperf3 -c 10.10.10.11 -u -l 2k when host_mtu=9000 and bridge MTU=1500
> - if ($mtu > $bridge_mtu) {
> - log_warn("netdev $netid: MTU '$mtu' is bigger than the bridge MTU '$bridge_mtu'");
> - }
> - } elsif (!defined($mtu) || $mtu == 1) {
> + }
> +
> + if (!defined($mtu) || $mtu == 1) {
> $mtu = $bridge_mtu;
> } elsif ($mtu < 576) {
> die "netdev $netid: MTU '$mtu' is smaller than the IP minimum MTU '576'\n";
> ---->8----
>
> I dropped the log statement about host_mtu_migration being an explicit
> zero, since that is logged further below already if $mtu is defined, but
> it could of course be added back there also for the $mtu == undef case
> with a final
>
> } elsif (defined($host_mtu_migration) && $host_mtu_migration == 0) {
> log_warn(..);
> }
Oh, so that's what you meant, heh :) I'll look into it.
>
>>
>>>
>>>> + $mtu = $host_mtu_migration;
>>>> + # TODO PVE 10 - upgrade to failure? Certain network traffic can break like
>>>> + # iperf3 -c 10.10.10.11 -u -l 2k when host_mtu=9000 and bridge MTU=1500
>>>> + if ($mtu > $bridge_mtu) {
>>>> + log_warn("netdev $netid: MTU '$mtu' is bigger than the bridge MTU '$bridge_mtu'");
>>>> + }
>>>> + } elsif (!defined($mtu) || $mtu == 1) {
>>>
>>> this could still be an if, then the newly added warning above can be
>>> dropped
>>>
>>>> $mtu = $bridge_mtu;
>>>> } elsif ($mtu < 576) {
>>>> die "netdev $netid: MTU '$mtu' is smaller than the IP minimum MTU '576'\n";
>>>> @@ -1495,7 +1532,7 @@ sub print_netdevice_full {
>>>> die "netdev $netid: MTU '$mtu' is bigger than the bridge MTU '$bridge_mtu'\n";
>>>
>>> since it is covered by this one here
>>
>> If we want to go for early failure when host_mtu > bridge MTU then yes.
>> Because this is die, the above is warn ;) Doing that is fine by me, but
>> I wanted to propose the non-breaking option first. If we consider that
>> it's problematic in more cases than not, then I'll go for early failure.
>> And maybe I'll add a little more context to the error message (at least
>> when it happens for migration).
>
> could still handle it in one place, and warn if $host_mtu_migration
> (either inline, or via an elsif coming first that compares
> $host_mtu_migration to $bridge_mtu), die otherwise - but I think if we
> die on this condition when starting, then making it fatal for migration
> starts might make sense as well, since the die would happen early on (so
> no harm done).. might want to add a warning in that case as well that
> tells the user what to do to make the VM migrateable though?
Fair point. Yes, that was what I meant with "more context to the error
message".
_______________________________________________
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-04 10:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 14:22 [pve-devel] [PATCH-SERIES qemu-server v2 0/4] virtio-net: fix migration between default/non-default MTUs, part one and two Fiona Ebner
2025-09-03 14:22 ` [pve-devel] [PATCH qemu-server v2 1/4] virtio-net: fix migration between default/non-default MTUs starting with machine version 10.0+pve1 Fiona Ebner
2025-09-03 14:22 ` [pve-devel] [PATCH qemu-server v2 2/4] api: vm start: introduce nets-host-mtu parameter for migration compat Fiona Ebner
2025-09-04 9:11 ` Fabian Grünbichler
2025-09-04 9:28 ` Fiona Ebner
2025-09-04 9:52 ` Fabian Grünbichler
2025-09-04 10:03 ` Fiona Ebner [this message]
2025-09-04 9:55 ` Fiona Ebner
2025-09-03 14:22 ` [pve-devel] [PATCH qemu-server v2 3/4] migration: preserve host_mtu for virtio-net devices Fiona Ebner
2025-09-03 14:22 ` [pve-devel] [PATCH qemu-server v2 stable-bookworm 4/4] " Fiona Ebner
2025-09-04 9:11 ` Fabian Grünbichler
2025-09-04 9:32 ` 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=0669826e-71f4-4419-97e0-d1b88fa2c0b2@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=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