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 7B88266EEF; Mon, 11 Jan 2021 12:15:17 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C16A01922E; Mon, 11 Jan 2021 12:14:46 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 58F1B1912C; Mon, 11 Jan 2021 12:14:41 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 25E9F45796; Mon, 11 Jan 2021 12:14:41 +0100 (CET) From: Stefan Reiter To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Date: Mon, 11 Jan 2021 12:14:09 +0100 Message-Id: <20210111111409.32385-12-s.reiter@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210111111409.32385-1-s.reiter@proxmox.com> References: <20210111111409.32385-1-s.reiter@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.040 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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 manager 11/11] ui: restore: add live-restore checkbox 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: Mon, 11 Jan 2021 11:15:17 -0000 Add 'isPBS' parameter for Restore window so we can detect when to show the 'live-restore' checkbox. Includes a warning about this feature being experimental for now. Signed-off-by: Stefan Reiter --- www/manager6/grid/BackupView.js | 8 +++++-- www/manager6/storage/BackupView.js | 7 ++++-- www/manager6/window/Restore.js | 38 +++++++++++++++++++++++++++++- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/www/manager6/grid/BackupView.js b/www/manager6/grid/BackupView.js index 9312c59c..41708030 100644 --- a/www/manager6/grid/BackupView.js +++ b/www/manager6/grid/BackupView.js @@ -79,6 +79,7 @@ Ext.define('PVE.grid.BackupView', { } }, 100); + let isPBS = false; var setStorage = function(storage) { var url = '/api2/json/nodes/' + nodename + '/storage/' + storage + '/content'; url += '?content=backup'; @@ -101,13 +102,15 @@ Ext.define('PVE.grid.BackupView', { change: function(f, value) { let storage = f.getStore().findRecord('storage', value, 0, false, true, true); if (storage) { - let isPBS = storage.data.type === 'pbs'; + isPBS = storage.data.type === 'pbs'; me.getColumns().forEach((column) => { let id = column.dataIndex; if (id === 'verification' || id === 'encrypted') { column.setHidden(!isPBS); } }); + } else { + isPBS = false; } setStorage(value); } @@ -175,7 +178,8 @@ Ext.define('PVE.grid.BackupView', { vmid: vmid, volid: rec.data.volid, volidText: PVE.Utils.render_storage_content(rec.data.volid, {}, rec), - vmtype: vmtype + vmtype: vmtype, + isPBS: isPBS, }); win.show(); win.on('destroy', reload); diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js index 8c5a286d..63418ec9 100644 --- a/www/manager6/storage/BackupView.js +++ b/www/manager6/storage/BackupView.js @@ -74,6 +74,8 @@ Ext.define('PVE.storage.BackupView', { } }); + let isPBS = me.pluginType === 'pbs'; + me.tbar = [ { xtype: 'proxmoxButton', @@ -94,7 +96,8 @@ Ext.define('PVE.storage.BackupView', { nodename: nodename, volid: rec.data.volid, volidText: PVE.Utils.render_storage_content(rec.data.volid, {}, rec), - vmtype: vmtype + vmtype: vmtype, + isPBS: isPBS, }); win.show(); win.on('destroy', reload); @@ -117,7 +120,7 @@ Ext.define('PVE.storage.BackupView', { pruneButton, ]; - if (me.pluginType === 'pbs') { + if (isPBS) { me.extraColumns = { encrypted: { header: gettext('Encrypted'), diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js index f720eb3b..9fe50ec2 100644 --- a/www/manager6/window/Restore.js +++ b/www/manager6/window/Restore.js @@ -3,6 +3,20 @@ Ext.define('PVE.window.Restore', { resizable: false, + controller: { + xclass: 'Ext.app.ViewController', + control: { + '#liveRestore': { + change: function(el, newVal) { + let liveWarning = this.lookupReference('liveWarning'); + liveWarning.setHidden(!newVal); + let start = this.lookupReference('start'); + start.setDisabled(newVal); + } + }, + } + }, + initComponent : function() { var me = this; @@ -84,6 +98,7 @@ Ext.define('PVE.window.Restore', { { xtype: 'proxmoxcheckbox', name: 'start', + reference: 'start', flex: 1, fieldLabel: gettext('Start after restore'), labelWidth: 105, @@ -99,6 +114,26 @@ Ext.define('PVE.window.Restore', { value: true, fieldLabel: gettext('Unprivileged container') }); + } else if (me.vmtype === 'qemu') { + items.push({ + xtype: 'proxmoxcheckbox', + name: 'live-restore', + itemId: 'liveRestore', + flex: 1, + fieldLabel: gettext('Live restore'), + checked: false, + hidden: !me.isPBS, + // align checkbox with 'start' if 'unique' is hidden + labelWidth: !!me.vmid ? 105 : 100, + }); + items.push({ + xtype: 'displayfield', + reference: 'liveWarning', + // TODO: Remove once more tested/stable? + value: gettext('Warning: Live-restore is experimental! The VM will start immediately (with a disk performance penalty) and restore will happen in the background. If anything goes wrong, data written by the VM during the restore will be lost.'), + userCls: 'pmx-hint', + hidden: true, + }); } me.formPanel = Ext.create('Ext.form.Panel', { @@ -144,7 +179,8 @@ Ext.define('PVE.window.Restore', { force: me.vmid ? 1 : 0 }; if (values.unique) { params.unique = 1; } - if (values.start) { params.start = 1; } + if (values.start && !values['live-restore']) { params.start = 1; } + if (values['live-restore']) { params['live-restore'] = 1; } if (values.storage) { params.storage = values.storage; } if (values.bwlimit !== undefined) { -- 2.20.1