It cannot change while the module is loaded. Also, commit "cpu config:
support aarch64 CPU models" will use the host arch as a hash key,
which is cleaner if no additional function call is required.

Signed-off-by: Fiona Ebner <[email protected]>
---
 src/PVE/QemuServer/CPUConfig.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 825e691a..2825da46 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -9,7 +9,7 @@ use PVE::JSONSchema qw(json_bool);
 use PVE::Cluster qw(cfs_register_file cfs_read_file);
 use PVE::ProcFSTools;
 use PVE::RESTEnvironment qw(log_warn);
-use PVE::Tools qw(run_command get_host_arch);
+use PVE::Tools qw(run_command);
 
 use PVE::QemuServer::Helpers qw(min_version);
 
@@ -25,6 +25,8 @@ our @EXPORT_OK = qw(
     get_cvm_type
 );
 
+my $host_arch = PVE::Tools::get_host_arch();
+
 my $arch_desc = {
     description => "Virtual processor architecture. Defaults to the host 
architecture.",
     type => 'string',
@@ -1016,13 +1018,13 @@ sub get_default_cpu_type {
 
 sub is_native_arch($) {
     my ($arch) = @_;
-    return get_host_arch() eq $arch;
+    return $host_arch eq $arch;
 }
 
 sub get_cpu_bitness {
     my ($cpu_prop_str, $arch) = @_;
 
-    $arch //= get_host_arch();
+    $arch //= $host_arch;
 
     my $cputype = get_default_cpu_type($arch, 0);
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to