From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v3 08/15] pbs-datastore: use proxmox-product-config cached backup user
Date: Wed, 1 Jul 2026 16:04:05 +0200 [thread overview]
Message-ID: <20260701140412.200920-9-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260701140412.200920-1-c.ebner@proxmox.com>
Instead of looking it up, use the globally cached backup user info
provided by proxmox-product-config. The user is not allowed to change
change anyways during the runtime of the process, as otherwise all
sorts of permission issues can arise.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
pbs-datastore/src/datastore.rs | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index e2d1ae67c..06adbece5 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -488,14 +488,15 @@ impl DataStore {
let (config, _config_digest) = pbs_config::s3::config()?;
let config: S3ClientConf = config.lookup(S3_CFG_TYPE_ID, s3_client_id)?;
+ let backup_user = proxmox_product_config::get_api_user();
let rate_limiter_options = S3RateLimiterOptions {
id: s3_client_id.to_string(),
- user: pbs_config::backup_user()?,
+ user: backup_user.clone(),
base_path: S3_CLIENT_RATE_LIMITER_BASE_PATH.into(),
};
let request_counter_config = S3RequestCounterConfig {
id: format!("{s3_client_id}-{bucket}-{}", self.name()),
- user: pbs_config::backup_user()?,
+ user: backup_user.clone(),
base_path: S3_CLIENT_REQUEST_COUNTER_BASE_PATH.into(),
};
@@ -819,8 +820,9 @@ impl DataStore {
.ok_or(format_err!("missing s3 bucket"))?,
config.name,
);
+ let backup_user = proxmox_product_config::get_api_user();
let request_counters =
- SharedRequestCounters::open_shared_memory_mapped(path, pbs_config::backup_user()?)?;
+ SharedRequestCounters::open_shared_memory_mapped(path, backup_user.clone())?;
Ok(request_counters)
}
@@ -2653,7 +2655,7 @@ impl DataStore {
let mut path = self.base_path();
path.push(".gc-status");
- let backup_user = pbs_config::backup_user()?;
+ let backup_user = proxmox_product_config::get_api_user();
let mode = nix::sys::stat::Mode::from_bits_truncate(0o0644);
// set the correct owner/group/permissions while saving file
// owner(rw) = backup, group(r)= backup
@@ -3183,7 +3185,7 @@ impl DataStore {
// Fetch the contents (metadata, no chunks) of the datastore from the S3 object store to the
// provided temporaray directory
async fn fetch_tmp_contents(&self, tmp_base: &Path, s3_client: &S3Client) -> Result<(), Error> {
- let backup_user = pbs_config::backup_user().context("failed to get backup user")?;
+ let backup_user = proxmox_product_config::get_api_user();
let mode = nix::sys::stat::Mode::from_bits_truncate(0o0644);
let file_create_options = CreateOptions::new()
.perm(mode)
@@ -3336,14 +3338,15 @@ impl DataStore {
let client_config: S3ClientConf = config
.lookup(S3_CFG_TYPE_ID, s3_client_id)
.with_context(|| format!("no '{s3_client_id}' in config"))?;
+ let backup_user = proxmox_product_config::get_api_user();
let rate_limiter_options = S3RateLimiterOptions {
id: s3_client_id.to_string(),
- user: pbs_config::backup_user()?,
+ user: backup_user.clone(),
base_path: S3_CLIENT_RATE_LIMITER_BASE_PATH.into(),
};
let request_counter_config = S3RequestCounterConfig {
id: format!("{s3_client_id}-{bucket}-{}", datastore_config.name),
- user: pbs_config::backup_user()?,
+ user: backup_user.clone(),
base_path: S3_CLIENT_REQUEST_COUNTER_BASE_PATH.into(),
};
--
2.47.3
next prev parent reply other threads:[~2026-07-01 14:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 14:03 [PATCH proxmox-backup v3 00/15] fix 7642: avoid expensive uid/gid lookups for lock- and config-files Christian Ebner
2026-07-01 14:03 ` [PATCH proxmox-backup v3 01/15] bin: api: early init proxmox-product-config Christian Ebner
2026-07-01 14:03 ` [PATCH proxmox-backup v3 02/15] bin: daily update: refactor to use proxmox-product-config Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 03/15] pbs-config: use proxmox-product-config::replace_secret_config() Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 04/15] pbs-config: use proxmox-product-config::replace_config() Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 05/15] fix #7642: avoid expensive user lookups on file locking Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 06/15] pbs-config: use proxmox-product-config helpers Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 07/15] pbs-config: drop backup_group helper, use users gid instead Christian Ebner
2026-07-01 14:04 ` Christian Ebner [this message]
2026-07-01 14:04 ` [PATCH proxmox-backup v3 09/15] pbs-datastore: use general helpers for file lock create options Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 10/15] server: auth helpers: use proxmox-product-config create options helpers Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 11/15] api: subscription: use proxmox-product-config create options Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 12/15] tape: use proxmox-product-config helper for user lookup Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 13/15] tape: use proxmox-product-config lock file create options Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 14/15] tape: use proxmox-product-config to generate " Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 15/15] tree-wide: use proxmox-product-config::get_api_user for user lookup Christian Ebner
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=20260701140412.200920-9-c.ebner@proxmox.com \
--to=c.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox