public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [RFC: 1/2] SnapshotReader: add self.datastore_name() helper
@ 2021-03-16 12:10 Dietmar Maurer
  2021-03-16 12:10 ` [pbs-devel] [RFC: 2/2] tape: store datastore name in snapshot archives and media catalog Dietmar Maurer
  0 siblings, 1 reply; 2+ messages in thread
From: Dietmar Maurer @ 2021-03-16 12:10 UTC (permalink / raw)
  To: pbs-devel

---
 src/tape/helpers/snapshot_reader.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/tape/helpers/snapshot_reader.rs b/src/tape/helpers/snapshot_reader.rs
index 21033d10..7b272e37 100644
--- a/src/tape/helpers/snapshot_reader.rs
+++ b/src/tape/helpers/snapshot_reader.rs
@@ -26,6 +26,7 @@ use crate::{
 /// This make it easy to iterate over all used chunks and files.
 pub struct SnapshotReader {
     snapshot: BackupDir,
+    datastore_name: String,
     file_list: Vec<String>,
     locked_dir: Dir,
 }
@@ -42,11 +43,13 @@ impl SnapshotReader {
             "snapshot",
             "locked by another operation")?;
 
+        let datastore_name = datastore.name().to_string();
+
         let manifest = match datastore.load_manifest(&snapshot) {
             Ok((manifest, _)) => manifest,
             Err(err) => {
                 bail!("manifest load error on datastore '{}' snapshot '{}' - {}",
-                      datastore.name(), snapshot, err);
+                      datastore_name, snapshot, err);
             }
         };
 
@@ -60,7 +63,7 @@ impl SnapshotReader {
             file_list.push(CLIENT_LOG_BLOB_NAME.to_string());
         }
 
-        Ok(Self { snapshot, file_list, locked_dir })
+        Ok(Self { snapshot, datastore_name, file_list, locked_dir })
     }
 
     /// Return the snapshot directory
@@ -68,6 +71,11 @@ impl SnapshotReader {
         &self.snapshot
     }
 
+    /// Return the datastore name
+    pub fn datastore_name(&self) -> &str {
+        &self.datastore_name
+    }
+
     /// Returns the list of files the snapshot refers to.
     pub fn file_list(&self) -> &Vec<String> {
         &self.file_list
-- 
2.20.1




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

end of thread, other threads:[~2021-03-16 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 12:10 [pbs-devel] [RFC: 1/2] SnapshotReader: add self.datastore_name() helper Dietmar Maurer
2021-03-16 12:10 ` [pbs-devel] [RFC: 2/2] tape: store datastore name in snapshot archives and media catalog Dietmar Maurer

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