all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH common/qemu-server v5 0/5] improve multiarch build support
@ 2026-03-02 14:46 Dominik Csapak
  2026-03-02 14:46 ` [PATCH common v5 1/1] file: add exists and size helper Dominik Csapak
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Dominik Csapak @ 2026-03-02 14:46 UTC (permalink / raw)
  To: pve-devel

Improves multiarch build by improving our mocking capabilities and test.

changes from v4:
* move file helper to PVE::File (pve-common; new patch)
* rename 'get_file_size' to 'file_get_size' (same convention as 'file_get_contents')
* fix a comment that was not true anymore
* improve the 'file_get_size' mocked function (thanks @Fiona)
* add a reset for 'all_cpu_models' in the initialize function
  - should not matter in practice, but could become a bug in the tests.

changes from v3:
* new file helpers for ovmf that get mocked
* changed some comment wording
* require '$arch' in 'get_cpu_models_by_arch'

changes from v2:
* split the first patch up in two
* use the get_host_arch helper everywhere in the package
* use a getter that auto-intiializes the global cpu model list

pve-common:

Dominik Csapak (1):
  file: add exists and size helper

 src/PVE/File.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)


qemu-server:

Dominik Csapak (4):
  ovmf: use helpers that can be mocked for tests
  tests: improve multiarch build support by introducing local
    get_host_arch helper
  tests: improve multiarch build support by allowing re-init of cpu
    models
  tests: cfg2cmd: add some architecture tests

 src/PVE/API2/Qemu/Machine.pm                  |   3 +-
 src/PVE/QemuServer.pm                         |   5 +-
 src/PVE/QemuServer/CPUConfig.pm               | 288 ++++++++++--------
 src/PVE/QemuServer/Helpers.pm                 |   8 +-
 src/PVE/QemuServer/OVMF.pm                    |  24 +-
 src/test/Makefile                             |   5 +-
 src/test/cfg2cmd/aarch64/simple-arm-host.conf |  17 ++
 .../cfg2cmd/aarch64/simple-arm-host.conf.cmd  |  41 +++
 src/test/cfg2cmd/aarch64/simple-arm.conf      |  17 ++
 src/test/cfg2cmd/aarch64/simple-arm.conf.cmd  |  41 +++
 src/test/run_config2command_tests.pl          |  31 +-
 11 files changed, 328 insertions(+), 152 deletions(-)
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm-host.conf
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm-host.conf.cmd
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm.conf
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm.conf.cmd


Summary over all repositories:
  12 files changed, 342 insertions(+), 152 deletions(-)

-- 
Generated by git-murpp 0.8.1




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH common v5 1/1] file: add exists and size helper
  2026-03-02 14:46 [PATCH common/qemu-server v5 0/5] improve multiarch build support Dominik Csapak
@ 2026-03-02 14:46 ` Dominik Csapak
  2026-03-03 21:23   ` applied: " Thomas Lamprecht
  2026-03-02 14:46 ` [PATCH qemu-server v5 1/4] ovmf: use helpers that can be mocked for tests Dominik Csapak
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Dominik Csapak @ 2026-03-02 14:46 UTC (permalink / raw)
  To: pve-devel

Can be used by other modules that need easy mocking in tests.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
new in v5 (split out from first qemu-server patch)

 src/PVE/File.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/PVE/File.pm b/src/PVE/File.pm
index abdf9d7..3fa8643 100644
--- a/src/PVE/File.pm
+++ b/src/PVE/File.pm
@@ -13,8 +13,10 @@ use POSIX qw(EEXIST EOPNOTSUPP);
 use base 'Exporter';
 
 our @EXPORT_OK = qw(
+    file_exists
     file_set_contents
     file_get_contents
+    file_get_size
     file_read_first_line
     file_read_last_line
     dir_glob_regex
@@ -285,4 +287,16 @@ sub dir_glob_foreach($dir, $regex, $func) {
     }
 }
 
+# easier to mock for testing than '-f'.
+sub file_exists {
+    my ($path) = @_;
+    return -f $path;
+}
+
+# easier to mock for testing than '-s'.
+sub file_get_size {
+    my ($path) = @_;
+    return -s $path;
+}
+
 1;
-- 
2.47.3





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH qemu-server v5 1/4] ovmf: use helpers that can be mocked for tests
  2026-03-02 14:46 [PATCH common/qemu-server v5 0/5] improve multiarch build support Dominik Csapak
  2026-03-02 14:46 ` [PATCH common v5 1/1] file: add exists and size helper Dominik Csapak
@ 2026-03-02 14:46 ` Dominik Csapak
  2026-03-02 14:46 ` [PATCH qemu-server v5 2/4] tests: improve multiarch build support by introducing local get_host_arch helper Dominik Csapak
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Dominik Csapak @ 2026-03-02 14:46 UTC (permalink / raw)
  To: pve-devel

This makes it easy for us to mock these in tests, so there is no need
for the files to actually exist during package build.

Makes the edk2-firmware build dependency unnecessary.

Co-developed-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
the proper file_get_size code comes from fiona (Thanks!)

changes from v4:
* use new PVE::File helpers

 src/PVE/QemuServer/OVMF.pm           | 24 +++++++++++++-----------
 src/test/run_config2command_tests.pl | 23 +++++++++++++++++++++++
 2 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/src/PVE/QemuServer/OVMF.pm b/src/PVE/QemuServer/OVMF.pm
index 01b037ef..477a2023 100644
--- a/src/PVE/QemuServer/OVMF.pm
+++ b/src/PVE/QemuServer/OVMF.pm
@@ -5,6 +5,7 @@ use warnings;
 
 use JSON qw(to_json);
 
+use PVE::File qw(file_exists file_get_size);
 use PVE::GuestHelpers qw(safe_string_ne);
 use PVE::RESTEnvironment qw(log_warn);
 use PVE::Storage;
@@ -65,14 +66,14 @@ my sub get_ovmf_files($$$$) {
         if ($cvm_type && $cvm_type eq 'snp') {
             $type = "4m-snp";
             my ($ovmf) = $types->{$type}->@*;
-            die "EFI base image '$ovmf' not found\n" if !-f $ovmf;
+            die "EFI base image '$ovmf' not found\n" if !file_exists($ovmf);
             return ($ovmf);
         } elsif ($cvm_type && ($cvm_type eq 'std' || $cvm_type eq 'es')) {
             $type = "4m-sev";
         } elsif ($cvm_type && $cvm_type eq 'tdx') {
             $type = "4m-tdx";
             my ($ovmf) = $types->{$type}->@*;
-            die "EFI base image '$ovmf' not found\n" if !-f $ovmf;
+            die "EFI base image '$ovmf' not found\n" if !file_exists($ovmf);
             return ($ovmf);
         } elsif (defined($efidisk->{efitype}) && $efidisk->{efitype} eq '4m') {
             $type = $smm ? "4m" : "4m-no-smm";
@@ -83,8 +84,8 @@ my sub get_ovmf_files($$$$) {
     }
 
     my ($ovmf_code, $ovmf_vars) = $types->{$type}->@*;
-    die "EFI base image '$ovmf_code' not found\n" if !-f $ovmf_code;
-    die "EFI vars image '$ovmf_vars' not found\n" if !-f $ovmf_vars;
+    die "EFI base image '$ovmf_code' not found\n" if !file_exists($ovmf_code);
+    die "EFI vars image '$ovmf_vars' not found\n" if !file_exists($ovmf_vars);
 
     return ($ovmf_code, $ovmf_vars);
 }
@@ -103,6 +104,7 @@ my sub print_ovmf_drive_commandlines {
         if $cvm_type && $cvm_type eq 'tdx';
 
     my ($ovmf_code, $ovmf_vars) = get_ovmf_files($arch, $d, $q35, $cvm_type);
+    my $ovmf_vars_size = file_get_size($ovmf_vars);
 
     my $var_drive_str = "if=pflash,unit=1,id=drive-efidisk0";
     if ($d) {
@@ -121,15 +123,15 @@ my sub print_ovmf_drive_commandlines {
         }
         $var_drive_str .= ",format=$format,file=$path";
 
-        $var_drive_str .= ",size=" . (-s $ovmf_vars)
+        $var_drive_str .= ",size=" . $ovmf_vars_size
             if $format eq 'raw' && $version_guard->(4, 1, 2);
         $var_drive_str .= ',readonly=on' if $readonly;
     } else {
         log_warn("no efidisk configured! Using temporary efivars disk.");
         my $path = "/tmp/$vmid-ovmf.fd";
-        PVE::Tools::file_copy($ovmf_vars, $path, -s $ovmf_vars);
+        PVE::Tools::file_copy($ovmf_vars, $path, $ovmf_vars_size);
         $var_drive_str .= ",format=raw,file=$path";
-        $var_drive_str .= ",size=" . (-s $ovmf_vars) if $version_guard->(4, 1, 2);
+        $var_drive_str .= ",size=" . $ovmf_vars_size if $version_guard->(4, 1, 2);
     }
 
     return ("if=pflash,unit=0,format=raw,readonly=on,file=$ovmf_code", $var_drive_str);
@@ -139,7 +141,7 @@ sub get_efivars_size {
     my ($arch, $efidisk, $smm, $cvm_type) = @_;
 
     my (undef, $ovmf_vars) = get_ovmf_files($arch, $efidisk, $smm, $cvm_type);
-    return -s $ovmf_vars;
+    return file_get_size($ovmf_vars);
 }
 
 my sub is_ms_2023_cert_enrolled {
@@ -171,7 +173,7 @@ sub create_efidisk($$$$$$$$) {
 
     my (undef, $ovmf_vars) = get_ovmf_files($arch, $efidisk, $smm, $cvm_type);
 
-    my $vars_size_b = -s $ovmf_vars;
+    my $vars_size_b = file_get_size($ovmf_vars);
     my $vars_size = PVE::Tools::convert_size($vars_size_b, 'b' => 'kb');
     my $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, undef, $vars_size);
     PVE::Storage::activate_volumes($storecfg, [$volid]);
@@ -219,7 +221,7 @@ my sub generate_ovmf_blockdev {
     } else {
         log_warn("no efidisk configured! Using temporary efivars disk.");
         my $path = "/tmp/$vmid-ovmf.fd";
-        PVE::Tools::file_copy($ovmf_vars, $path, -s $ovmf_vars);
+        PVE::Tools::file_copy($ovmf_vars, $path, file_get_size($ovmf_vars));
         $drive = { file => $path, interface => 'efidisk', index => 0 };
         $format = 'raw';
     }
@@ -231,7 +233,7 @@ my sub generate_ovmf_blockdev {
     my $extra_blockdev_options = {};
     $extra_blockdev_options->{'read-only'} = 1 if $readonly;
 
-    $extra_blockdev_options->{size} = -s $ovmf_vars if $format eq 'raw';
+    $extra_blockdev_options->{size} = file_get_size($ovmf_vars) if $format eq 'raw';
 
     my $throttle_group = PVE::QemuServer::Blockdev::generate_throttle_group($drive);
 
diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl
index 4c872d1c..aca9765a 100755
--- a/src/test/run_config2command_tests.pl
+++ b/src/test/run_config2command_tests.pl
@@ -19,6 +19,7 @@ use PVE::QemuServer;
 use PVE::QemuServer::Drive;
 use PVE::QemuServer::Helpers;
 use PVE::QemuServer::Monitor;
+use PVE::QemuServer::OVMF;
 use PVE::QemuServer::QMPHelpers;
 use PVE::QemuServer::CPUConfig;
 use PVE::Storage;
@@ -264,6 +265,28 @@ $qemu_server_module->mock(
     },
 );
 
+my $qemu_server_ovmf_module = Test::MockModule->new("PVE::QemuServer::OVMF");
+$qemu_server_ovmf_module->mock(
+    file_exists => sub {
+        my ($path) = @_;
+        return 1;
+    },
+    file_get_size => sub {
+        my ($path) = @_;
+        if ($path =~ m/OVMF(32)?_(SEV_)?VARS_4M/) {
+            return 528 * 1024;
+        } elsif ($path =~ m/OVMF_VARS/) {
+            return 128 * 1024;
+        } elsif ($path =~ m/AAVMF_VARS/) {
+            return 64 * 1024 * 1024;
+        } elsif ($path =~ m/RISCV_VIRT_VARS/) {
+            return 32 * 1024 * 1024;
+        } else {
+            die "unknown ovmf vars image '$path' - implement me";
+        }
+    },
+);
+
 my $storage_module = Test::MockModule->new("PVE::Storage");
 $storage_module->mock(
     activate_volumes => sub {
-- 
2.47.3





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH qemu-server v5 2/4] tests: improve multiarch build support by introducing local get_host_arch helper
  2026-03-02 14:46 [PATCH common/qemu-server v5 0/5] improve multiarch build support Dominik Csapak
  2026-03-02 14:46 ` [PATCH common v5 1/1] file: add exists and size helper Dominik Csapak
  2026-03-02 14:46 ` [PATCH qemu-server v5 1/4] ovmf: use helpers that can be mocked for tests Dominik Csapak
@ 2026-03-02 14:46 ` Dominik Csapak
  2026-03-02 14:46 ` [PATCH qemu-server v5 3/4] tests: improve multiarch build support by allowing re-init of cpu models Dominik Csapak
  2026-03-02 14:46 ` [PATCH qemu-server v5 4/4] tests: cfg2cmd: add some architecture tests Dominik Csapak
  4 siblings, 0 replies; 7+ messages in thread
From: Dominik Csapak @ 2026-03-02 14:46 UTC (permalink / raw)
  To: pve-devel

Since mocking imported functions have to be done for each package that
imports them, we would have to mock get_host_arch for each package that
imports it from PVE::Tools. Instead, introduce one local helper here
that uses the function from PVE::Tools. This allows us to only need to
override it one time.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
---
no intended changes

 src/PVE/API2/Qemu/Machine.pm         |  3 ++-
 src/PVE/QemuServer.pm                |  5 ++---
 src/PVE/QemuServer/CPUConfig.pm      | 12 ++++++------
 src/PVE/QemuServer/Helpers.pm        |  8 +++++++-
 src/test/run_config2command_tests.pl |  6 +++---
 5 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/PVE/API2/Qemu/Machine.pm b/src/PVE/API2/Qemu/Machine.pm
index 26195eae..adc36d49 100644
--- a/src/PVE/API2/Qemu/Machine.pm
+++ b/src/PVE/API2/Qemu/Machine.pm
@@ -7,9 +7,10 @@ use JSON;
 
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::RESTHandler;
-use PVE::Tools qw(extract_param file_get_contents get_host_arch);
+use PVE::Tools qw(extract_param file_get_contents);
 
 use PVE::QemuServer::Machine;
+use PVE::QemuServer::Helpers qw(get_host_arch);
 
 use base qw(PVE::RESTHandler);
 
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index dbcd8841..2376a164 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -46,8 +46,7 @@ use PVE::SafeSyslog;
 use PVE::Storage;
 use PVE::SysFSTools;
 use PVE::Systemd;
-use PVE::Tools
-    qw(run_command file_read_firstline file_get_contents dir_glob_foreach get_host_arch $IPV6RE);
+use PVE::Tools qw(run_command file_read_firstline file_get_contents dir_glob_foreach $IPV6RE);
 
 use PVE::QMPClient;
 use PVE::QemuConfig;
@@ -58,7 +57,7 @@ use PVE::QemuServer::Blockdev;
 use PVE::QemuServer::BlockJob;
 use PVE::QemuServer::Cfg2Cmd;
 use PVE::QemuServer::Helpers
-    qw(config_aware_timeout get_iscsi_initiator_name min_version kvm_user_version windows_version);
+    qw(config_aware_timeout get_iscsi_initiator_name get_host_arch min_version kvm_user_version windows_version);
 use PVE::QemuServer::Cloudinit;
 use PVE::QemuServer::CGroup;
 use PVE::QemuServer::CPUConfig qw(
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 32ec4954..0218908e 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -11,7 +11,7 @@ use PVE::ProcFSTools;
 use PVE::RESTEnvironment qw(log_warn);
 use PVE::Tools qw(run_command);
 
-use PVE::QemuServer::Helpers qw(min_version);
+use PVE::QemuServer::Helpers qw(min_version get_host_arch);
 
 use base qw(PVE::SectionConfig Exporter);
 
@@ -25,7 +25,7 @@ our @EXPORT_OK = qw(
     get_cvm_type
 );
 
-my $host_arch = PVE::Tools::get_host_arch();
+my $host_arch = get_host_arch();
 
 my $arch_desc = {
     description => "Virtual processor architecture. Defaults to the host architecture.",
@@ -294,7 +294,7 @@ my $supported_cpu_flags_by_arch = {
 
 sub get_supported_cpu_flags {
     my ($arch) = @_;
-    $arch = $host_arch if !defined($arch);
+    $arch = get_host_arch() if !defined($arch);
     return $supported_cpu_flags_by_arch->{$arch};
 }
 
@@ -582,7 +582,7 @@ sub add_cpu_json_properties {
 sub get_cpu_models {
     my ($include_custom, $arch) = @_;
 
-    $arch = $host_arch if !defined($arch);
+    $arch = get_host_arch() if !defined($arch);
     my $cpu_vendor_list = $cpu_models_by_arch->{$arch};
 
     my $models = [];
@@ -1077,13 +1077,13 @@ sub get_default_cpu_type {
 
 sub is_native_arch($) {
     my ($arch) = @_;
-    return $host_arch eq $arch;
+    return get_host_arch() eq $arch;
 }
 
 sub get_cpu_bitness {
     my ($cpu_prop_str, $arch) = @_;
 
-    $arch //= $host_arch;
+    $arch //= get_host_arch();
 
     my $cputype = get_default_cpu_type($arch, 0);
 
diff --git a/src/PVE/QemuServer/Helpers.pm b/src/PVE/QemuServer/Helpers.pm
index 35c00754..e14e9ad4 100644
--- a/src/PVE/QemuServer/Helpers.pm
+++ b/src/PVE/QemuServer/Helpers.pm
@@ -10,7 +10,7 @@ use JSON;
 use PVE::Cluster;
 use PVE::INotify;
 use PVE::ProcFSTools;
-use PVE::Tools qw(get_host_arch);
+use PVE::Tools;
 
 use base 'Exporter';
 our @EXPORT_OK = qw(
@@ -20,6 +20,7 @@ our @EXPORT_OK = qw(
     kvm_user_version
     parse_number_sets
     windows_version
+    get_host_arch
 );
 
 my $nodename = PVE::INotify::nodename();
@@ -29,6 +30,11 @@ my $arch_to_qemu_binary = {
     x86_64 => '/usr/bin/qemu-system-x86_64',
 };
 
+# wrapper around the Tools helper, having it here makes it easier to mock for testing
+sub get_host_arch {
+    return PVE::Tools::get_host_arch();
+}
+
 sub get_command_for_arch($) {
     my ($arch) = @_;
     return '/usr/bin/kvm' if get_host_arch() eq $arch; # i.e. native arch
diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl
index aca9765a..1339c886 100755
--- a/src/test/run_config2command_tests.pl
+++ b/src/test/run_config2command_tests.pl
@@ -254,9 +254,6 @@ $qemu_server_module->mock(
     kernel_has_vhost_net => sub {
         return 1; # TODO: make this per-test configurable?
     },
-    get_host_arch => sub() {
-        return $current_test->{host_arch} // 'x86_64';
-    },
     get_iscsi_initiator_name => sub {
         return 'iqn.1993-08.org.debian:01:aabbccddeeff';
     },
@@ -411,6 +408,9 @@ $pve_common_tools->mock(
             },
         );
     },
+    get_host_arch => sub {
+        return $current_test->{host_arch} // 'x86_64';
+    },
 );
 
 my $pve_cpuconfig;
-- 
2.47.3





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH qemu-server v5 3/4] tests: improve multiarch build support by allowing re-init of cpu models
  2026-03-02 14:46 [PATCH common/qemu-server v5 0/5] improve multiarch build support Dominik Csapak
                   ` (2 preceding siblings ...)
  2026-03-02 14:46 ` [PATCH qemu-server v5 2/4] tests: improve multiarch build support by introducing local get_host_arch helper Dominik Csapak
@ 2026-03-02 14:46 ` Dominik Csapak
  2026-03-02 14:46 ` [PATCH qemu-server v5 4/4] tests: cfg2cmd: add some architecture tests Dominik Csapak
  4 siblings, 0 replies; 7+ messages in thread
From: Dominik Csapak @ 2026-03-02 14:46 UTC (permalink / raw)
  To: pve-devel

instead of simply saving 'host_arch','all_cpu_models' and
'cpu_models_by_arch' in the global package namespace, after initializing
directly in the module, use an initialization function and a getter to
generate this.

This has two advantages:
* Only the first use actually fills the package wide variable
  (currently the $cpu_fmt uses this on module load)
* We can call the initialization manually in the tests where we need it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
note: dropped the r-b trailer from fiona since it changed a bit
changes from v4:
* add a "reset" to all_cpu_models in the initializer
* fix comments/typos
* add a missing call to 'get_all_cpu_models' 'validate_vm_cpu_conf'

 src/PVE/QemuServer/CPUConfig.pm      | 278 +++++++++++++++------------
 src/test/run_config2command_tests.pl |   2 +
 2 files changed, 153 insertions(+), 127 deletions(-)

diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 0218908e..6bec6e6d 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -25,8 +25,6 @@ our @EXPORT_OK = qw(
     get_cvm_type
 );
 
-my $host_arch = get_host_arch();
-
 my $arch_desc = {
     description => "Virtual processor architecture. Defaults to the host architecture.",
     type => 'string',
@@ -100,130 +98,153 @@ my $cputypes_32bit = {
     'qemu32' => 1,
 };
 
-my $cpu_models_by_arch = {
-    x86_64 => {
-        # Intel CPUs
-        486 => 'GenuineIntel',
-        pentium => 'GenuineIntel',
-        pentium2 => 'GenuineIntel',
-        pentium3 => 'GenuineIntel',
-        coreduo => 'GenuineIntel',
-        core2duo => 'GenuineIntel',
-        Conroe => 'GenuineIntel',
-        Penryn => 'GenuineIntel',
-        Nehalem => 'GenuineIntel',
-        'Nehalem-IBRS' => 'GenuineIntel',
-        Westmere => 'GenuineIntel',
-        'Westmere-IBRS' => 'GenuineIntel',
-        SandyBridge => 'GenuineIntel',
-        'SandyBridge-IBRS' => 'GenuineIntel',
-        IvyBridge => 'GenuineIntel',
-        'IvyBridge-IBRS' => 'GenuineIntel',
-        Haswell => 'GenuineIntel',
-        'Haswell-IBRS' => 'GenuineIntel',
-        'Haswell-noTSX' => 'GenuineIntel',
-        'Haswell-noTSX-IBRS' => 'GenuineIntel',
-        Broadwell => 'GenuineIntel',
-        'Broadwell-IBRS' => 'GenuineIntel',
-        'Broadwell-noTSX' => 'GenuineIntel',
-        'Broadwell-noTSX-IBRS' => 'GenuineIntel',
-        'Skylake-Client' => 'GenuineIntel',
-        'Skylake-Client-IBRS' => 'GenuineIntel',
-        'Skylake-Client-noTSX-IBRS' => 'GenuineIntel',
-        'Skylake-Client-v4' => 'GenuineIntel',
-        'Skylake-Server' => 'GenuineIntel',
-        'Skylake-Server-IBRS' => 'GenuineIntel',
-        'Skylake-Server-noTSX-IBRS' => 'GenuineIntel',
-        'Skylake-Server-v4' => 'GenuineIntel',
-        'Skylake-Server-v5' => 'GenuineIntel',
-        'Cascadelake-Server' => 'GenuineIntel',
-        'Cascadelake-Server-v2' => 'GenuineIntel',
-        'Cascadelake-Server-noTSX' => 'GenuineIntel',
-        'Cascadelake-Server-v4' => 'GenuineIntel',
-        'Cascadelake-Server-v5' => 'GenuineIntel',
-        'Cooperlake' => 'GenuineIntel',
-        'Cooperlake-v2' => 'GenuineIntel',
-        KnightsMill => 'GenuineIntel',
-        'Icelake-Client' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
-        'Icelake-Client-noTSX' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
-        'Icelake-Server' => 'GenuineIntel',
-        'Icelake-Server-noTSX' => 'GenuineIntel',
-        'Icelake-Server-v3' => 'GenuineIntel',
-        'Icelake-Server-v4' => 'GenuineIntel',
-        'Icelake-Server-v5' => 'GenuineIntel',
-        'Icelake-Server-v6' => 'GenuineIntel',
-        'Icelake-Server-v7' => 'GenuineIntel',
-        'SapphireRapids' => 'GenuineIntel',
-        'SapphireRapids-v2' => 'GenuineIntel',
-        'SapphireRapids-v3' => 'GenuineIntel',
-        'SapphireRapids-v4' => 'GenuineIntel',
-        'GraniteRapids' => 'GenuineIntel',
-        'GraniteRapids-v2' => 'GenuineIntel',
-        'GraniteRapids-v3' => 'GenuineIntel',
-        'SierraForest' => 'GenuineIntel',
-        'SierraForest-v2' => 'GenuineIntel',
-        'SierraForest-v3' => 'GenuineIntel',
-        'ClearwaterForest' => 'GenuineIntel',
-
-        # AMD CPUs
-        athlon => 'AuthenticAMD',
-        phenom => 'AuthenticAMD',
-        Opteron_G1 => 'AuthenticAMD',
-        Opteron_G2 => 'AuthenticAMD',
-        Opteron_G3 => 'AuthenticAMD',
-        Opteron_G4 => 'AuthenticAMD',
-        Opteron_G5 => 'AuthenticAMD',
-        EPYC => 'AuthenticAMD',
-        'EPYC-IBPB' => 'AuthenticAMD',
-        'EPYC-v3' => 'AuthenticAMD',
-        'EPYC-v4' => 'AuthenticAMD',
-        'EPYC-v5' => 'AuthenticAMD',
-        'EPYC-Rome' => 'AuthenticAMD',
-        'EPYC-Rome-v2' => 'AuthenticAMD',
-        'EPYC-Rome-v3' => 'AuthenticAMD',
-        'EPYC-Rome-v4' => 'AuthenticAMD',
-        'EPYC-Rome-v5' => 'AuthenticAMD',
-        'EPYC-Milan' => 'AuthenticAMD',
-        'EPYC-Milan-v2' => 'AuthenticAMD',
-        'EPYC-Milan-v3' => 'AuthenticAMD',
-        'EPYC-Genoa' => 'AuthenticAMD',
-        'EPYC-Genoa-v2' => 'AuthenticAMD',
-        'EPYC-Turin' => 'AuthenticAMD',
-
-        # generic types, use vendor from host node
-        kvm32 => 'default',
-        kvm64 => 'default',
-        qemu32 => 'default',
-        qemu64 => 'default',
-        max => 'default',
-    },
-    aarch64 => {
-        'a64fx' => 'ARM',
-        'cortex-a35' => 'ARM',
-        'cortex-a53' => 'ARM',
-        'cortex-a55' => 'ARM',
-        'cortex-a57' => 'ARM',
-        'cortex-a710' => 'ARM',
-        'cortex-a72' => 'ARM',
-        'cortex-a76' => 'ARM',
-        'neoverse-n1' => 'ARM',
-        'neoverse-n2' => 'ARM',
-        'neoverse-v1' => 'ARM',
-        # 32 bit and deprecated models were not added
-        max => 'default',
-    },
-};
+my $cpu_models_by_arch;
+my $all_cpu_models;
+
+# helper to make it easier for testing
+# initializes both '$cpu_models_by_arch' and '$all_cpu_models'
+sub initialize_cpu_models {
+    $cpu_models_by_arch = {
+        x86_64 => {
+            # Intel CPUs
+            486 => 'GenuineIntel',
+            pentium => 'GenuineIntel',
+            pentium2 => 'GenuineIntel',
+            pentium3 => 'GenuineIntel',
+            coreduo => 'GenuineIntel',
+            core2duo => 'GenuineIntel',
+            Conroe => 'GenuineIntel',
+            Penryn => 'GenuineIntel',
+            Nehalem => 'GenuineIntel',
+            'Nehalem-IBRS' => 'GenuineIntel',
+            Westmere => 'GenuineIntel',
+            'Westmere-IBRS' => 'GenuineIntel',
+            SandyBridge => 'GenuineIntel',
+            'SandyBridge-IBRS' => 'GenuineIntel',
+            IvyBridge => 'GenuineIntel',
+            'IvyBridge-IBRS' => 'GenuineIntel',
+            Haswell => 'GenuineIntel',
+            'Haswell-IBRS' => 'GenuineIntel',
+            'Haswell-noTSX' => 'GenuineIntel',
+            'Haswell-noTSX-IBRS' => 'GenuineIntel',
+            Broadwell => 'GenuineIntel',
+            'Broadwell-IBRS' => 'GenuineIntel',
+            'Broadwell-noTSX' => 'GenuineIntel',
+            'Broadwell-noTSX-IBRS' => 'GenuineIntel',
+            'Skylake-Client' => 'GenuineIntel',
+            'Skylake-Client-IBRS' => 'GenuineIntel',
+            'Skylake-Client-noTSX-IBRS' => 'GenuineIntel',
+            'Skylake-Client-v4' => 'GenuineIntel',
+            'Skylake-Server' => 'GenuineIntel',
+            'Skylake-Server-IBRS' => 'GenuineIntel',
+            'Skylake-Server-noTSX-IBRS' => 'GenuineIntel',
+            'Skylake-Server-v4' => 'GenuineIntel',
+            'Skylake-Server-v5' => 'GenuineIntel',
+            'Cascadelake-Server' => 'GenuineIntel',
+            'Cascadelake-Server-v2' => 'GenuineIntel',
+            'Cascadelake-Server-noTSX' => 'GenuineIntel',
+            'Cascadelake-Server-v4' => 'GenuineIntel',
+            'Cascadelake-Server-v5' => 'GenuineIntel',
+            'Cooperlake' => 'GenuineIntel',
+            'Cooperlake-v2' => 'GenuineIntel',
+            KnightsMill => 'GenuineIntel',
+            'Icelake-Client' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
+            'Icelake-Client-noTSX' => 'GenuineIntel', # depreacated, removed with QEMU 7.1
+            'Icelake-Server' => 'GenuineIntel',
+            'Icelake-Server-noTSX' => 'GenuineIntel',
+            'Icelake-Server-v3' => 'GenuineIntel',
+            'Icelake-Server-v4' => 'GenuineIntel',
+            'Icelake-Server-v5' => 'GenuineIntel',
+            'Icelake-Server-v6' => 'GenuineIntel',
+            'Icelake-Server-v7' => 'GenuineIntel',
+            'SapphireRapids' => 'GenuineIntel',
+            'SapphireRapids-v2' => 'GenuineIntel',
+            'SapphireRapids-v3' => 'GenuineIntel',
+            'SapphireRapids-v4' => 'GenuineIntel',
+            'GraniteRapids' => 'GenuineIntel',
+            'GraniteRapids-v2' => 'GenuineIntel',
+            'GraniteRapids-v3' => 'GenuineIntel',
+            'SierraForest' => 'GenuineIntel',
+            'SierraForest-v2' => 'GenuineIntel',
+            'SierraForest-v3' => 'GenuineIntel',
+            'ClearwaterForest' => 'GenuineIntel',
+
+            # AMD CPUs
+            athlon => 'AuthenticAMD',
+            phenom => 'AuthenticAMD',
+            Opteron_G1 => 'AuthenticAMD',
+            Opteron_G2 => 'AuthenticAMD',
+            Opteron_G3 => 'AuthenticAMD',
+            Opteron_G4 => 'AuthenticAMD',
+            Opteron_G5 => 'AuthenticAMD',
+            EPYC => 'AuthenticAMD',
+            'EPYC-IBPB' => 'AuthenticAMD',
+            'EPYC-v3' => 'AuthenticAMD',
+            'EPYC-v4' => 'AuthenticAMD',
+            'EPYC-v5' => 'AuthenticAMD',
+            'EPYC-Rome' => 'AuthenticAMD',
+            'EPYC-Rome-v2' => 'AuthenticAMD',
+            'EPYC-Rome-v3' => 'AuthenticAMD',
+            'EPYC-Rome-v4' => 'AuthenticAMD',
+            'EPYC-Rome-v5' => 'AuthenticAMD',
+            'EPYC-Milan' => 'AuthenticAMD',
+            'EPYC-Milan-v2' => 'AuthenticAMD',
+            'EPYC-Milan-v3' => 'AuthenticAMD',
+            'EPYC-Genoa' => 'AuthenticAMD',
+            'EPYC-Genoa-v2' => 'AuthenticAMD',
+            'EPYC-Turin' => 'AuthenticAMD',
+
+            # generic types, use vendor from host node
+            kvm32 => 'default',
+            kvm64 => 'default',
+            qemu32 => 'default',
+            qemu64 => 'default',
+            max => 'default',
+        },
+        aarch64 => {
+            'a64fx' => 'ARM',
+            'cortex-a35' => 'ARM',
+            'cortex-a53' => 'ARM',
+            'cortex-a55' => 'ARM',
+            'cortex-a57' => 'ARM',
+            'cortex-a710' => 'ARM',
+            'cortex-a72' => 'ARM',
+            'cortex-a76' => 'ARM',
+            'neoverse-n1' => 'ARM',
+            'neoverse-n2' => 'ARM',
+            'neoverse-v1' => 'ARM',
+            # 32 bit and deprecated models were not added
+            max => 'default',
+        },
+    };
 
-# The host CPU model only exists if the arch matches
-$cpu_models_by_arch->{$host_arch}->{host} = 'default';
+    my $host_arch = get_host_arch();
+    # The host CPU model only exists if the arch matches
+    $cpu_models_by_arch->{$host_arch}->{host} = 'default';
 
-my $all_cpu_models;
-for my $arch (keys $cpu_models_by_arch->%*) {
-    for my $model (keys $cpu_models_by_arch->{$arch}->%*) {
-        $all_cpu_models->{$model} = $cpu_models_by_arch->{$arch}->{$model};
+    $all_cpu_models = {};
+    for my $arch (keys $cpu_models_by_arch->%*) {
+        for my $model (keys $cpu_models_by_arch->{$arch}->%*) {
+            $all_cpu_models->{$model} = $cpu_models_by_arch->{$arch}->{$model};
+        }
     }
 }
 
+# returns the cpu models for the given architecture
+sub get_cpu_models_by_arch {
+    my ($arch) = @_;
+    die "no arch given" if !defined($arch);
+
+    initialize_cpu_models() if !defined($cpu_models_by_arch);
+    return $cpu_models_by_arch->{$arch};
+}
+
+# returns a map of all available cpu models regardless of architecture
+sub get_all_cpu_models {
+    initialize_cpu_models() if !defined($all_cpu_models);
+    return $all_cpu_models;
+}
+
 my $supported_cpu_flags_by_arch = {
     x86_64 => [
         {
@@ -325,7 +346,7 @@ my $cpu_fmt = {
             "CPU model and vendor to report to the guest. Must be a QEMU/KVM supported model."
             . " Only valid for custom CPU model definitions, default models will always report themselves to the guest OS.",
         type => 'string',
-        enum => [sort { lc("$a") cmp lc("$b") } keys $all_cpu_models->%*],
+        enum => [sort { lc("$a") cmp lc("$b") } keys get_all_cpu_models()->%*],
         default => 'kvm64',
         optional => 1,
     },
@@ -490,7 +511,10 @@ sub validate_vm_cpu_conf {
     if (is_custom_model($cputype)) {
         # dies on unknown model
         get_custom_model($cputype);
-    } elsif (!defined($all_cpu_models->{$cputype}) && !defined($all_builtin_models->{$cputype})) {
+    } elsif (
+        !defined(get_all_cpu_models()->{$cputype})
+        && !defined($all_builtin_models->{$cputype})
+    ) {
         die "Built-in cputype '$cputype' is not defined (missing 'custom-' prefix?)\n";
     }
 
@@ -583,7 +607,7 @@ sub get_cpu_models {
     my ($include_custom, $arch) = @_;
 
     $arch = get_host_arch() if !defined($arch);
-    my $cpu_vendor_list = $cpu_models_by_arch->{$arch};
+    my $cpu_vendor_list = get_cpu_models_by_arch($arch);
 
     my $models = [];
 
@@ -614,7 +638,7 @@ sub get_cpu_models {
     for my $custom_model (keys %{ $conf->{ids} }) {
         my $reported_model = $conf->{ids}->{$custom_model}->{'reported-model'};
         $reported_model //= $cpu_fmt->{'reported-model'}->{default};
-        my $vendor = $all_cpu_models->{$reported_model};
+        my $vendor = get_all_cpu_models()->{$reported_model};
         push @$models,
             {
                 name => "custom-$custom_model",
@@ -870,7 +894,7 @@ sub get_cpu_options {
     }
 
     die "CPU model '$cputype' does not exist for configured vCPU architecture '$arch'\n"
-        if !defined($cpu_models_by_arch->{$arch}->{$cputype});
+        if !defined(get_cpu_models_by_arch($arch)->{$cputype});
 
     my $pve_flags = get_pve_cpu_flags($conf, $kvm, $cputype, $arch, $machine_version);
 
@@ -910,7 +934,7 @@ sub get_cpu_options {
     if ($arch eq 'x86_64') {
         # $cputype is the "reported-model" for custom types, so we can just look up
         # the vendor in the default list
-        my $cpu_vendor = $cpu_models_by_arch->{$arch}->{$cputype} or die "internal error";
+        my $cpu_vendor = get_cpu_models_by_arch($arch)->{$cputype} or die "internal error";
         $pve_forced_flags->{'vendor'} = { value => $cpu_vendor } if $cpu_vendor ne 'default';
     }
 
diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl
index 1339c886..f7f3a2d5 100755
--- a/src/test/run_config2command_tests.pl
+++ b/src/test/run_config2command_tests.pl
@@ -236,6 +236,8 @@ sub parse_test($config_fn) {
         $testname = "'$testname' - $desc";
     }
     $current_test->{testname} = $testname;
+
+    PVE::QemuServer::CPUConfig::initialize_cpu_models();
 }
 
 sub get_test_qemu_version {
-- 
2.47.3





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH qemu-server v5 4/4] tests: cfg2cmd: add some architecture tests
  2026-03-02 14:46 [PATCH common/qemu-server v5 0/5] improve multiarch build support Dominik Csapak
                   ` (3 preceding siblings ...)
  2026-03-02 14:46 ` [PATCH qemu-server v5 3/4] tests: improve multiarch build support by allowing re-init of cpu models Dominik Csapak
@ 2026-03-02 14:46 ` Dominik Csapak
  4 siblings, 0 replies; 7+ messages in thread
From: Dominik Csapak @ 2026-03-02 14:46 UTC (permalink / raw)
  To: pve-devel

one for manually setting
  arch: aarch64

in the config for an 'x86_64' host architecture, and one where
we don't have 'arch' set in the config on an aarch64 host.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
---
changes from v4:
* changed the disk image in one test to be constistent (used disk-0 for
  both disk and efidisk before)
 src/test/Makefile                             |  5 ++-
 src/test/cfg2cmd/aarch64/simple-arm-host.conf | 17 ++++++++
 .../cfg2cmd/aarch64/simple-arm-host.conf.cmd  | 41 +++++++++++++++++++
 src/test/cfg2cmd/aarch64/simple-arm.conf      | 17 ++++++++
 src/test/cfg2cmd/aarch64/simple-arm.conf.cmd  | 41 +++++++++++++++++++
 5 files changed, 120 insertions(+), 1 deletion(-)
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm-host.conf
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm-host.conf.cmd
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm.conf
 create mode 100644 src/test/cfg2cmd/aarch64/simple-arm.conf.cmd

diff --git a/src/test/Makefile b/src/test/Makefile
index 2ef9073a..cf589f41 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,6 @@
 all: test
 
-test: test_snapshot test_cfg_to_cmd test_pci_addr_conflicts test_pci_reservation test_qemu_img_convert test_migration test_restore_config test_parse_config
+test: test_snapshot test_cfg_to_cmd test_cfg_to_cmd_aarch64 test_pci_addr_conflicts test_pci_reservation test_qemu_img_convert test_migration test_restore_config test_parse_config
 
 test_snapshot: run_snapshot_tests.pl
 	./run_snapshot_tests.pl
@@ -9,6 +9,9 @@ test_snapshot: run_snapshot_tests.pl
 test_cfg_to_cmd: run_config2command_tests.pl cfg2cmd/*.conf
 	perl -I../ ./run_config2command_tests.pl
 
+test_cfg_to_cmd_aarch64: run_config2command_tests.pl cfg2cmd/aarch64/*.conf
+	perl -I../ ./run_config2command_tests.pl cfg2cmd/aarch64
+
 test_qemu_img_convert: run_qemu_img_convert_tests.pl
 	perl -I../ ./run_qemu_img_convert_tests.pl
 
diff --git a/src/test/cfg2cmd/aarch64/simple-arm-host.conf b/src/test/cfg2cmd/aarch64/simple-arm-host.conf
new file mode 100644
index 00000000..1488dbf5
--- /dev/null
+++ b/src/test/cfg2cmd/aarch64/simple-arm-host.conf
@@ -0,0 +1,17 @@
+# TEST: Simple test for a basic configuration with aarch64 set as the host architecture
+# HOST_ARCH: aarch64
+bootdisk: scsi0
+bios: ovmf
+cores: 3
+ide2: none,media=cdrom
+memory: 768
+name: simple
+net0: virtio=A2:C0:43:77:08:A0,bridge=vmbr0
+numa: 0
+ostype: l26
+scsi0: local:8006/vm-8006-disk-0.qcow2,discard=on,size=104858K
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+sockets: 1
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+efidisk0: local:8006/vm-8006-disk-1.qcow2,efitype=4m
diff --git a/src/test/cfg2cmd/aarch64/simple-arm-host.conf.cmd b/src/test/cfg2cmd/aarch64/simple-arm-host.conf.cmd
new file mode 100644
index 00000000..bf7443ab
--- /dev/null
+++ b/src/test/cfg2cmd/aarch64/simple-arm-host.conf.cmd
@@ -0,0 +1,41 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'simple,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+  -object '{"id":"throttle-drive-efidisk0","limits":{},"qom-type":"throttle-group"}' \
+  -blockdev '{"driver":"raw","file":{"driver":"file","filename":"/usr/share/pve-edk2-firmware//AAVMF_CODE.fd"},"node-name":"pflash0","read-only":true}' \
+  -blockdev '{"detect-zeroes":"on","discard":"ignore","driver":"throttle","file":{"cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"qcow2","file":{"aio":"io_uring","cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"file","filename":"/var/lib/vz/images/8006/vm-8006-disk-1.qcow2","node-name":"e4abf08bba72d3a54b87a58d2f50906","read-only":false},"node-name":"f4abf08bba72d3a54b87a58d2f50906","read-only":false},"node-name":"drive-efidisk0","read-only":false,"throttle-group":"throttle-drive-efidisk0"}' \
+  -smp '3,sockets=1,cores=3,maxcpus=3' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu cortex-a57 \
+  -m 768 \
+  -object '{"id":"throttle-drive-scsi0","limits":{},"qom-type":"throttle-group"}' \
+  -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pcie.0,addr=0x1e' \
+  -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pcie.0,addr=0x1f' \
+  -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \
+  -device 'usb-ehci,id=ehci,bus=pcie.0,addr=0x1' \
+  -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \
+  -device 'usb-kbd,id=keyboard,bus=ehci.0,port=2' \
+  -device 'virtio-gpu,id=vga,bus=pcie.0,addr=0x2' \
+  -device 'virtio-serial,id=spice,bus=pcie.0,addr=0x9' \
+  -chardev 'spicevmc,id=vdagent,name=vdagent' \
+  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
+  -spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -device 'ide-cd,bus=ide.1,unit=0,id=ide2,bootindex=200' \
+  -device 'virtio-scsi-pci,id=scsihw0,bus=pcie.0,addr=0x5' \
+  -blockdev '{"detect-zeroes":"unmap","discard":"unmap","driver":"throttle","file":{"cache":{"direct":true,"no-flush":false},"detect-zeroes":"unmap","discard":"unmap","driver":"qcow2","file":{"aio":"io_uring","cache":{"direct":true,"no-flush":false},"detect-zeroes":"unmap","discard":"unmap","driver":"file","filename":"/var/lib/vz/images/8006/vm-8006-disk-0.qcow2","node-name":"ecd04be4259153b8293415fefa2a84c","read-only":false},"node-name":"fcd04be4259153b8293415fefa2a84c","read-only":false},"node-name":"drive-scsi0","read-only":false,"throttle-group":"throttle-drive-scsi0"}' \
+  -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,device_id=drive-scsi0,bootindex=100,write-cache=on' \
+  -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on' \
+  -device 'virtio-net-pci,mac=A2:C0:43:77:08:A0,netdev=net0,bus=pcie.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=256,bootindex=300,host_mtu=1500' \
+  -machine 'pflash0=pflash0,pflash1=drive-efidisk0,type=virt+pve0'
diff --git a/src/test/cfg2cmd/aarch64/simple-arm.conf b/src/test/cfg2cmd/aarch64/simple-arm.conf
new file mode 100644
index 00000000..975c9a17
--- /dev/null
+++ b/src/test/cfg2cmd/aarch64/simple-arm.conf
@@ -0,0 +1,17 @@
+# TEST: Simple test for a basic configuration with aarch64 set as architecture
+arch: aarch64
+bootdisk: scsi0
+bios: ovmf
+cores: 3
+ide2: none,media=cdrom
+memory: 768
+name: simple
+net0: virtio=A2:C0:43:77:08:A0,bridge=vmbr0
+numa: 0
+ostype: l26
+scsi0: local:8006/vm-8006-disk-0.qcow2,discard=on,size=104858K
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+sockets: 1
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+efidisk0: local:8006/vm-8006-disk-1.qcow2,efitype=4m
diff --git a/src/test/cfg2cmd/aarch64/simple-arm.conf.cmd b/src/test/cfg2cmd/aarch64/simple-arm.conf.cmd
new file mode 100644
index 00000000..2f0d8de8
--- /dev/null
+++ b/src/test/cfg2cmd/aarch64/simple-arm.conf.cmd
@@ -0,0 +1,41 @@
+/usr/bin/qemu-system-aarch64 \
+  -id 8006 \
+  -name 'simple,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -mon 'chardev=qmp,mode=control' \
+  -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \
+  -mon 'chardev=qmp-event,mode=control' \
+  -pidfile /var/run/qemu-server/8006.pid \
+  -daemonize \
+  -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \
+  -object '{"id":"throttle-drive-efidisk0","limits":{},"qom-type":"throttle-group"}' \
+  -blockdev '{"driver":"raw","file":{"driver":"file","filename":"/usr/share/pve-edk2-firmware//AAVMF_CODE.fd"},"node-name":"pflash0","read-only":true}' \
+  -blockdev '{"detect-zeroes":"on","discard":"ignore","driver":"throttle","file":{"cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"qcow2","file":{"aio":"io_uring","cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"file","filename":"/var/lib/vz/images/8006/vm-8006-disk-1.qcow2","node-name":"e4abf08bba72d3a54b87a58d2f50906","read-only":false},"node-name":"f4abf08bba72d3a54b87a58d2f50906","read-only":false},"node-name":"drive-efidisk0","read-only":false,"throttle-group":"throttle-drive-efidisk0"}' \
+  -smp '3,sockets=1,cores=3,maxcpus=3' \
+  -nodefaults \
+  -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \
+  -cpu cortex-a57 \
+  -m 768 \
+  -object '{"id":"throttle-drive-scsi0","limits":{},"qom-type":"throttle-group"}' \
+  -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pcie.0,addr=0x1e' \
+  -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pcie.0,addr=0x1f' \
+  -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \
+  -device 'usb-ehci,id=ehci,bus=pcie.0,addr=0x1' \
+  -device 'usb-tablet,id=tablet,bus=ehci.0,port=1' \
+  -device 'usb-kbd,id=keyboard,bus=ehci.0,port=2' \
+  -device 'virtio-gpu,id=vga,bus=pcie.0,addr=0x2' \
+  -device 'virtio-serial,id=spice,bus=pcie.0,addr=0x9' \
+  -chardev 'spicevmc,id=vdagent,name=vdagent' \
+  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
+  -spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -device 'ide-cd,bus=ide.1,unit=0,id=ide2,bootindex=200' \
+  -device 'virtio-scsi-pci,id=scsihw0,bus=pcie.0,addr=0x5' \
+  -blockdev '{"detect-zeroes":"unmap","discard":"unmap","driver":"throttle","file":{"cache":{"direct":true,"no-flush":false},"detect-zeroes":"unmap","discard":"unmap","driver":"qcow2","file":{"aio":"io_uring","cache":{"direct":true,"no-flush":false},"detect-zeroes":"unmap","discard":"unmap","driver":"file","filename":"/var/lib/vz/images/8006/vm-8006-disk-0.qcow2","node-name":"ecd04be4259153b8293415fefa2a84c","read-only":false},"node-name":"fcd04be4259153b8293415fefa2a84c","read-only":false},"node-name":"drive-scsi0","read-only":false,"throttle-group":"throttle-drive-scsi0"}' \
+  -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,device_id=drive-scsi0,bootindex=100,write-cache=on' \
+  -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown' \
+  -device 'virtio-net-pci,mac=A2:C0:43:77:08:A0,netdev=net0,bus=pcie.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=256,bootindex=300,host_mtu=1500' \
+  -machine 'pflash0=pflash0,pflash1=drive-efidisk0,accel=tcg,type=virt+pve0'
-- 
2.47.3





^ permalink raw reply	[flat|nested] 7+ messages in thread

* applied: [PATCH common v5 1/1] file: add exists and size helper
  2026-03-02 14:46 ` [PATCH common v5 1/1] file: add exists and size helper Dominik Csapak
@ 2026-03-03 21:23   ` Thomas Lamprecht
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Lamprecht @ 2026-03-03 21:23 UTC (permalink / raw)
  To: pve-devel, Dominik Csapak

On Mon, 02 Mar 2026 15:46:34 +0100, Dominik Csapak wrote:
> Can be used by other modules that need easy mocking in tests.
> 
> 

Applied, but leveraged v5.36 perl feautres available in this new module by
using a "real" signature and also added some basic test for the new methods to
the existing harness, thanks!

[1/1] file: add exists and size helper
      commit: 8d3fd61668755c1fb788ceaf7cfb9edb1d270a1e




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-03 21:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 14:46 [PATCH common/qemu-server v5 0/5] improve multiarch build support Dominik Csapak
2026-03-02 14:46 ` [PATCH common v5 1/1] file: add exists and size helper Dominik Csapak
2026-03-03 21:23   ` applied: " Thomas Lamprecht
2026-03-02 14:46 ` [PATCH qemu-server v5 1/4] ovmf: use helpers that can be mocked for tests Dominik Csapak
2026-03-02 14:46 ` [PATCH qemu-server v5 2/4] tests: improve multiarch build support by introducing local get_host_arch helper Dominik Csapak
2026-03-02 14:46 ` [PATCH qemu-server v5 3/4] tests: improve multiarch build support by allowing re-init of cpu models Dominik Csapak
2026-03-02 14:46 ` [PATCH qemu-server v5 4/4] tests: cfg2cmd: add some architecture tests Dominik Csapak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal