From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A521DE14A for ; Thu, 21 Apr 2022 13:27:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 681A41E335 for ; Thu, 21 Apr 2022 13:27:12 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 78F4F1E25B for ; Thu, 21 Apr 2022 13:27:07 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 50E2242689 for ; Thu, 21 Apr 2022 13:27:07 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 21 Apr 2022 13:26:58 +0200 Message-Id: <20220421112659.74011-13-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220421112659.74011-1-f.ebner@proxmox.com> References: <20220421112659.74011-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.088 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v2 manager 2/3] ui: restore: allow override of some settings X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 11:27:37 -0000 Signed-off-by: Fabian Ebner --- New in v2. Dependency bump for qemu-server needed www/manager6/window/Restore.js | 77 +++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js index 25babf89..23c244f3 100644 --- a/www/manager6/window/Restore.js +++ b/www/manager6/window/Restore.js @@ -21,6 +21,7 @@ Ext.define('PVE.window.Restore', { Proxmox.Utils.API2Request({ url: `/nodes/${view.nodename}/vzdump/extractconfig`, + waitMsgTarget: view, method: 'GET', params: { volume: view.volid, @@ -38,6 +39,28 @@ Ext.define('PVE.window.Restore', { `storage/${view.nodename}/${match[3]}`, ); storagesAvailable = storagesAvailable && currentAvailable; + } else { + match = line.match(/^([^:]+):\s*(\S+)\s*$/); + if (match) { + let [_, key, value] = match; + switch (key) { + case 'name': + case 'hostname': + view.lookupReference('nameField').setEmptyText(value); + break; + case 'memory': + view.lookupReference('memoryField').setEmptyText(value); + break; + case 'cores': + view.lookupReference('coresField').setEmptyText(value); + break; + case 'sockets': + view.lookupReference('socketsField').setEmptyText(value); + break; + default: + break; + } + } } }); @@ -207,6 +230,49 @@ Ext.define('PVE.window.Restore', { }); } + items.push( + { + xtype: 'displayfield', + value: `${gettext('Override Settings')}:`, + }, + { + xtype: 'textfield', + fieldLabel: gettext('Name'), + name: 'name', + reference: 'nameField', + allowBlank: true, + }, + { + xtype: 'pveMemoryField', + fieldLabel: gettext('Memory'), + name: 'memory', + reference: 'memoryField', + value: '', + allowBlank: true, + }, + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Cores'), + name: 'cores', + reference: 'coresField', + minValue: 1, + maxValue: 128, + allowBlank: true, + }, + ); + + if (me.vmtype === 'qemu') { + items.push({ + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Sockets'), + name: 'sockets', + reference: 'socketsField', + minValue: 1, + maxValue: 4, + allowBlank: true, + }); + } + me.formPanel = Ext.create('Ext.form.Panel', { bodyPadding: 10, border: false, @@ -254,8 +320,15 @@ Ext.define('PVE.window.Restore', { if (values['live-restore']) { params['live-restore'] = 1; } if (values.storage) { params.storage = values.storage; } - if (values.bwlimit !== undefined) { - params.bwlimit = values.bwlimit; + ['bwlimit', 'cores', 'name', 'memory', 'sockets'].forEach(function(opt) { + if (values[opt] !== undefined && values[opt] !== null && values[opt] !== '') { + params[opt] = values[opt]; + } + }); + + if (params.name && me.vmtype === 'lxc') { + params.hostname = params.name; + delete params.name; } var url; -- 2.30.2