public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] proxy: avoid logging every minute that a datastore is not mounted
Date: Tue, 14 Oct 2025 09:55:45 +0200	[thread overview]
Message-ID: <20251014075545.20528-1-h.laimer@proxmox.com> (raw)

`lookup_datastore` fails if a removable datastore is not mounted,
which is fine. But for job scheduling which happens every minute
we don't want the lookup to fail and fill the syslogs with unnecesarry
entries, so we check the mount status before we do the lookup to avoid
that.

Reported-by: https://forum.proxmox.com/threads/sicherung-auf-usb.167291/post-808237
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 src/bin/proxmox-backup-proxy.rs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index cfd93f92..762b5736 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -22,7 +22,7 @@ use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
 use proxmox_sys::fs::CreateOptions;
 use proxmox_sys::logrotate::LogRotate;
 
-use pbs_datastore::DataStore;
+use pbs_datastore::{DataStore, get_datastore_mount_status};
 
 use proxmox_rest_server::{
     cleanup_old_tasks, cookie_from_header, rotate_task_log_archive, ApiConfig, Redirector,
@@ -516,7 +516,7 @@ async fn schedule_datastore_garbage_collection() {
             }
         };
 
-        let event_str = match store_config.gc_schedule {
+        let event_str = match store_config.gc_schedule.as_ref() {
             Some(event_str) => event_str,
             None => continue,
         };
@@ -530,6 +530,12 @@ async fn schedule_datastore_garbage_collection() {
         };
 
         {
+            if let Some(false) = get_datastore_mount_status(&store_config) {
+                // lookup_datastore would fail correctly, but we don't want log entries every
+                // minute for a not mounted removable datastore
+                continue;
+            }
+
             // limit datastore scope due to Op::Lookup
             let datastore = match DataStore::lookup_datastore(&store, Some(Operation::Lookup)) {
                 Ok(datastore) => datastore,
@@ -588,7 +594,7 @@ async fn schedule_datastore_garbage_collection() {
             job,
             datastore,
             auth_id,
-            Some(event_str),
+            Some(event_str.into()),
             false,
         ) {
             eprintln!("unable to start garbage collection job on datastore {store} - {err:#}");
-- 
2.47.3



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


                 reply	other threads:[~2025-10-14  7:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251014075545.20528-1-h.laimer@proxmox.com \
    --to=h.laimer@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal