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 EC24B619E6 for ; Fri, 20 Nov 2020 17:40:48 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E30DC153C7 for ; Fri, 20 Nov 2020 17:40:18 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS id C6640153BB for ; Fri, 20 Nov 2020 17:40:17 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 904D543D48 for ; Fri, 20 Nov 2020 17:40:17 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Fri, 20 Nov 2020 17:38:42 +0100 Message-Id: <20201120163845.1225080-13-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201120163845.1225080-1-f.gruenbichler@proxmox.com> References: <20201120163845.1225080-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [datastore.rs, mod.rs] Subject: [pbs-devel] [PATCH proxmox-backup 12/13] list_snapshots: return manifest fingerprint 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: Fri, 20 Nov 2020 16:40:49 -0000 for display in clients. Signed-off-by: Fabian Grünbichler --- Notes: new in v2 backwards-compatible API change (adds new field) src/api2/admin/datastore.rs | 10 ++++++++++ src/api2/types/mod.rs | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index de0c8de3..00f98c66 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -403,6 +403,14 @@ pub fn list_snapshots ( .and_then(|notes| notes.lines().next()) .map(String::from); + let fingerprint = match manifest.fingerprint() { + Ok(fp) => fp, + Err(err) => { + eprintln!("error parsing fingerprint: '{}'", err); + None + }, + }; + let verification = manifest.unprotected["verify_state"].clone(); let verification: Option = match serde_json::from_value(verification) { Ok(verify) => verify, @@ -420,6 +428,7 @@ pub fn list_snapshots ( backup_time, comment, verification, + fingerprint, files, size, owner, @@ -443,6 +452,7 @@ pub fn list_snapshots ( backup_time, comment: None, verification: None, + fingerprint: None, files, size: None, owner, diff --git a/src/api2/types/mod.rs b/src/api2/types/mod.rs index d7d5a8af..b347fc29 100644 --- a/src/api2/types/mod.rs +++ b/src/api2/types/mod.rs @@ -5,7 +5,7 @@ use proxmox::api::{api, schema::*}; use proxmox::const_regex; use proxmox::{IPRE, IPRE_BRACKET, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32}; -use crate::backup::{CryptMode, BACKUP_ID_REGEX}; +use crate::backup::{CryptMode, Fingerprint, BACKUP_ID_REGEX}; use crate::server::UPID; #[macro_use] @@ -484,6 +484,10 @@ pub struct SnapshotVerifyState { type: SnapshotVerifyState, optional: true, }, + fingerprint: { + type: String, + optional: true, + }, files: { items: { schema: BACKUP_ARCHIVE_NAME_SCHEMA @@ -508,6 +512,9 @@ pub struct SnapshotListItem { /// The result of the last run verify task #[serde(skip_serializing_if="Option::is_none")] pub verification: Option, + /// Fingerprint of encryption key + #[serde(skip_serializing_if="Option::is_none")] + pub fingerprint: Option, /// List of contained archive files. pub files: Vec, /// Overall snapshot size (sum of all archive sizes). -- 2.20.1