From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 479101FF164 for ; Fri, 3 Jan 2025 16:58:57 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 00CF728E7F; Fri, 3 Jan 2025 16:58:16 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Fri, 3 Jan 2025 16:57:49 +0100 Message-Id: <20250103155802.143669-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250103155802.143669-1-f.ebner@proxmox.com> References: <20250103155802.143669-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.051 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server 06/19] move get_vm_arch() helper to helpers module X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Fiona Ebner --- 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 41ad1cb6..4c8b2bc0 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1197,7 +1197,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+$/; @@ -2033,7 +2033,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 1827c024..32b2a835 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3260,11 +3260,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', @@ -3579,7 +3574,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); @@ -4659,7 +4654,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); @@ -4901,7 +4896,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 @@ -8482,7 +8477,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