Am 19.12.23 um 10:40 schrieb Filip Schauer:
> @@ -716,6 +728,33 @@ sub get_cpu_from_running_vm {
>      return $1;
>  }
>  
> +sub get_cpu_bitness {
> +    my ($cpu_prop_str, $arch) = @_;
> +
> +    die "missing 'arch'\n" if !$arch;

The config's 'arch' defaults to the host arch, so we could do the same
here. Then callers can just pass $conf->{arch} without checking if
explicitly set. But this is also fine by me.

> +
> +    my $cputype = get_default_cpu_type($arch, 0);
> +
> +    if ($cpu_prop_str) {
> +     my $cpu = PVE::JSONSchema::parse_property_string('pve-vm-cpu-conf', 
> $cpu_prop_str)
> +         or die "Cannot parse cpu description: $cpu_prop_str\n";
> +
> +     my $cputype = $cpu->{cputype};
> +
> +     if (my $model = $builtin_models->{$cputype}) {
> +         $cputype = $model->{'reported-model'};
> +     } elsif (is_custom_model($cputype)) {
> +         my $custom_cpu = get_custom_model($cputype);
> +         $cputype = $custom_cpu->{'reported-model'} // 
> $cpu_fmt->{'reported-model'}->{default};
> +     }

Missing the logic for the replacement type, i.e.
        if (my $replacement_type = $depreacated_cpu_map->{$cputype}) {
            $cputype = $replacement_type;
        }

> +    }
> +
> +    return $cputypes_32bit->{$cputype} ? 32 : 64 if $arch eq 'x86_64';
> +    return 64 if $arch eq 'aarch64';
> +
> +    die "unsupported architecture '$arch'\n";
> +}
> +
>  __PACKAGE__->register();
>  __PACKAGE__->init();
>  


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

Reply via email to