From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 058B66137D for ; Tue, 13 Oct 2020 11:33:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A54CDD233 for ; Tue, 13 Oct 2020 11:33:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 9DEC7CDEE for ; Tue, 13 Oct 2020 11:33:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6721F45D2B for ; Tue, 13 Oct 2020 11:33:19 +0200 (CEST) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Tue, 13 Oct 2020 11:33:09 +0200 Message-Id: <20201013093309.14917-15-h.laimer@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201013093309.14917-1-h.laimer@proxmox.com> References: <20201013093309.14917-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox-backup-proxy.rs] Subject: [pbs-devel] [PATCH v3 proxmox-backup 14/14] remove old verification scheduling from proxmox-backup-proxy.rs X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2020 09:33:27 -0000 Signed-off-by: Hannes Laimer --- src/bin/proxmox-backup-proxy.rs | 115 -------------------------------- 1 file changed, 115 deletions(-) diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index e8047ecc..7993247c 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -197,7 +197,6 @@ async fn schedule_tasks() -> Result<(), Error> { schedule_datastore_garbage_collection().await; schedule_datastore_prune().await; - schedule_datastore_verification().await; schedule_datastore_sync_jobs().await; schedule_datastore_verify_jobs().await; schedule_task_log_rotate().await; @@ -471,120 +470,6 @@ async fn schedule_datastore_prune() { } } -async fn schedule_datastore_verification() { - use proxmox_backup::backup::{DataStore, verify_all_backups}; - use proxmox_backup::server::{WorkerTask}; - use proxmox_backup::config::{ - jobstate::{self, Job}, - datastore::{self, DataStoreConfig} - }; - use proxmox_backup::tools::systemd::time::{ - parse_calendar_event, compute_next_event}; - - let config = match datastore::config() { - Err(err) => { - eprintln!("unable to read datastore config - {}", err); - return; - } - Ok((config, _digest)) => config, - }; - - for (store, (_, store_config)) in config.sections { - let datastore = match DataStore::lookup_datastore(&store) { - Ok(datastore) => datastore, - Err(err) => { - eprintln!("lookup_datastore failed - {}", err); - continue; - } - }; - - let store_config: DataStoreConfig = match serde_json::from_value(store_config) { - Ok(c) => c, - Err(err) => { - eprintln!("datastore config from_value failed - {}", err); - continue; - } - }; - - let event_str = match store_config.verify_schedule { - Some(event_str) => event_str, - None => continue, - }; - - let event = match parse_calendar_event(&event_str) { - Ok(event) => event, - Err(err) => { - eprintln!("unable to parse schedule '{}' - {}", event_str, err); - continue; - } - }; - - let worker_type = "verify"; - - let last = match jobstate::last_run_time(worker_type, &store) { - Ok(time) => time, - Err(err) => { - eprintln!("could not get last run time of {} {}: {}", worker_type, store, err); - continue; - } - }; - - let next = match compute_next_event(&event, last, false) { - Ok(Some(next)) => next, - Ok(None) => continue, - Err(err) => { - eprintln!("compute_next_event for '{}' failed - {}", event_str, err); - continue; - } - }; - - let now = proxmox::tools::time::epoch_i64(); - - if next > now { continue; } - - let mut job = match Job::new(worker_type, &store) { - Ok(job) => job, - Err(_) => continue, // could not get lock - }; - - let worker_id = store.clone(); - let store2 = store.clone(); - if let Err(err) = WorkerTask::new_thread( - worker_type, - Some(worker_id), - Userid::backup_userid().clone(), - false, - move |worker| { - job.start(&worker.upid().to_string())?; - worker.log(format!("starting verification on store {}", store2)); - worker.log(format!("task triggered by schedule '{}'", event_str)); - let result = try_block!({ - let failed_dirs = verify_all_backups(datastore, worker.clone())?; - if failed_dirs.len() > 0 { - worker.log("Failed to verify following snapshots:"); - for dir in failed_dirs { - worker.log(format!("\t{}", dir)); - } - Err(format_err!("verification failed - please check the log for details")) - } else { - Ok(()) - } - }); - - let status = worker.create_state(&result); - - if let Err(err) = job.finish(status) { - eprintln!("could not finish job state for {}: {}", worker_type, err); - } - - result - }, - ) { - eprintln!("unable to start verification on store {} - {}", store, err); - } - } -} - async fn schedule_datastore_sync_jobs() { use proxmox_backup::{ -- 2.20.1