* [pve-devel] [PATCH manager 2/5] ui/machine: fix Windows pinning and detect "pc" as non-pinned
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
2021-03-08 10:01 ` [pve-devel] [PATCH manager 3/5] ui/machine: fix eslint warning (unnecessary parentheses) Stefan Reiter
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Reiter @ 2021-03-08 10:01 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager 3/5] ui/machine: fix eslint warning (unnecessary parentheses)
2021-03-08 10:01 [pve-devel] [PATCH manager 1/5] ui: add onlineHelp to rng Stefan Reiter
2021-03-08 10:01 ` [pve-devel] [PATCH manager 2/5] ui/machine: fix Windows pinning and detect "pc" as non-pinned Stefan Reiter
@ 2021-03-08 10:01 ` Stefan Reiter
2021-03-08 10:01 ` [pve-devel] [PATCH manager 4/5] Utils: add is_windows and use in MachineEdit Stefan Reiter
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Reiter @ 2021-03-08 10:01 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
www/manager6/qemu/MachineEdit.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
index 9dcdb012..87b405f5 100644
--- a/www/manager6/qemu/MachineEdit.js
+++ b/www/manager6/qemu/MachineEdit.js
@@ -16,7 +16,7 @@ Ext.define('PVE.qemu.MachineInputPanel', {
let oldRec = store.findRecord('id', version.getValue(), 0, false, false, true);
let type = value === 'q35' ? 'q35' : 'i440fx';
store.clearFilter();
- store.addFilter(val => (val.data.id === 'latest' || val.data.type === type));
+ store.addFilter(val => val.data.id === 'latest' || val.data.type === type);
if (!me.getView().isWindows) {
version.setValue('latest');
} else {
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager 4/5] Utils: add is_windows and use in MachineEdit
2021-03-08 10:01 [pve-devel] [PATCH manager 1/5] ui: add onlineHelp to rng Stefan Reiter
2021-03-08 10:01 ` [pve-devel] [PATCH manager 2/5] ui/machine: fix Windows pinning and detect "pc" as non-pinned Stefan Reiter
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 ` 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
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Reiter @ 2021-03-08 10:01 UTC (permalink / raw)
To: pve-devel
A bit more future proof and reuseable than a regex match.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
www/manager6/Utils.js | 9 +++++++++
www/manager6/qemu/MachineEdit.js | 4 +---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index ab4988b0..f502950f 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -69,6 +69,15 @@ Ext.define('PVE.Utils', {
],
},
+ is_windows: function(ostype) {
+ for (let entry of PVE.Utils.kvm_ostypes['Microsoft Windows']) {
+ if (entry.val === ostype) {
+ return true;
+ }
+ }
+ return false;
+ },
+
get_health_icon: function(state, circle) {
if (circle === undefined) {
circle = false;
diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
index 87b405f5..f928c80c 100644
--- a/www/manager6/qemu/MachineEdit.js
+++ b/www/manager6/qemu/MachineEdit.js
@@ -138,9 +138,7 @@ Ext.define('PVE.qemu.MachineEdit', {
let values = {
machine: conf.machine || '__default__',
};
- if (conf.ostype && conf.ostype.match(/^(win|wvista|wxp|w2k)/i)) {
- values.isWindows = true;
- }
+ values.isWindows = PVE.Utils.is_windows(conf.ostype);
me.setValues(values);
},
});
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH manager 5/5] ui/hardware: extend machine renderer to show pinned Windows versions
2021-03-08 10:01 [pve-devel] [PATCH manager 1/5] ui: add onlineHelp to rng Stefan Reiter
` (2 preceding siblings ...)
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 ` Stefan Reiter
2021-03-08 10:15 ` [pve-devel] applied-series: [PATCH manager 1/5] ui: add onlineHelp to rng Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Reiter @ 2021-03-08 10:01 UTC (permalink / raw)
To: pve-devel
The default is not just "i440fx", this hides the fact that the version
will be pinned to 5.1, unless one deliberately opens the editor.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
www/manager6/qemu/HardwareView.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 470baa46..98352e3f 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -159,7 +159,14 @@ Ext.define('PVE.qemu.HardwareView', {
never_delete: true,
group: 6,
defaultValue: '',
- renderer: PVE.Utils.render_qemu_machine,
+ renderer: function(value, metaData, record, rowIndex, colIndex, store, pending) {
+ let ostype = me.getObjectValue('ostype', undefined, pending);
+ if (PVE.Utils.is_windows(ostype) &&
+ (!value || value === 'pc' || value === 'q35')) {
+ return value === 'q35' ? 'pc-q35-5.1' : 'pc-i440fx-5.1';
+ }
+ return PVE.Utils.render_qemu_machine(value);
+ },
},
scsihw: {
header: gettext('SCSI Controller'),
@@ -203,6 +210,9 @@ Ext.define('PVE.qemu.HardwareView', {
shares: {
visible: false,
},
+ ostype: {
+ visible: false,
+ },
};
PVE.Utils.forEachBus(undefined, function(type, id) {
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] applied-series: [PATCH manager 1/5] ui: add onlineHelp to rng
2021-03-08 10:01 [pve-devel] [PATCH manager 1/5] ui: add onlineHelp to rng Stefan Reiter
` (3 preceding siblings ...)
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 ` Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-03-08 10:15 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Reiter
On 08.03.21 11:01, Stefan Reiter wrote:
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> www/manager6/qemu/RNGEdit.js | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>
applied series, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread