public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 11/11] ui: restore: add live-restore checkbox
Date: Mon, 11 Jan 2021 12:14:09 +0100	[thread overview]
Message-ID: <20210111111409.32385-12-s.reiter@proxmox.com> (raw)
In-Reply-To: <20210111111409.32385-1-s.reiter@proxmox.com>

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 <s.reiter@proxmox.com>
---
 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





  parent reply	other threads:[~2021-01-11 11:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 11:13 [pve-devel] [PATCH 00/11] live-restore for PBS snapshots Stefan Reiter
2021-01-11 11:13 ` [pve-devel] [PATCH qemu 01/11] PVE: explicitly add libuuid as linking dependency Stefan Reiter
2021-01-12 12:04   ` [pve-devel] [pbs-devel] " Thomas Lamprecht
2021-01-18 10:27     ` [pve-devel] [PATCH pve-qemu] explicitly specify " Stefan Reiter
2021-01-27  8:29       ` Stefan Reiter
2021-01-11 11:14 ` [pve-devel] [PATCH qemu 02/11] PVE: block/pbs: fast-path reads without allocation if possible Stefan Reiter
2021-01-12  9:29   ` Wolfgang Bumiller
2021-01-11 11:14 ` [pve-devel] [PATCH qemu 03/11] block: add alloc-track driver Stefan Reiter
2021-01-12 10:54   ` Wolfgang Bumiller
2021-01-12 11:29     ` Stefan Reiter
2021-01-12 13:42       ` Wolfgang Bumiller
2021-01-11 11:14 ` [pve-devel] [PATCH proxmox-backup 04/11] RemoteChunkReader: add LRU cached variant Stefan Reiter
2021-01-11 11:14 ` [pve-devel] [PATCH proxmox-backup-qemu 05/11] access: use bigger cache and LRU chunk reader Stefan Reiter
2021-01-11 11:14 ` [pve-devel] [PATCH qemu-server 06/11] make qemu_drive_mirror_monitor more generic Stefan Reiter
2021-01-12 13:19   ` Wolfgang Bumiller
2021-01-11 11:14 ` [pve-devel] [PATCH qemu-server 07/11] cfg2cmd: allow PBS snapshots as backing files for drives Stefan Reiter
2021-01-28 16:25   ` Thomas Lamprecht
2021-01-11 11:14 ` [pve-devel] [PATCH qemu-server 08/11] enable live-restore for PBS Stefan Reiter
2021-01-11 11:14 ` [pve-devel] [PATCH qemu-server 09/11] extract register_qmeventd_handle to QemuServer.pm Stefan Reiter
2021-01-11 11:14 ` [pve-devel] [PATCH qemu-server 10/11] live-restore: register qmeventd handle Stefan Reiter
2021-01-11 11:14 ` Stefan Reiter [this message]
2021-01-11 15:50 ` [pve-devel] [PATCH 00/11] live-restore for PBS snapshots aderumier
2021-01-11 16:42   ` Stefan Reiter
2021-01-12  9:10     ` aderumier
2021-01-12 10:31   ` [pve-devel] [pbs-devel] " Thomas Lamprecht
2021-01-12 11:23     ` 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=20210111111409.32385-12-s.reiter@proxmox.com \
    --to=s.reiter@proxmox.com \
    --cc=pbs-devel@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal