all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v3 manager 1/3] ui: restore: disallow empty storage selection if it wouldn't work
Date: Tue, 26 Apr 2022 14:30:53 +0200	[thread overview]
Message-ID: <20220426123055.110358-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20220426123055.110358-1-f.ebner@proxmox.com>

Namely, if there is a storage in the backup configuration that's not
available on the current node.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

Changes from v2:
    * Improve style.
    * Handle when no storage hint is present correctly.

 www/manager6/window/Restore.js | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js
index e48aac1a..51f7d063 100644
--- a/www/manager6/window/Restore.js
+++ b/www/manager6/window/Restore.js
@@ -94,6 +94,37 @@ Ext.define('PVE.window.Restore', {
 		executeRestore();
 	    }
 	},
+
+	afterRender: function() {
+	    let view = this.getView();
+
+	    Proxmox.Utils.API2Request({
+		url: `/nodes/${view.nodename}/vzdump/extractconfig`,
+		method: 'GET',
+		waitMsgTarget: view,
+		params: {
+		    volume: view.volid,
+		},
+		failure: response => Ext.Msg.alert('Error', response.htmlStatus),
+		success: function(response, options) {
+		    let allStoragesAvailable = response.result.data.split('\n').every(line => {
+			let match = line.match(/^#qmdump#map:(\S+):(\S+):(\S*):(\S*):$/);
+			if (!match) {
+			    return true;
+			}
+			// if a /dev/XYZ disk was backed up, ther is no storage hint
+			return !!match[3] && !!PVE.data.ResourceStore.getById(
+			    `storage/${view.nodename}/${match[3]}`);
+		    });
+
+		    if (!allStoragesAvailable) {
+			let storagesel = view.down('pveStorageSelector[name=storage]');
+			storagesel.allowBlank = false;
+			storagesel.setEmptyText('');
+		    }
+		},
+	    });
+	},
     },
 
     initComponent: function() {
-- 
2.30.2





  parent reply	other threads:[~2022-04-26 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 12:30 [pve-devel] [PATCH-SERIES v3 qemu-server/manager] more flexible restore Fabian Ebner
2022-04-26 12:30 ` [pve-devel] [PATCH v3 qemu-server 1/3] api: create: refactor parameter check logic Fabian Ebner
2022-04-28  9:12   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-26 12:30 ` [pve-devel] [PATCH v3 qemu-server 2/3] api: create: allow overriding non-disk options during restore Fabian Ebner
2022-04-28  9:12   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-26 12:30 ` [pve-devel] [PATCH v3 qemu-server 3/3] restore: allow specifying drive actions " Fabian Ebner
2022-04-26 12:30 ` Fabian Ebner [this message]
2022-04-28  9:13   ` [pve-devel] applied: [PATCH v3 manager 1/3] ui: restore: disallow empty storage selection if it wouldn't work Thomas Lamprecht
2022-04-26 12:30 ` [pve-devel] [PATCH v3 manager 2/3] ui: restore: allow override of some settings Fabian Ebner
2022-04-28  9:13   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-26 12:30 ` [pve-devel] [PATCH v3 manager 3/3] ui: restore: allow treating disks differently Fabian Ebner

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=20220426123055.110358-5-f.ebner@proxmox.com \
    --to=f.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal