From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id F3B671FF0C0 for ; Wed, 18 Nov 2026 13:54:30 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 55EBC216A7; Wed, 18 Nov 2026 13:54:30 +0100 (CET) Message-ID: Date: Wed, 18 Nov 2026 13:54:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Samuel Rufinatscha Subject: Re: [RFC PATCH proxmox 01/12] pbs-api-types: add types and schemas for snapshot attributes To: Jakob-Tobias Winter , pbs-devel@lists.proxmox.com References: <20261113085637.57360-3-tobias@stuttgart.de> <20261113085637.57360-4-tobias@stuttgart.de> Content-Language: en-US In-Reply-To: <20261113085637.57360-4-tobias@stuttgart.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.174 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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 Message-ID-Hash: KBBZOJWDJLK2JLKAC3BGBC6EPXKTDJDW X-Message-ID-Hash: KBBZOJWDJLK2JLKAC3BGBC6EPXKTDJDW X-MailFrom: s.rufinatscha@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 11/13/26 10:07 AM, Jakob-Tobias Winter wrote: > Snapshots get attributes, each of them a key with a list of values. > They are meant for information a client knows about the source of a > backup, like the tags and the resource pool of a Proxmox VE guest. > > An attribute is passed as 'KEY=VALUE', once per value of a key. A > value is never joined with other values into one string, so a list > of tags cannot be garbled by a separator. > > Signed-off-by: Jakob-Tobias Winter > --- > pbs-api-types/src/datastore.rs | 22 +++++++++++++++++++++- > pbs-api-types/src/lib.rs | 3 +++ > 2 files changed, 24 insertions(+), 1 deletion(-) > > diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs > index 7685deee..978253ee 100644 > --- a/pbs-api-types/src/datastore.rs > +++ b/pbs-api-types/src/datastore.rs > @@ -1,4 +1,5 @@ > use std::borrow::Borrow; > +use std::collections::{BTreeMap, BTreeSet}; > use std::convert::{AsRef, TryFrom}; > use std::fmt; > use std::hash::{Hash, Hasher}; > @@ -28,7 +29,7 @@ use crate::{ > DATASTORE_NOTIFY_STRING_SCHEMA, Fingerprint, GC_SCHEDULE_SCHEMA, > GROUP_OR_SNAPSHOT_PATH_REGEX_STR, GroupFilter, MaintenanceMode, MaintenanceType, > PROXMOX_SAFE_ID_FORMAT, PROXMOX_SAFE_ID_REGEX_STR, PRUNE_SCHEDULE_SCHEMA, SHA256_HEX_REGEX, > - SINGLE_LINE_COMMENT_SCHEMA, SNAPSHOT_PATH_REGEX_STR, UPID, Userid, > + SINGLE_LINE_COMMENT_SCHEMA, SNAPSHOT_ATTRIBUTE_RE, SNAPSHOT_PATH_REGEX_STR, UPID, Userid, > VERIFY_JOB_READ_THREADS_SCHEMA, VERIFY_JOB_VERIFY_THREADS_SCHEMA, > }; > > @@ -52,6 +53,8 @@ const_regex! { > pub GROUP_OR_SNAPSHOT_PATH_REGEX = concatcp!(r"^", GROUP_OR_SNAPSHOT_PATH_REGEX_STR, r"$"); > > pub DATASTORE_MAP_REGEX = concatcp!(r"^(?:", PROXMOX_SAFE_ID_REGEX_STR, r"=)?", PROXMOX_SAFE_ID_REGEX_STR, r"$"); > + > + pub SNAPSHOT_ATTRIBUTE_REGEX = concatcp!(r"^", SNAPSHOT_ATTRIBUTE_RE, r"$"); > } > > pub const CHUNK_DIGEST_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&SHA256_HEX_REGEX); > @@ -90,6 +93,23 @@ pub const BACKUP_GROUP_SCHEMA: Schema = StringSchema::new("Backup Group") > .format(&BACKUP_GROUP_FORMAT) > .schema(); > > +pub const SNAPSHOT_ATTRIBUTE_FORMAT: ApiStringFormat = > + ApiStringFormat::Pattern(&SNAPSHOT_ATTRIBUTE_REGEX); > + > +pub const SNAPSHOT_ATTRIBUTE_SCHEMA: Schema = StringSchema::new( > + "Snapshot attribute, a key and one of its values. A key with several values is given once \ > + per value.", > +) > +.format(&SNAPSHOT_ATTRIBUTE_FORMAT) > +.type_text("KEY=VALUE") > +.schema(); > + > +pub const SNAPSHOT_ATTRIBUTE_LIST_SCHEMA: Schema = > + ArraySchema::new("List of snapshot attributes.", &SNAPSHOT_ATTRIBUTE_SCHEMA).schema(); > + > +/// The attributes of a snapshot, each key has a set of values. > +pub type SnapshotAttributes = BTreeMap>; > + > /// The maximal, inclusive depth for namespaces from the root ns downwards > /// > /// The datastore root name space is at depth zero (0), so we have in total eight (8) levels > diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs > index 21ef733d..cb1c231c 100644 > --- a/pbs-api-types/src/lib.rs > +++ b/pbs-api-types/src/lib.rs > @@ -94,6 +94,9 @@ pub const GROUP_OR_SNAPSHOT_PATH_REGEX_STR: &str = > r"(", BACKUP_TYPE_RE, ")/(", BACKUP_ID_RE, ")(?:/(", BACKUP_TIME_RE, r"))?", > ); > > +#[rustfmt::skip] > +pub const SNAPSHOT_ATTRIBUTE_RE: &str = r"[a-z][a-z0-9\-]{0,31}=[A-Za-z0-9._+/\-]{1,128}"; > + Is the 128 character limit on attribute values intentional? PVE accepts longer tags and pool names. Considering pool names can be nested, it may exceed the limit. I think this should be aligned to make sure it works with current definitions, also please make sure the docs are updated. > mod acl; > pub use acl::*; > > > base-commit: 9bf4383b6ad4225367c7824023ad74769388de8f