From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v3 06/18] move get_vm_arch() helper to helpers module
Date: Fri, 17 Jan 2025 13:08:05 +0100 [thread overview]
Message-ID: <20250117120817.41443-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250117120817.41443-1-f.ebner@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
PVE/API2/Qemu.pm | 4 ++--
PVE/QemuServer.pm | 13 ++++---------
PVE/QemuServer/Helpers.pm | 5 +++++
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 868508e7..2840de1b 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1198,7 +1198,7 @@ __PACKAGE__->register_method({
my $realcmd = sub {
my $conf = $param;
- my $arch = PVE::QemuServer::get_vm_arch($conf);
+ my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
for my $opt (sort keys $param->%*) {
next if $opt !~ m/^scsi\d+$/;
@@ -2034,7 +2034,7 @@ my $update_vm_api = sub {
$conf = PVE::QemuConfig->load_config($vmid); # update/reload
next if defined($conf->{pending}->{$opt}) && ($param->{$opt} eq $conf->{pending}->{$opt}); # skip if nothing changed
- my $arch = PVE::QemuServer::get_vm_arch($conf);
+ my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
if (PVE::QemuServer::is_valid_drivename($opt)) {
# old drive
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fd1feada..164cb0e8 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3271,11 +3271,6 @@ sub vga_conf_has_spice {
return $1 || 1;
}
-sub get_vm_arch {
- my ($conf) = @_;
- return $conf->{arch} // get_host_arch();
-}
-
my $default_machines = {
x86_64 => 'pc',
aarch64 => 'virt',
@@ -3590,7 +3585,7 @@ sub config_to_command {
my $machine_conf = PVE::QemuServer::Machine::parse_machine($conf->{machine});
- my $arch = get_vm_arch($conf);
+ my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
my $kvm_binary = PVE::QemuServer::Helpers::get_command_for_arch($arch);
my $kvmver = kvm_user_version($kvm_binary);
@@ -4670,7 +4665,7 @@ sub qemu_cpu_hotplug {
if scalar(@{$currentrunningvcpus}) != $currentvcpus;
if (PVE::QemuServer::Machine::machine_version($machine_type, 2, 7)) {
- my $arch = get_vm_arch($conf);
+ my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
for (my $i = $currentvcpus+1; $i <= $vcpus; $i++) {
my $cpustr = print_cpu_device($conf, $arch, $i);
@@ -4912,7 +4907,7 @@ sub vmconfig_hotplug_pending {
my ($vmid, $conf, $storecfg, $selection, $errors) = @_;
my $defaults = load_defaults();
- my $arch = get_vm_arch($conf);
+ my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
my $machine_type = get_vm_machine($conf, undef, $arch);
# commit values which do not have any impact on running VM first
@@ -8493,7 +8488,7 @@ sub qemu_use_old_bios_files {
sub get_efivars_size {
my ($conf, $efidisk) = @_;
- my $arch = get_vm_arch($conf);
+ my $arch = PVE::QemuServer::Helpers::get_vm_arch($conf);
$efidisk //= $conf->{efidisk0} ? parse_drive('efidisk0', $conf->{efidisk0}) : undef;
my $smm = PVE::QemuServer::Machine::machine_type_is_q35($conf);
my (undef, $ovmf_vars) = get_ovmf_files($arch, $efidisk, $smm);
diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm
index 07b2ff6e..8e9f4fc0 100644
--- a/PVE/QemuServer/Helpers.pm
+++ b/PVE/QemuServer/Helpers.pm
@@ -34,6 +34,11 @@ sub get_command_for_arch($) {
return $cmd;
}
+sub get_vm_arch {
+ my ($conf) = @_;
+ return $conf->{arch} // get_host_arch();
+}
+
my $kvm_user_version = {};
my $kvm_mtime = {};
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-01-17 12:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 12:07 [pve-devel] [PATCH qemu/qemu-server/docs v3 00/18] adapt to changes in QEMU machine version deprecation/removal Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu v3 01/18] adapt machine version deprecation for Proxmox VE Fiona Ebner
2025-01-17 13:10 ` [pve-devel] applied: " Thomas Lamprecht
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 02/18] machine: drop unused parameter from assert_valid_machine_property() helper Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 03/18] move get_command_for_arch() helper to helpers module Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 04/18] helpers: improve name for variable for mapping arch to binary Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 05/18] move kvm_user_version() function to helpers module Fiona Ebner
2025-01-17 12:08 ` Fiona Ebner [this message]
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 07/18] machine: add default_machine_for_arch() helper Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 08/18] move get_installed_machine_version() helper to machine module Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 09/18] move windows_get_pinned_machine_version() function " Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 10/18] move get_vm_machine() " Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 11/18] move meta information handling to its own module Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 12/18] machine: fallback to creation QEMU version for windows starting with 9.1 Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 13/18] machine: add check_and_pin_machine_string() helper Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 14/18] api: update vm config: pin machine version when switching to windows os type Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 15/18] machine: log informational line when pinning machine version for Windows guest Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 16/18] machine: rename machine_version() function to machine_version_at_least() Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH qemu-server v3 17/18] machine: code cleanup: avoid superfluous augmented assignment operator Fiona Ebner
2025-01-17 12:08 ` [pve-devel] [PATCH docs v3 18/18] qm: machine version: document support in PVE Fiona Ebner
2025-01-17 13:09 ` [pve-devel] [PATCH qemu/qemu-server/docs v3 00/18] adapt to changes in QEMU machine version deprecation/removal Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250117120817.41443-7-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox