Will be used for a warning. Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- PVE/QemuServer/Machine.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm index c9fc9a3d..13721ae8 100644 --- a/PVE/QemuServer/Machine.pm +++ b/PVE/QemuServer/Machine.pm @@ -18,6 +18,7 @@ sub machine_type_is_q35 { return $conf->{machine} && ($conf->{machine} =~ m/q35/) ? 1 : 0; } +# In list context, also returns whether the current machine is deprecated or not. sub current_from_query_machines { my ($machines) = @_; @@ -29,15 +30,17 @@ sub current_from_query_machines { $current = $machine->{name}; # pve-version only exists for the current machine $current .= "+$machine->{'pve-version'}" if $machine->{'pve-version'}; - return $current; + return wantarray ? ($current, $machine->{deprecated} ? 1 : 0) : $current; } } - # fallback to the default machine if current is not supported by qemu - return $default || 'pc'; + # fallback to the default machine if current is not supported by qemu - assume never deprecated + my $fallback = $default || 'pc'; + return wantarray ? ($fallback, 0) : $fallback; } -# this only works if VM is running +# This only works if VM is running. +# In list context, also returns whether the current machine is deprecated or not. sub get_current_qemu_machine { my ($vmid) = @_; -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel