From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 549F31FF183
	for <inbox@lore.proxmox.com>; Wed, 18 Jun 2025 15:08:47 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 8950A13407;
	Wed, 18 Jun 2025 15:09:06 +0200 (CEST)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 18 Jun 2025 15:02:00 +0200
Message-Id: <20250618130209.90649-24-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250618130209.90649-1-f.ebner@proxmox.com>
References: <20250618130209.90649-1-f.ebner@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.031 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 v2 23/32] cfg2cmd: collect optional
 parameters as a hash
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

New in v2.

 src/PVE/QemuServer.pm | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index bffce201..245e1a26 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3526,7 +3526,10 @@ my sub get_vga_properties {
 }
 
 sub config_to_command {
-    my ($storecfg, $vmid, $conf, $defaults, $forcemachine, $forcecpu, $live_restore_backing) = @_;
+    my ($storecfg, $vmid, $conf, $defaults, $options) = @_;
+
+    my ($forcemachine, $forcecpu, $live_restore_backing) =
+        $options->@{qw(force-machine force-cpu live-restore-backing)};
 
     # minimize config for templates, they can only start for backup,
     # so most options besides the disks are irrelevant
@@ -5995,9 +5998,11 @@ sub vm_start_nolock {
             $vmid,
             $conf,
             $defaults,
-            $forcemachine,
-            $forcecpu,
-            $params->{'live-restore-backing'},
+            {
+                'force-machine' => $forcemachine,
+                'force-cpu' => $forcecpu,
+                'live-restore-backing' => $params->{'live-restore-backing'},
+            },
         );
 
         my $memory = get_current_memory($conf->{memory});
@@ -6320,14 +6325,14 @@ sub vm_commandline {
 
     my $conf = PVE::QemuConfig->load_config($vmid);
 
-    my ($forcemachine, $forcecpu);
+    my $options = {};
     if ($snapname) {
         my $snapshot = $conf->{snapshots}->{$snapname};
         die "snapshot '$snapname' does not exist\n" if !defined($snapshot);
 
         # check for machine or CPU overrides in snapshot
-        $forcemachine = $snapshot->{runningmachine};
-        $forcecpu = $snapshot->{runningcpu};
+        $options->{'force-machine'} = $snapshot->{runningmachine};
+        $options->{'force-cpu'} = $snapshot->{runningcpu};
 
         $snapshot->{digest} = $conf->{digest}; # keep file digest for API
 
@@ -6346,7 +6351,7 @@ sub vm_commandline {
     }
 
     my $cmd;
-    eval { $cmd = config_to_command($storecfg, $vmid, $conf, $defaults, $forcemachine, $forcecpu); };
+    eval { $cmd = config_to_command($storecfg, $vmid, $conf, $defaults, $options); };
     my $err = $@;
 
     # If the vm is not running, need to clean up the reserved/created devices.
-- 
2.39.5



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