public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] fix #8349: ui: qemu: hardware: allow removing socket serial and spice usb ports
Date: Thu,  3 Dec 2026 14:03:41 +0000	[thread overview]
Message-ID: <20261203140341.7-1-me@dualfroz.com> (raw)

The remove button for serial and USB ports was only enabled with
Sys.Console (or Mapping.Use for USB), while the backend only requires
VM.Config.HWType for removing a serial port of type socket or a SPICE USB
port. Decide based on the configured value, so that users who can add
such ports can also remove them again.

Signed-off-by: Michal Fox <me@dualfroz.com>
---
checked with node --check and by running the changed button logic in node for socket, device, spice and mapped ports, not clicked through in the gui

 www/manager6/qemu/HardwareView.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index fdb1802..b771e65 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -776,7 +776,16 @@ Ext.define('PVE.qemu.HardwareView', {
             const isEfi = key === 'efidisk0';
             const tpmMoveable = key === 'tpmstate0' && !isRunning;
 
-            let cannotDelete = deleted || row.never_delete;
+            // socket serial ports and SPICE USB ports are not host devices, the backend only
+            // requires VM.Config.HWType for removing them
+            const isSocketSerial = /^serial\d+$/.test(key) && value === 'socket';
+            const isSpiceUsb =
+                /^usb\d+$/.test(key) &&
+                /^spice$/i.test(PVE.Parser.parsePropertyString(value, 'host')?.host);
+            const neverDelete =
+                isSocketSerial || isSpiceUsb ? noVMConfigHWTypePerm : row.never_delete;
+
+            let cannotDelete = deleted || neverDelete;
             cannotDelete ||= isCDRom && !cdromCap;
             cannotDelete ||= isDisk && !diskCap;
             cannotDelete ||= isCloudInit && noVMConfigCloudinitPerm;
-- 
2.43.0




                 reply	other threads:[~2026-12-03 14:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261203140341.7-1-me@dualfroz.com \
    --to=me@dualfroz.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