public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v4 14/14] ui: qemu machine: don't lose pci options on edit cycle
Date: Fri, 13 Nov 2026 15:39:30 +0100	[thread overview]
Message-ID: <20261113143939.3012964-15-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261113143939.3012964-1-d.csapak@proxmox.com>

While we don't want to directly expose the options on the UI for now,
those shouldn't be lost when editing the other options. To keep them,
use hidden fields for them that keep their original values that get
submitted beside the other options.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/qemu/MachineEdit.js | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
index cd759703..79fed45e 100644
--- a/www/manager6/qemu/MachineEdit.js
+++ b/www/manager6/qemu/MachineEdit.js
@@ -72,17 +72,22 @@ Ext.define('PVE.qemu.MachineInputPanel', {
         // arch is a hidden field used only for the machine-default lookup; do not submit it.
         let arch = values.arch;
         delete values.arch;
-        if (values.delete === 'machine' && values.viommu) {
-            delete values.delete;
-            values.machine = PVE.qemu.Architecture.defaultMachines[arch];
+
+        if (values.delete === 'machine') {
+            // only delete if no other relevant value is set
+            let keep = ['viommu', 'pci-layout', 'pci-topology'].some((prop) => !!values[prop]);
+            if (keep) {
+                delete values.delete;
+                values.machine = PVE.qemu.Architecture.defaultMachines[arch];
+            }
         }
         if (values.version && values.version !== 'latest') {
             values.machine = values.version;
             delete values.delete;
         }
         delete values.version;
-        if (values.delete === 'machine' && !values.viommu) {
-            return values;
+        if (values.delete === 'machine') {
+            return { delete: 'machine' };
         }
         let ret = {};
         ret.machine = PVE.Parser.printPropertyString(values, 'machine');
@@ -94,6 +99,12 @@ Ext.define('PVE.qemu.MachineInputPanel', {
 
         let machineConf = PVE.Parser.parsePropertyString(values.machine, 'type');
         values.machine = machineConf.type;
+        // don't lose those on an edit cycle, each needs a hidden field for this
+        ['pci-layout', 'pci-topology'].forEach((prop) => {
+            if (machineConf[prop] !== undefined) {
+                values[prop] = machineConf[prop];
+            }
+        });
 
         let defaultMachine = PVE.qemu.Architecture.defaultMachines[values.arch];
         me.isWindows = values.isWindows;
@@ -148,6 +159,14 @@ Ext.define('PVE.qemu.MachineInputPanel', {
             reference: 'arch',
             bind: '{arch}',
         },
+        {
+            xtype: 'hidden',
+            name: 'pci-layout',
+        },
+        {
+            xtype: 'hidden',
+            name: 'pci-topology',
+        },
     ],
 
     advancedItems: [
-- 
2.47.3





      parent reply	other threads:[~2026-11-13 14:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 14:39 [PATCH manager/proxmox-perl-rs/qemu-server/qemu-server-rs v4 00/14] pci-handling rewrite Dominik Csapak
2026-11-13 14:39 ` [PATCH pve-qemu-server-rs v4 01/14] add pve-qemu-server-pci crate for guest PCI address generation Dominik Csapak
2026-11-13 14:39 ` [PATCH pve-qemu-server-rs v4 02/14] pci: legacy: generate pci bridges Dominik Csapak
2026-11-13 14:39 ` [PATCH pve-qemu-server-rs v4 03/14] pci: legacy: generate q35 chipset devices and hostpcie root ports Dominik Csapak
2026-11-13 14:39 ` [PATCH pve-qemu-server-rs v4 04/14] pci: layout: add grouped PCI and PCIe layouts Dominik Csapak
2026-11-13 14:39 ` [PATCH pve-qemu-server-rs v4 05/14] pci: bus: add buses for numa expander bridges and pcie switches Dominik Csapak
2026-11-13 14:39 ` [PATCH pve-qemu-server-rs v4 06/14] pci: topology: place hostpcie devices like on the host Dominik Csapak
2026-11-13 14:39 ` [PATCH proxmox-perl-rs v4 07/14] pve: add bindings for `pve-qemu-server-pci` crate Dominik Csapak
2026-11-13 14:39 ` [PATCH proxmox-perl-rs v4 08/14] pve: pci: add host placements for the hostpci topology Dominik Csapak
2026-11-13 14:39 ` [PATCH qemu-server v4 09/14] pci: use PVE::RS::PCI bindings for addresses and bus devices Dominik Csapak
2026-11-13 14:39 ` [PATCH qemu-server v4 10/14] tree-wide: use HardwareConfig for the machine version checks Dominik Csapak
2026-11-13 14:39 ` [PATCH qemu-server v4 11/14] cfg2cmd: q35: generate chipset devices with machine version 11.1+pve1 Dominik Csapak
2026-11-13 14:39 ` [PATCH qemu-server v4 12/14] machine: add 'pci-layout' option Dominik Csapak
2026-11-13 14:39 ` [PATCH qemu-server v4 13/14] machine: add 'pci-topology' option Dominik Csapak
2026-11-13 14:39 ` Dominik Csapak [this message]

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=20261113143939.3012964-15-d.csapak@proxmox.com \
    --to=d.csapak@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal