* [pve-devel] [PATCH v10 manager 01/19] api: nodes: add readovf endpoint
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
@ 2022-04-06 8:03 ` Fabian Ebner
2022-04-06 8:03 ` [pve-devel] [PATCH v10 manager 02/19] ui: HD edit: get rid of unneeded binding for backup checkbox Fabian Ebner
` (17 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:03 UTC (permalink / raw)
To: pve-devel
Because the paths under /nodes/{node}/qemu/ are already occupied by
a {vmid} regex, it's not possible to use /nodes/{node}/qemu/readovf
for the new call. As the call does not depend upon a particular vmid,
it's placed under /nodes/{node} instead.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[split into its own patch + add to index]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/API2/Nodes.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 655493a3..f595808a 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -49,6 +49,7 @@ use PVE::API2::LXC;
use PVE::API2::Network;
use PVE::API2::NodeConfig;
use PVE::API2::Qemu::CPU;
+use PVE::API2::Qemu::OVF;
use PVE::API2::Qemu;
use PVE::API2::Replication;
use PVE::API2::Services;
@@ -71,6 +72,11 @@ __PACKAGE__->register_method ({
path => 'qemu',
});
+__PACKAGE__->register_method ({
+ subclass => "PVE::API2::Qemu::OVF",
+ path => 'readovf',
+});
+
__PACKAGE__->register_method ({
subclass => "PVE::API2::LXC",
path => 'lxc',
@@ -233,6 +239,7 @@ __PACKAGE__->register_method ({
{ name => 'network' },
{ name => 'qemu' },
{ name => 'query-url-metadata' },
+ { name => 'readovf' },
{ name => 'replication' },
{ name => 'report' },
{ name => 'rrd' }, # fixme: remove?
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 02/19] ui: HD edit: get rid of unneeded binding for backup checkbox
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
2022-04-06 8:03 ` [pve-devel] [PATCH v10 manager 01/19] api: nodes: add readovf endpoint Fabian Ebner
@ 2022-04-06 8:03 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 03/19] ui: HD edit: move advanced options into a dedicated tab Fabian Ebner
` (16 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:03 UTC (permalink / raw)
To: pve-devel
In preparation to move the advanced options to their own tab, where
the value would not be updated until the component is rendered, which
might not happen before submitting.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/HDEdit.js | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index c643ee73..89620e7f 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -57,9 +57,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
init: function(view) {
var vm = this.getViewModel();
- if (view.isCreate) {
- vm.set('isIncludedInBackup', true);
- }
+
if (view.confid) {
vm.set('isSCSI', view.confid.match(/^scsi/));
vm.set('isVirtIO', view.confid.match(/^virtio/));
@@ -293,9 +291,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
'data-qtip': gettext('Include volume in backup job'),
},
name: 'backup',
- bind: {
- value: '{isIncludedInBackup}',
- },
+ value: me.isCreate,
},
{
xtype: 'proxmoxcheckbox',
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 03/19] ui: HD edit: move advanced options into a dedicated tab
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
2022-04-06 8:03 ` [pve-devel] [PATCH v10 manager 01/19] api: nodes: add readovf endpoint Fabian Ebner
2022-04-06 8:03 ` [pve-devel] [PATCH v10 manager 02/19] ui: HD edit: get rid of unneeded binding for backup checkbox Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 04/19] ui: disk storage selector: add setSize function Fabian Ebner
` (15 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/HDEdit.js | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 89620e7f..92e6d116 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -170,8 +170,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.down('#hdimage').setStorage(undefined, nodename);
},
- hasAdvanced: true,
-
initComponent: function() {
var me = this;
@@ -180,9 +178,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
let column1 = [];
let column2 = [];
- let advancedColumn1 = [];
- let advancedColumn2 = [];
-
if (!me.confid || me.unused) {
me.bussel = Ext.create('PVE.form.ControllerSelector', {
vmconfig: me.vmconfig,
@@ -251,7 +246,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
},
);
- advancedColumn1.push(
+ let optionsColumn1 = [
{
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('SSD emulation'),
@@ -280,9 +275,9 @@ Ext.define('PVE.qemu.HDInputPanel', {
disabled: '{!isVirtIO && !isSCSI}',
},
},
- );
+ ];
- advancedColumn2.push(
+ let optionsColumn2 = [
{
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Backup'),
@@ -311,7 +306,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
['threads', 'threads'],
],
},
- );
+ ];
let labelWidth = 140;
@@ -403,21 +398,22 @@ Ext.define('PVE.qemu.HDInputPanel', {
{
title: gettext('Disk'),
xtype: 'inputpanel',
- reference: 'diskpanel',
column1,
column2,
- advancedColumn1,
- advancedColumn2,
- showAdvanced: me.showAdvanced,
+ getValues: () => ({}),
+ },
+ {
+ title: gettext('Options'),
+ xtype: 'inputpanel',
+ column1: optionsColumn1,
+ column2: optionsColumn2,
getValues: () => ({}),
},
{
title: gettext('Bandwidth'),
xtype: 'inputpanel',
- reference: 'bwpanel',
column1: bwColumn1,
column2: bwColumn2,
- showAdvanced: me.showAdvanced,
getValues: () => ({}),
},
],
@@ -426,11 +422,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.callParent();
},
-
- setAdvancedVisible: function(visible) {
- this.lookup('diskpanel').setAdvancedVisible(visible);
- this.lookup('bwpanel').setAdvancedVisible(visible);
- },
});
Ext.define('PVE.qemu.HDEdit', {
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 04/19] ui: disk storage selector: add setSize function
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (2 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 03/19] ui: HD edit: move advanced options into a dedicated tab Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 05/19] ui: file selector: add getCurrentSize function Fabian Ebner
` (14 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
In preparation for disk import from an existing volume.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/form/DiskStorageSelector.js | 25 +++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
index ac6b064f..9699938e 100644
--- a/www/manager6/form/DiskStorageSelector.js
+++ b/www/manager6/form/DiskStorageSelector.js
@@ -25,8 +25,10 @@ Ext.define('PVE.form.DiskStorageSelector', {
// hideSelection is not true
hideSelection: undefined,
- // hides the size field (e.g, for the efi disk dialog)
+ // hides and disables the size field (e.g, for the efi disk dialog)
hideSize: false,
+ // disables the size field (e.g. when importing from existing volume)
+ disableSize: false,
// hides the format field (e.g. for TPM state), always assumes 'raw'
hideFormat: false,
@@ -75,7 +77,7 @@ Ext.define('PVE.form.DiskStorageSelector', {
hdfilesel.setStorage(value);
}
- hdsizesel.setDisabled(select || me.hideSize);
+ hdsizesel.setDisabled(select || me.hideSize || me.disableSize);
hdsizesel.setVisible(!select && !me.hideSize);
},
@@ -103,6 +105,23 @@ Ext.define('PVE.form.DiskStorageSelector', {
hdstorage.fireEvent('validitychange');
},
+ setSize: function(size, fixed) {
+ let me = this;
+ let sizeField = me.getComponent('disksize');
+
+ me.disableSize = fixed;
+ // For import, size 0 shouldn't show as invalid, so disable first.
+ sizeField.setDisabled(fixed);
+
+ if (size === undefined || size === null) {
+ size = me.defaultSize;
+ } else {
+ size = size / Proxmox.Utils.SizeUnits.GiB;
+ }
+
+ sizeField.setValue(size);
+ },
+
initComponent: function() {
var me = this;
@@ -143,7 +162,7 @@ Ext.define('PVE.form.DiskStorageSelector', {
name: 'disksize',
fieldLabel: gettext('Disk size') + ' (GiB)',
hidden: me.hideSize,
- disabled: me.hideSize,
+ disabled: me.hideSize || me.disableSize,
minValue: 0.001,
maxValue: 128*1024,
decimalPrecision: 3,
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 05/19] ui: file selector: add getCurrentSize function
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (3 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 04/19] ui: disk storage selector: add setSize function Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 06/19] ui: HD edit: allow selecting import source Fabian Ebner
` (13 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
In preparation for disk import from an existing volume.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[FE: split into its own patch]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/form/FileSelector.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/www/manager6/form/FileSelector.js b/www/manager6/form/FileSelector.js
index ef2bedf9..d426e7f4 100644
--- a/www/manager6/form/FileSelector.js
+++ b/www/manager6/form/FileSelector.js
@@ -51,6 +51,12 @@ Ext.define('PVE.form.FileSelector', {
this.setStorage(undefined, nodename);
},
+ getCurrentSize: function() {
+ const me = this;
+ const id = me.getValue();
+ return id ? me.store.getById(id).get('size') : 0;
+ },
+
store: {
model: 'pve-storage-content',
},
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 06/19] ui: HD edit: allow selecting import source
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (4 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 05/19] ui: file selector: add getCurrentSize function Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 07/19] ui: CD edit: handle change even if not yet rendered Fabian Ebner
` (12 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
The backend now supports importing from an existing volume, or, for
root, from an arbitrary file system path.
This is also in preparation for import from OVF functionality in the
VM create wizard.
Co-developed-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/HDEdit.js | 116 +++++++++++++++++++++++++++++++++++-
1 file changed, 115 insertions(+), 1 deletion(-)
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 92e6d116..3edc077d 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -75,10 +75,19 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.drive.file = me.vmconfig[values.unusedId];
confid = values.controller + values.deviceid;
} else if (me.isCreate) {
+ let diskSource = values[`diskSource-${me.id}`];
if (values.hdimage) {
me.drive.file = values.hdimage;
- } else {
+ } else if (diskSource === 'empty') {
me.drive.file = values.hdstorage + ":" + values.disksize;
+ } else if (diskSource === 'volume') {
+ me.drive.file = `${values.hdstorage}:0`;
+ me.drive['import-from'] = `${values.sourceImage}`;
+ } else if (diskSource === 'path') {
+ me.drive.file = `${values.hdstorage}:0`;
+ me.drive['import-from'] = `${values.sourcePath}`;
+ } else {
+ throw "internal error - unexcpected disk source!";
}
me.drive.format = values.diskformat;
}
@@ -168,6 +177,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
var me = this;
me.down('#hdstorage').setNodename(nodename);
me.down('#hdimage').setStorage(undefined, nodename);
+ me.down('#sourceStorage').setNodename(nodename);
},
initComponent: function() {
@@ -244,6 +254,110 @@ Ext.define('PVE.qemu.HDInputPanel', {
reference: 'discard',
name: 'discard',
},
+ {
+ xtype: 'radiofield',
+ name: `diskSource-${me.id}`, // needs to be unique when used in MultiDiskPanel
+ inputValue: 'empty',
+ boxLabel: gettext('Create empty disk'),
+ hidden: !me.isCreate || me.unused,
+ checked: true,
+ listeners: {
+ change: function(field, nowSelected) {
+ if (nowSelected) {
+ me.down('pveDiskStorageSelector').setSize(); // reset
+ }
+ },
+ },
+ },
+ {
+ xtype: 'radiofield',
+ name: `diskSource-${me.id}`,
+ inputValue: 'volume',
+ boxLabel: gettext('Import from existing volume'),
+ hidden: !me.isCreate || me.unused,
+ listeners: {
+ change: (field, nowSelected) => {
+ let sourceImageSelector = me.down('#sourceImage');
+ let sourceStorageSelector = me.down('#sourceStorage');
+ if (nowSelected) {
+ me.down('pveDiskStorageSelector').setSize(
+ sourceImageSelector.getCurrentSize(),
+ true,
+ );
+ }
+
+ sourceStorageSelector.setHidden(!nowSelected);
+ sourceStorageSelector.setDisabled(!nowSelected);
+ sourceStorageSelector.fireEvent('validitychange');
+ sourceImageSelector.setHidden(!nowSelected);
+ sourceImageSelector.setDisabled(!nowSelected);
+ sourceImageSelector.fireEvent('validitychange');
+ },
+ },
+ },
+ {
+ xtype: 'pveStorageSelector',
+ itemId: 'sourceStorage',
+ name: 'sourceStorage',
+ nodename: me.nodename,
+ fieldLabel: gettext('Storage'),
+ storageContent: 'images',
+ autoSelect: me.insideWizard,
+ hidden: true,
+ disabled: true,
+ listeners: {
+ change: function(selector, selectedStorage) {
+ selector.next('pveFileSelector').setStorage(
+ selectedStorage,
+ me.getViewModel().get('nodename'),
+ );
+ },
+ },
+ },
+ {
+ xtype: 'pveFileSelector',
+ itemId: 'sourceImage',
+ name: 'sourceImage',
+ nodename: me.nodename,
+ storageContent: 'images',
+ hidden: true,
+ disabled: true,
+ fieldLabel: gettext('Image'),
+ listeners: {
+ change: function(field, value) {
+ if (!field.isDisabled()) {
+ me.down('pveDiskStorageSelector').setSize(this.getCurrentSize(), true);
+ }
+ },
+ },
+ },
+ {
+ xtype: 'radiofield',
+ name: `diskSource-${me.id}`,
+ inputValue: 'path',
+ boxLabel: gettext('Import from existing volume by path'),
+ hidden: !me.isCreate || me.unused || Proxmox.UserName !== 'root@pam',
+ listeners: {
+ change: (field, nowSelected) => {
+ let sourcePathField = me.down('#sourcePath');
+ sourcePathField.setHidden(!nowSelected);
+ sourcePathField.setDisabled(!nowSelected);
+ sourcePathField.fireEvent('validitychange');
+
+ if (nowSelected) {
+ me.down('pveDiskStorageSelector').setSize(0, true);
+ }
+ },
+ },
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('Path'),
+ itemId: 'sourcePath',
+ name: 'sourcePath',
+ hidden: true,
+ disabled: true,
+ },
);
let optionsColumn1 = [
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 07/19] ui: CD edit: handle change even if not yet rendered
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (5 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 06/19] ui: HD edit: allow selecting import source Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 08/19] ui: multi disk edit: only pass confid for addPanel Fabian Ebner
` (11 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
In preparation for the import functionality in the wizard, which will
set the radio field to 'none' when it might not yet be rendered.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[FE: split into its own patch]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/CDEdit.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 72c01037..27092d32 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -84,9 +84,6 @@ Ext.define('PVE.qemu.CDInputPanel', {
checked: true,
listeners: {
change: function(f, value) {
- if (!me.rendered) {
- return;
- }
me.down('field[name=cdstorage]').setDisabled(!value);
var cdImageField = me.down('field[name=cdimage]');
cdImageField.setDisabled(!value);
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 08/19] ui: multi disk edit: only pass confid for addPanel
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (6 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 07/19] ui: CD edit: handle change even if not yet rendered Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 09/19] ui: HD edit: allow preselecting config ID Fabian Ebner
` (10 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
in preparation to allow pre-selecting a config ID.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/lxc/MultiMPEdit.js | 4 ++--
www/manager6/panel/MultiDiskEdit.js | 4 ++--
www/manager6/qemu/MultiHDEdit.js | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/www/manager6/lxc/MultiMPEdit.js b/www/manager6/lxc/MultiMPEdit.js
index 709dacb1..7310ad05 100644
--- a/www/manager6/lxc/MultiMPEdit.js
+++ b/www/manager6/lxc/MultiMPEdit.js
@@ -30,14 +30,14 @@ Ext.define('PVE.lxc.MultiMPPanel', {
return nextFreeDisk;
},
- addPanel: function(itemId, vmconfig, nextFreeDisk) {
+ addPanel: function(itemId, vmconfig, confid) {
let me = this;
return me.getView().add({
vmconfig,
border: false,
showAdvanced: Ext.state.Manager.getProvider().get('proxmox-advanced-cb'),
xtype: 'pveLxcMountPointInputPanel',
- confid: nextFreeDisk.confid === 'rootfs' ? 'rootfs' : null,
+ confid: confid === 'rootfs' ? 'rootfs' : null,
bind: {
nodename: '{nodename}',
unprivileged: '{unprivileged}',
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index ea1f974d..c1fd0617 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -27,7 +27,7 @@ Ext.define('PVE.panel.MultiDiskPanel', {
throw "implement in subclass";
},
- addPanel: function(itemId, vmconfig, nextFreeDisk) {
+ addPanel: function(itemId, vmconfig, confid) {
throw "implement in subclass";
},
@@ -53,7 +53,7 @@ Ext.define('PVE.panel.MultiDiskPanel', {
itemId,
})[0];
- let panel = me.addPanel(itemId, vmconfig, nextFreeDisk);
+ let panel = me.addPanel(itemId, vmconfig, nextFreeDisk.confid);
panel.updateVMConfig(vmconfig);
// we need to setup a validitychange handler, so that we can show
diff --git a/www/manager6/qemu/MultiHDEdit.js b/www/manager6/qemu/MultiHDEdit.js
index caf74fad..b2e8141e 100644
--- a/www/manager6/qemu/MultiHDEdit.js
+++ b/www/manager6/qemu/MultiHDEdit.js
@@ -16,7 +16,7 @@ Ext.define('PVE.qemu.MultiHDPanel', {
return PVE.Utils.nextFreeDisk(clist, vmconfig);
},
- addPanel: function(itemId, vmconfig, nextFreeDisk) {
+ addPanel: function(itemId, vmconfig, confid) {
let me = this;
return me.getView().add({
vmconfig,
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 09/19] ui: HD edit: allow preselecting config ID
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (7 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 08/19] ui: multi disk edit: only pass confid for addPanel Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 10/19] ui: multi HD edit: pre select passed-in " Fabian Ebner
` (9 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/form/ControllerSelector.js | 4 ++++
www/manager6/qemu/HDEdit.js | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js
index 798dc4b2..cf68c952 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -116,6 +116,10 @@ Ext.define('PVE.form.ControllerSelector', {
if (me.selectFree) {
me.setVMConfig(me.vmconfig);
+ } else if (me.selectConfid) {
+ let [_, controller, deviceid] = me.selectConfid.match(/(\w+?)(\d+)/);
+ me.down('#controller').setValue(controller);
+ me.down('#deviceid').setValue(deviceid);
}
},
});
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 3edc077d..76c281c7 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -191,7 +191,8 @@ Ext.define('PVE.qemu.HDInputPanel', {
if (!me.confid || me.unused) {
me.bussel = Ext.create('PVE.form.ControllerSelector', {
vmconfig: me.vmconfig,
- selectFree: true,
+ selectFree: !me.preSelectConfid,
+ selectConfid: me.preSelectConfid,
});
column1.push(me.bussel);
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 10/19] ui: multi HD edit: pre select passed-in config ID
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (8 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 09/19] ui: HD edit: allow preselecting config ID Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 11/19] ui: multi disk edit: allow setting config ID when adding disk Fabian Ebner
` (8 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Previously, the next free config ID was re-computed when initializing
the controller selector.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/MultiHDEdit.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/www/manager6/qemu/MultiHDEdit.js b/www/manager6/qemu/MultiHDEdit.js
index b2e8141e..c981cd98 100644
--- a/www/manager6/qemu/MultiHDEdit.js
+++ b/www/manager6/qemu/MultiHDEdit.js
@@ -30,6 +30,7 @@ Ext.define('PVE.qemu.MultiHDPanel', {
itemId,
isCreate: true,
insideWizard: true,
+ preSelectConfid: confid,
});
},
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 11/19] ui: multi disk edit: allow setting config ID when adding disk
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (9 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 10/19] ui: multi HD edit: pre select passed-in " Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 12/19] ui: multi disk edit: add removeAllDisks function Fabian Ebner
` (7 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/panel/MultiDiskEdit.js | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index c1fd0617..7ba8246a 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -34,26 +34,35 @@ Ext.define('PVE.panel.MultiDiskPanel', {
// define in subclass
diskSorter: undefined,
- addDisk: function() {
+ addDisk: function(confid) {
let me = this;
let grid = me.lookup('grid');
let store = grid.getStore();
// get free disk id
let vmconfig = me.getVMConfig(true);
- let nextFreeDisk = me.getNextFreeDisk(vmconfig);
- if (!nextFreeDisk) {
+
+ if (!confid) {
+ let nextFreeDisk = me.getNextFreeDisk(vmconfig);
+ if (!nextFreeDisk) {
+ return;
+ }
+ confid = nextFreeDisk.confid;
+ }
+
+ if (store.findRecord('name', confid, 0, false, true, true) !== null) {
+ console.warn(`multi disk panel - disk for ${confid} already defined!`);
return;
}
// add store entry + panel
let itemId = 'disk-card-' + ++Ext.idSeed;
let rec = store.add({
- name: nextFreeDisk.confid,
+ name: confid,
itemId,
})[0];
- let panel = me.addPanel(itemId, vmconfig, nextFreeDisk.confid);
+ let panel = me.addPanel(itemId, vmconfig, confid);
panel.updateVMConfig(vmconfig);
// we need to setup a validitychange handler, so that we can show
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 12/19] ui: multi disk edit: add removeAllDisks function
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (10 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 11/19] ui: multi disk edit: allow setting config ID when adding disk Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 13/19] ui: multi disk edit: allow adding a disk with existing settings Fabian Ebner
` (6 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
to be used by the upcoming import functionality.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/panel/MultiDiskEdit.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index 7ba8246a..ace10eea 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -5,6 +5,10 @@ Ext.define('PVE.panel.MultiDiskPanel', {
this.items.each((panel) => panel.setNodename(nodename));
},
+ removeAllDisks: function() {
+ this.getController().removeAllDisks();
+ },
+
border: false,
bodyBorder: false,
@@ -82,6 +86,18 @@ Ext.define('PVE.panel.MultiDiskPanel', {
}
},
+ removeAllDisks: function() {
+ let me = this;
+ let grid = me.lookup('grid');
+
+ grid.getSelectionModel().select([], false);
+ me.getView().removeAll();
+ grid.getStore().setData([]);
+
+ me.updateVMConfig();
+ me.checkValidity();
+ },
+
getBaseVMConfig: function() {
throw "implement in subclass";
},
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 13/19] ui: multi disk edit: allow adding a disk with existing settings
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (11 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 12/19] ui: multi disk edit: add removeAllDisks function Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 14/19] ui: multi disk edit: expose addDisk outside of the controller Fabian Ebner
` (5 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/lxc/MultiMPEdit.js | 7 ++++++-
www/manager6/panel/MultiDiskEdit.js | 6 +++---
www/manager6/qemu/MultiHDEdit.js | 11 +++++++++--
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/www/manager6/lxc/MultiMPEdit.js b/www/manager6/lxc/MultiMPEdit.js
index 7310ad05..15d33e15 100644
--- a/www/manager6/lxc/MultiMPEdit.js
+++ b/www/manager6/lxc/MultiMPEdit.js
@@ -30,8 +30,13 @@ Ext.define('PVE.lxc.MultiMPPanel', {
return nextFreeDisk;
},
- addPanel: function(itemId, vmconfig, confid) {
+ addPanel: function(itemId, vmconfig, confid, settings) {
let me = this;
+
+ if (settings) {
+ console.warn("MultiMPPanel - volume settings ignored");
+ }
+
return me.getView().add({
vmconfig,
border: false,
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index ace10eea..cdc1df42 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -31,14 +31,14 @@ Ext.define('PVE.panel.MultiDiskPanel', {
throw "implement in subclass";
},
- addPanel: function(itemId, vmconfig, confid) {
+ addPanel: function(itemId, vmconfig, confid, settings) {
throw "implement in subclass";
},
// define in subclass
diskSorter: undefined,
- addDisk: function(confid) {
+ addDisk: function(confid, settings) {
let me = this;
let grid = me.lookup('grid');
let store = grid.getStore();
@@ -66,7 +66,7 @@ Ext.define('PVE.panel.MultiDiskPanel', {
itemId,
})[0];
- let panel = me.addPanel(itemId, vmconfig, confid);
+ let panel = me.addPanel(itemId, vmconfig, confid, settings);
panel.updateVMConfig(vmconfig);
// we need to setup a validitychange handler, so that we can show
diff --git a/www/manager6/qemu/MultiHDEdit.js b/www/manager6/qemu/MultiHDEdit.js
index c981cd98..e6cc9676 100644
--- a/www/manager6/qemu/MultiHDEdit.js
+++ b/www/manager6/qemu/MultiHDEdit.js
@@ -16,9 +16,10 @@ Ext.define('PVE.qemu.MultiHDPanel', {
return PVE.Utils.nextFreeDisk(clist, vmconfig);
},
- addPanel: function(itemId, vmconfig, confid) {
+ addPanel: function(itemId, vmconfig, confid, settings) {
let me = this;
- return me.getView().add({
+
+ let newPanel = me.getView().add({
vmconfig,
border: false,
showAdvanced: Ext.state.Manager.getProvider().get('proxmox-advanced-cb'),
@@ -32,6 +33,12 @@ Ext.define('PVE.qemu.MultiHDPanel', {
insideWizard: true,
preSelectConfid: confid,
});
+
+ if (settings) {
+ newPanel.setDrive(settings);
+ }
+
+ return newPanel;
},
getBaseVMConfig: function() {
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 14/19] ui: multi disk edit: expose addDisk outside of the controller
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (12 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 13/19] ui: multi disk edit: allow adding a disk with existing settings Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 15/19] ui: HD edit: set drive: make specifying file/volid optional Fabian Ebner
` (4 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
for convenience when calling it upon import from the wizard.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/panel/MultiDiskEdit.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index cdc1df42..5e0e3ea8 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -9,6 +9,10 @@ Ext.define('PVE.panel.MultiDiskPanel', {
this.getController().removeAllDisks();
},
+ addDisk: function(confid, settings) {
+ this.getController().addDisk(confid, settings);
+ },
+
border: false,
bodyBorder: false,
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 15/19] ui: HD edit: set drive: make specifying file/volid optional
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (13 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 14/19] ui: multi disk edit: expose addDisk outside of the controller Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 16/19] ui: HD edit: support setting an import path in setDrive Fabian Ebner
` (3 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
In preparation for the import from OVF functionality in the wizard,
where the disk's volid isn't known yet (only the import source is).
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/HDEdit.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 76c281c7..7acb922c 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -144,13 +144,16 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.drive = drive;
- var values = {};
- var match = drive.file.match(/^([^:]+):/);
- if (match) {
- values.hdstorage = match[1];
+ let values = {};
+ if (drive.file) {
+ let match = drive.file.match(/^([^:]+):/);
+ if (match) {
+ values.hdstorage = match[1];
+ }
+
+ values.hdimage = drive.file;
}
- values.hdimage = drive.file;
values.backup = PVE.Parser.parseBoolean(drive.backup, 1);
values.noreplicate = !PVE.Parser.parseBoolean(drive.replicate, 1);
values.diskformat = drive.format || 'raw';
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 16/19] ui: HD edit: support setting an import path in setDrive
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (14 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 15/19] ui: HD edit: set drive: make specifying file/volid optional Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 17/19] ui: qemu: memory edit: expose setMemory outside the controller Fabian Ebner
` (2 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/HDEdit.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 7acb922c..991cc16a 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -142,6 +142,9 @@ Ext.define('PVE.qemu.HDInputPanel', {
setDrive: function(drive) {
var me = this;
+ let importPath = drive.importPath;
+ delete drive.importPath;
+
me.drive = drive;
let values = {};
@@ -173,6 +176,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
values.iops_rd_max = drive.iops_rd_max;
values.iops_wr_max = drive.iops_wr_max;
+ if (importPath) {
+ values[`diskSource-${me.id}`] = 'path';
+ values.sourcePath = importPath;
+
+ // Doesn't happen automatically if not rendered yet.
+ me.down('radiofield[inputValue=empty]').setValue(false);
+ me.down('radiofield[inputValue=volume]').setValue(false);
+ }
+
me.setValues(values);
},
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 17/19] ui: qemu: memory edit: expose setMemory outside the controller
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (15 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 16/19] ui: HD edit: support setting an import path in setDrive Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 18/19] ui: qemu: memory edit: allow passing explicit value Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 19/19] ui: qemu: wizard: add import from OVF functionality Fabian Ebner
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
In preparation to add a 'value' argument, because when the controller
calls the function, the panel is passed as the first argument.
And for convenience when calling from outside the class.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/MemoryEdit.js | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 5e91dc9b..0d2cd8b0 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -17,20 +17,25 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
},
setMemory: function() {
- let me = this;
- let view = me.getView(), viewModel = me.getViewModel();
- if (view.insideWizard) {
- let memory = view.down('pveMemoryField[name=memory]');
- // NOTE: we only set memory but that then sets balloon in its change handler
- if (viewModel.get('current.ostype') === 'win11') {
- memory.setValue('4096');
- } else {
- memory.setValue('2048');
- }
- }
+ this.getView().setMemory();
},
},
+ setMemory: function() {
+ let me = this;
+ let viewModel = me.getViewModel();
+
+ if (me.insideWizard) {
+ let memory = me.down('pveMemoryField[name=memory]');
+ // NOTE: we only set memory but that then sets balloon in its change handler
+ if (viewModel.get('current.ostype') === 'win11') {
+ memory.setValue('4096');
+ } else {
+ memory.setValue('2048');
+ }
+ }
+ },
+
onGetValues: function(values) {
var me = this;
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 18/19] ui: qemu: memory edit: allow passing explicit value
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (16 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 17/19] ui: qemu: memory edit: expose setMemory outside the controller Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 19/19] ui: qemu: wizard: add import from OVF functionality Fabian Ebner
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
Will be used by the import functionality in the wizard.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/MemoryEdit.js | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 0d2cd8b0..ad018ecf 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -5,6 +5,8 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
insideWizard: false,
+ memoryInitialized: false,
+
viewModel: {}, // inherit data from createWizard if insideWizard
controller: {
@@ -21,12 +23,14 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
},
},
- setMemory: function() {
+ setMemory: function(value) {
let me = this;
let viewModel = me.getViewModel();
+ let memory = me.down('pveMemoryField[name=memory]');
- if (me.insideWizard) {
- let memory = me.down('pveMemoryField[name=memory]');
+ if (value) {
+ memory.setValue(value);
+ } else if (!me.memoryInitialized && me.insideWizard) {
// NOTE: we only set memory but that then sets balloon in its change handler
if (viewModel.get('current.ostype') === 'win11') {
memory.setValue('4096');
@@ -34,6 +38,8 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
memory.setValue('2048');
}
}
+
+ me.memoryInitialized = true;
},
onGetValues: function(values) {
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [pve-devel] [PATCH v10 manager 19/19] ui: qemu: wizard: add import from OVF functionality
2022-04-06 8:03 [pve-devel] [PATCH-SERIES v10 manager] Add GUI to import disk & VM Fabian Ebner
` (17 preceding siblings ...)
2022-04-06 8:04 ` [pve-devel] [PATCH v10 manager 18/19] ui: qemu: memory edit: allow passing explicit value Fabian Ebner
@ 2022-04-06 8:04 ` Fabian Ebner
18 siblings, 0 replies; 20+ messages in thread
From: Fabian Ebner @ 2022-04-06 8:04 UTC (permalink / raw)
To: pve-devel
From: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
[FE: Split out preparatory work, and re-use existing classes
Show message upon successfull readovf API call
Simplify a few things]
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/qemu/CreateWizard.js | 61 +++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index a785a882..d522c09b 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -22,6 +22,7 @@ Ext.define('PVE.qemu.CreateWizard', {
{
xtype: 'inputpanel',
title: gettext('General'),
+ itemId: 'generalPanel',
onlineHelp: 'qm_general_settings',
column1: [
{
@@ -63,6 +64,63 @@ Ext.define('PVE.qemu.CreateWizard', {
value: '',
allowBlank: true,
},
+ {
+ xtype: 'textfield',
+ name: 'ovfTextfield',
+ emptyText: '/path/to/manifest.ovf',
+ fieldLabel: gettext('Import from OVF'),
+ hidden: Proxmox.UserName !== 'root@pam',
+ },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Load .ovf'),
+ hidden: Proxmox.UserName !== 'root@pam',
+ handler: function() {
+ const inputpanel = this.up('#generalPanel');
+ const nodename = inputpanel.down('pveNodeSelector').getValue();
+ const ovfTextfieldValue = inputpanel.down('textfield[name=ovfTextfield]').getValue();
+ const wizard = this.up('window');
+
+ Proxmox.Utils.API2Request({
+ url: `/nodes/${nodename}/readovf`,
+ method: 'GET',
+ params: {
+ manifest: ovfTextfieldValue,
+ },
+ success: function(response) {
+ const ovfData = response.result.data;
+
+ wizard.down('textfield[name=name]').setValue(ovfData.name);
+ wizard.down('#cpuPanel').getViewModel().set('coreCount', ovfData.cores);
+ wizard.down('#memoryPanel').setMemory(ovfData.memory);
+
+ delete ovfData.cores;
+ delete ovfData.name;
+ delete ovfData.memory;
+
+ let multiDiskPanel = wizard.down('pveMultiHDPanel');
+ multiDiskPanel.removeAllDisks();
+ Object.keys(ovfData).sort().forEach(function(drive) {
+ multiDiskPanel.addDisk(drive, { 'importPath': ovfData[drive] });
+ });
+
+ wizard.down('radiofield[inputValue=none]').setValue(true);
+ // Need to manually uncheck when not yet rendered.
+ wizard.down('radiofield[inputValue=iso]').setValue(false);
+
+ Ext.Msg.show({
+ title: gettext('Success'),
+ icon: Ext.Msg.INFO,
+ msg: gettext('VM settings updated'),
+ buttons: Ext.Msg.OK,
+ });
+ },
+ failure: function(response) {
+ Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+ },
+ });
+ },
+ },
],
advancedColumn1: [
{
@@ -120,6 +178,7 @@ Ext.define('PVE.qemu.CreateWizard', {
delete values.order;
delete values.up;
delete values.down;
+ delete values.ovfTextfield;
return values;
},
@@ -162,11 +221,13 @@ Ext.define('PVE.qemu.CreateWizard', {
},
{
xtype: 'pveQemuProcessorPanel',
+ itemId: 'cpuPanel',
insideWizard: true,
title: gettext('CPU'),
},
{
xtype: 'pveQemuMemoryPanel',
+ itemId: 'memoryPanel',
insideWizard: true,
title: gettext('Memory'),
},
--
2.30.2
^ permalink raw reply [flat|nested] 20+ messages in thread