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 C11809C189 for ; Tue, 21 Nov 2023 17:21:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A3E9CD6C0 for ; Tue, 21 Nov 2023 17:21:19 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Tue, 21 Nov 2023 17:21:19 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D48BD41D2B for ; Tue, 21 Nov 2023 17:21:18 +0100 (CET) From: Stefan Lendl To: pbs-devel@lists.proxmox.com Date: Tue, 21 Nov 2023 17:21:10 +0100 Message-ID: <20231121162111.537833-3-s.lendl@proxmox.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231121162111.537833-1-s.lendl@proxmox.com> References: <20231121162111.537833-1-s.lendl@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.053 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH v2 proxmox-backup 2/3] pass worker context to do_create_prune_job 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, 21 Nov 2023 16:21:49 -0000 pass the WorkerTaksContext to do_create_prune_job because we want logging when calling within a worker context. Signed-off-by: Stefan Lendl --- src/api2/config/prune.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/api2/config/prune.rs b/src/api2/config/prune.rs index 1e8b5526..4f7ce39c 100644 --- a/src/api2/config/prune.rs +++ b/src/api2/config/prune.rs @@ -1,5 +1,7 @@ use anyhow::Error; use hex::FromHex; +use proxmox_sys::task_log; +use proxmox_sys::WorkerTaskContext; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -56,7 +58,10 @@ pub fn list_prune_jobs( Ok(list) } -pub fn do_create_prune_job(config: PruneJobConfig) -> Result<(), Error> { +pub fn do_create_prune_job( + config: PruneJobConfig, + worker: Option<&dyn WorkerTaskContext>, +) -> Result<(), Error> { let _lock = prune::lock_config()?; let (mut section_config, _digest) = prune::config()?; @@ -71,6 +76,10 @@ pub fn do_create_prune_job(config: PruneJobConfig) -> Result<(), Error> { crate::server::jobstate::create_state_file("prunejob", &config.id)?; + if let Some(worker) = worker { + task_log!(worker, "Prune job created: {}", config.id); + } + Ok(()) } @@ -99,7 +108,7 @@ pub fn create_prune_job( user_info.check_privs(&auth_id, &config.acl_path(), PRIV_DATASTORE_MODIFY, true)?; - do_create_prune_job(config) + do_create_prune_job(config, None) } #[api( -- 2.42.0