all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/5] ui/machine: fix Windows pinning and detect "pc" as non-pinned
Date: Mon,  8 Mar 2021 11:01:48 +0100	[thread overview]
Message-ID: <20210308100151.7886-2-s.reiter@proxmox.com> (raw)
In-Reply-To: <20210308100151.7886-1-s.reiter@proxmox.com>

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 | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
index ec391513..9dcdb012 100644
--- a/www/manager6/qemu/MachineEdit.js
+++ b/www/manager6/qemu/MachineEdit.js
@@ -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);
     },
-- 
2.20.1





  reply	other threads:[~2021-03-08 10:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 10:01 [pve-devel] [PATCH manager 1/5] ui: add onlineHelp to rng Stefan Reiter
2021-03-08 10:01 ` Stefan Reiter [this message]
2021-03-08 10:01 ` [pve-devel] [PATCH manager 3/5] ui/machine: fix eslint warning (unnecessary parentheses) Stefan Reiter
2021-03-08 10:01 ` [pve-devel] [PATCH manager 4/5] Utils: add is_windows and use in MachineEdit Stefan Reiter
2021-03-08 10:01 ` [pve-devel] [PATCH manager 5/5] ui/hardware: extend machine renderer to show pinned Windows versions Stefan Reiter
2021-03-08 10:15 ` [pve-devel] applied-series: [PATCH manager 1/5] ui: add onlineHelp to rng Thomas Lamprecht

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=20210308100151.7886-2-s.reiter@proxmox.com \
    --to=s.reiter@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal