proxy: rrd: skip update disk stats for offline datastores

RDD update did not use lookup_datastore() and therefore bypassed
the maintenance mode checks. This adds the needed check directly.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2022-05-04 05:49:06 +00:00 committed by Thomas Lamprecht
parent 5b460ef525
commit d4d730e589
1 changed files with 6 additions and 0 deletions

View File

@ -1071,6 +1071,12 @@ fn generate_host_stats_sync() {
.unwrap_or_default(); .unwrap_or_default();
for config in datastore_list { for config in datastore_list {
if config
.get_maintenance_mode()
.map_or(false, |mode| mode.check(Some(Operation::Read)).is_err())
{
continue;
}
let rrd_prefix = format!("datastore/{}", config.name); let rrd_prefix = format!("datastore/{}", config.name);
let path = std::path::Path::new(&config.path); let path = std::path::Path::new(&config.path);
gather_disk_stats(disk_manager.clone(), path, &rrd_prefix); gather_disk_stats(disk_manager.clone(), path, &rrd_prefix);