]> git.proxmox.com Git - pve-manager.git/commitdiff
ui/machine: fix Windows pinning and detect "pc" as non-pinned
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 8 Mar 2021 10:01:48 +0000 (11:01 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 8 Mar 2021 10:05:13 +0000 (11:05 +0100)
We need to detect "isWindows" before splitting a pinned version into
.version/.machine, otherwise .machine will always be "pc" or "q35", and
the check in "isWindows" will succeed even for pinned versions. This
resulted in "5.1" being shown even if a different version has been set
for a Windows machine.

Also alias "pc" directly to "__default__", as they have the same
meaning, but "pc" is not a valid entry in the "machine" combobox,
leading to an invalid state when editing the (valid) configuration of
"machine: pc" on a VM.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
www/manager6/qemu/MachineEdit.js

index ec391513290f82f162807c608d0ee1cd0fbfceb8..9dcdb012e5dd296d3c4101a5ce7b44614fa1586e 100644 (file)
@@ -47,7 +47,17 @@ Ext.define('PVE.qemu.MachineInputPanel', {
        let me = this;
 
        me.isWindows = values.isWindows;
+       if (values.machine === 'pc') {
+           values.machine = '__default__';
+       }
 
+       if (me.isWindows) {
+           if (values.machine === '__default__') {
+               values.version = 'pc-i440fx-5.1';
+           } else if (values.machine === 'q35') {
+               values.version = 'pc-q35-5.1';
+           }
+       }
        if (values.machine !== '__default__' && values.machine !== 'q35') {
            values.version = values.machine;
            values.machine = values.version.match(/q35/) ? 'q35' : '__default__';
@@ -55,13 +65,6 @@ Ext.define('PVE.qemu.MachineInputPanel', {
            // avoid hiding a pinned version
            me.setAdvancedVisible(true);
        }
-       if (me.isWindows) {
-           if (values.machine === '__default__' || values.machine === 'pc') {
-               values.version = 'pc-i440fx-5.1';
-           } else if (values.machine === 'q35') {
-               values.version = 'pc-q35-5.1';
-           }
-       }
 
        this.callParent(arguments);
     },