public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager] fix #8349: ui: qemu: hardware: allow removing socket serial and spice usb ports
@ 2026-12-03 14:03 Michal Fox
  0 siblings, 0 replies; only message in thread
From: Michal Fox @ 2026-12-03 14:03 UTC (permalink / raw)
  To: pve-devel

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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 14:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 14:03 [PATCH manager] fix #8349: ui: qemu: hardware: allow removing socket serial and spice usb ports Michal Fox

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