all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] tape restore: show required tape list on single snapshot restore
Date: Fri,  5 May 2023 16:38:42 +0200	[thread overview]
Message-ID: <20230505143842.1108765-1-d.csapak@proxmox.com> (raw)

like we do on a full restore, for that refactor the functionality into
'log_required_tapes' to be reused across the workers

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/tape/restore.rs | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs
index 43d34473..7b4fee9c 100644
--- a/src/api2/tape/restore.rs
+++ b/src/api2/tape/restore.rs
@@ -495,12 +495,11 @@ fn restore_full_worker(
         .join(", ");
     task_log!(worker, "Datastore(s): {datastore_list}",);
     task_log!(worker, "Drive: {drive_name}");
-    let required_media = media_id_list
-        .iter()
-        .map(|media_id| media_id.label.label_text.as_str())
-        .collect::<Vec<&str>>()
-        .join(";");
-    task_log!(worker, "Required media list: {required_media}",);
+    log_required_tapes(
+        &worker,
+        &inventory,
+        media_id_list.iter().map(|id| &id.label.uuid),
+    );
 
     let mut datastore_locks = Vec::new();
     for (target, _) in used_datastores.values() {
@@ -607,6 +606,25 @@ fn check_snapshot_restorable(
     Ok(can_restore_some)
 }
 
+fn log_required_tapes<'a>(
+    worker: &WorkerTask,
+    inventory: &Inventory,
+    list: impl Iterator<Item = &'a Uuid>,
+) {
+    let mut tape_list = list
+        .map(|uuid| {
+            inventory
+                .lookup_media(uuid)
+                .unwrap()
+                .label
+                .label_text
+                .as_str()
+        })
+        .collect::<Vec<&str>>();
+    tape_list.sort_unstable();
+    task_log!(worker, "Required media list: {}", tape_list.join(";"));
+}
+
 #[allow(clippy::too_many_arguments)]
 fn restore_list_worker(
     worker: Arc<WorkerTask>,
@@ -751,6 +769,7 @@ fn restore_list_worker(
         }
 
         task_log!(worker, "Phase 1: temporarily restore snapshots to temp dir");
+        log_required_tapes(&worker, &inventory, snapshot_file_hash.keys());
         let mut datastore_chunk_map: HashMap<String, HashSet<[u8; 32]>> = HashMap::new();
         let mut tmp_paths = Vec::new();
         for (media_uuid, file_list) in snapshot_file_hash.iter_mut() {
@@ -804,6 +823,7 @@ fn restore_list_worker(
 
         if !media_file_chunk_map.is_empty() {
             task_log!(worker, "Phase 2: restore chunks to datastores");
+            log_required_tapes(&worker, &inventory, media_file_chunk_map.keys());
         } else {
             task_log!(worker, "All chunks are already present, skip phase 2...");
         }
-- 
2.30.2





             reply	other threads:[~2023-05-05 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 14:38 Dominik Csapak [this message]
2023-05-09  8:13 ` [pbs-devel] applied " Dietmar Maurer

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=20230505143842.1108765-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-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