Am 03.09.25 um 9:22 AM schrieb Fabian Grünbichler:
> 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----

Yes, sounds good to me!

> (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?)

You won't be able to migrate such VMs to a host with non-updated
qemu-server, but that is true in general for such version bumps and
virtio-net is the most common use case in any case, so users already
need to update.

> that might make it easier to (at some point) move more of this into its
> own module (or QemuServer::Network)?



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

Reply via email to