because the value we get is not the config key, but the displayed text.
Therefore we fetch the config key from the PVE.Utils.kvm_vga_drivers object.

Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com>
---
We have some options here, we could also match and extract the serial ID
from the displayed text, but that will fail once we change the displayed
text in the kvm_vga_drivers.

This is also the quickest way regarding #6304 as it will just get the
old validator working again.
Adding a hint or making it possible to add the matching serial port
device (semi) automatically will most likely be a bigger change.

 www/manager6/qemu/DisplayEdit.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index c8a67017..7a9a5160 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -51,7 +51,10 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
        validator: function(v) {
            let cfg = this.up('proxmoxWindowEdit').vmconfig || {};
 
-           if (v.match(/^serial\d+$/) && (!cfg[v] || cfg[v] !== 'socket')) {
+           let vgaKey = Object.keys(PVE.Utils.kvm_vga_drivers).find(
+               (key) => PVE.Utils.kvm_vga_drivers[key] === v
+           );
+           if (vgaKey.match(/^serial\d+$/) && (!cfg[vgaKey] || cfg[vgaKey] !== 
'socket')) {
                let fmt = gettext("Serial interface '{0}' is not correctly 
configured.");
                return Ext.String.format(fmt, v);
            }
-- 
2.39.5



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

Reply via email to