public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: tape: fix restore datastore mapping parameter construction
@ 2023-06-06  9:20 Dominik Csapak
  2023-06-06 11:14 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2023-06-06  9:20 UTC (permalink / raw)
  To: pbs-devel

We recently took into account the selected datastore when restoring from
tape, but the snapshot grids value may not only be a single datastore, it can
also be a list of snapshots, datastores or 'all'.

handle these cases and extract the source datastore correctly.

This fixes tape restoration when not a whole datastore is selected.

Reported in the forum:
https://forum.proxmox.com/threads/restore-from-lto-parameter-verification-errors-store.128445

Fixes: df881ed0 ("ui: tape: fix restoring a single datastore")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
this patch should also apply cleanly on the stable-2 branch currently

 www/tape/window/TapeRestore.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js
index 2ff7c4dd..c1d3493c 100644
--- a/www/tape/window/TapeRestore.js
+++ b/www/tape/window/TapeRestore.js
@@ -380,6 +380,19 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 			if (values.store.toString() !== "") {
 			    if (vm.get('singleDatastore')) {
 				let source = controller.lookup('snapshotGrid').getValue();
+				if (source === 'all') {
+				    // all values are selected
+				    source = values.store;
+				} else if (Ext.isArray(source)) {
+				    if (source[0].indexOf(':') !== -1) {
+					// one or multiple snapshots are selected
+					// extract datastore from first
+					source = source[0].split(':')[0];
+				    } else {
+					// one whole datstore is selected
+					source = source[0];
+				    }
+				}
 				datastores.push(`${source}=${values.store}`);
 			    } else {
 				datastores.push(values.store);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] ui: tape: fix restore datastore mapping parameter construction
  2023-06-06  9:20 [pbs-devel] [PATCH proxmox-backup] ui: tape: fix restore datastore mapping parameter construction Dominik Csapak
@ 2023-06-06 11:14 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-06-06 11:14 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

Am 06/06/2023 um 11:20 schrieb Dominik Csapak:
> We recently took into account the selected datastore when restoring from
> tape, but the snapshot grids value may not only be a single datastore, it can
> also be a list of snapshots, datastores or 'all'.
> 
> handle these cases and extract the source datastore correctly.
> 
> This fixes tape restoration when not a whole datastore is selected.
> 
> Reported in the forum:
> https://forum.proxmox.com/threads/restore-from-lto-parameter-verification-errors-store.128445
> 
> Fixes: df881ed0 ("ui: tape: fix restoring a single datastore")
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> this patch should also apply cleanly on the stable-2 branch currently
> 
>  www/tape/window/TapeRestore.js | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
>

applied, thanks!

A bit unrelated from this, but the code here would benefit IMO from ensuring
that for every variable/viewModel entry with datastore in its name, it is made
clear if that is talking about the source or the target...




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-06 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06  9:20 [pbs-devel] [PATCH proxmox-backup] ui: tape: fix restore datastore mapping parameter construction Dominik Csapak
2023-06-06 11:14 ` [pbs-devel] applied: " Thomas Lamprecht

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