public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] proxy: avoid logging every minute that a datastore is not mounted
@ 2025-10-14  7:55 Hannes Laimer
  0 siblings, 0 replies; only message in thread
From: Hannes Laimer @ 2025-10-14  7:55 UTC (permalink / raw)
  To: pbs-devel

`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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-14  7:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-14  7:55 [pbs-devel] [PATCH proxmox-backup] proxy: avoid logging every minute that a datastore is not mounted Hannes Laimer

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