From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4DF056B27A for ; Tue, 16 Mar 2021 13:16:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3BE072DB02 for ; Tue, 16 Mar 2021 13:16:22 +0100 (CET) Received: from elsa.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP id 90A712DAF3 for ; Tue, 16 Mar 2021 13:16:21 +0100 (CET) Received: by elsa.proxmox.com (Postfix, from userid 0) id 4BE68AEABA5; Tue, 16 Mar 2021 13:10:31 +0100 (CET) From: Dietmar Maurer To: pbs-devel@lists.proxmox.com Date: Tue, 16 Mar 2021 13:10:22 +0100 Message-Id: <20210316121023.11702-1-dietmar@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [RFC: 1/2] SnapshotReader: add self.datastore_name() helper X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 12:16:52 -0000 --- 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, 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 { &self.file_list -- 2.20.1