From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 1D1AC1FF163 for ; Thu, 21 Nov 2024 16:43:57 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 15D9EFC1; Thu, 21 Nov 2024 16:44:03 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 21 Nov 2024 16:43:35 +0100 Message-Id: <20241121154337.471425-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241121154337.471425-1-c.ebner@proxmox.com> References: <20241121154337.471425-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 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 Subject: [pbs-devel] [PATCH proxmox-backup 2/4] server: push: consistently use remote over target for error messages 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Mixing of terms only makes the errors harder to understand. In order to make error messages more intuitive, always refer to the sync push target as remote, mention the remote explicitly and/or improve messages where needed. Signed-off-by: Christian Ebner --- src/server/push.rs | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/server/push.rs b/src/server/push.rs index 2181634c6..86cef5520 100644 --- a/src/server/push.rs +++ b/src/server/push.rs @@ -197,7 +197,7 @@ async fn remove_target_namespace( target_namespace: &BackupNamespace, ) -> Result { if target_namespace.is_root() { - bail!("cannot remove root namespace from target"); + bail!("Cannot remove root namespace from remote"); } check_ns_remote_datastore_privs(params, target_namespace, PRIV_REMOTE_DATASTORE_MODIFY) @@ -295,7 +295,7 @@ async fn check_or_create_target_namespace( // Sub-namespaces have to be created by creating parent components first. check_ns_remote_datastore_privs(params, target_namespace, PRIV_REMOTE_DATASTORE_MODIFY) - .map_err(|err| format_err!("Creating namespace not allowed - {err}"))?; + .map_err(|err| format_err!("Creating remote namespace not allowed - {err}"))?; let mut parent = BackupNamespace::root(); for component in target_namespace.components() { @@ -311,7 +311,7 @@ async fn check_or_create_target_namespace( args["parent"] = serde_json::to_value(parent.clone())?; } match params.target.client.post(&api_path, Some(args)).await { - Ok(_) => info!("Created new namespace on target: {current}"), + Ok(_) => info!("Successfully created new namespace {current} on remote"), Err(err) => { bail!("Remote creation of namespace {current} failed, remote returned: {err}") } @@ -445,18 +445,19 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result 0 { warn!( - "kept {protected_count} protected snapshots of namespace '{target_namespace}'", + "Kept {protected_count} protected snapshots of remote namespace {target_namespace}", protected_count = delete_stats.protected_snapshots(), ); continue; } } Err(err) => { - warn!("failed to remove vanished namespace {target_namespace} - {err}"); + warn!("Encountered errors: {err}"); + warn!("Failed to remove vanished namespace {target_namespace} from remote!"); continue; } } - info!("removed vanished namespace {target_namespace}"); + info!("Successfully removed vanished namespace {target_namespace} from remote"); } if !params.target.supports_prune_delete_stats { @@ -481,7 +482,7 @@ pub(crate) async fn push_namespace( let target_namespace = params.map_to_target(namespace)?; // Check if user is allowed to perform backups on remote datastore check_ns_remote_datastore_privs(params, &target_namespace, PRIV_REMOTE_DATASTORE_BACKUP) - .map_err(|err| format_err!("Pushing to remote not allowed - {err}"))?; + .map_err(|err| format_err!("Pushing to remote namespace not allowed - {err}"))?; let mut list: Vec = params .source @@ -527,7 +528,8 @@ pub(crate) async fn push_namespace( match push_group(params, namespace, &group, &mut progress).await { Ok(sync_stats) => stats.add(sync_stats), Err(err) => { - warn!("sync group '{group}' failed - {err}"); + warn!("Encountered errors: {err}"); + warn!("Failed to push group {group} to remote!"); errors = true; } } @@ -543,13 +545,13 @@ pub(crate) async fn push_namespace( continue; } - info!("delete vanished group '{target_group}'"); + info!("Removed vanished group {target_group} from remote"); match remove_target_group(params, &target_namespace, &target_group).await { Ok(delete_stats) => { if delete_stats.protected_snapshots() > 0 { warn!( - "kept {protected_count} protected snapshots of group '{target_group}'", + "Kept {protected_count} protected snapshots of group {target_group} on remote", protected_count = delete_stats.protected_snapshots(), ); } @@ -560,7 +562,8 @@ pub(crate) async fn push_namespace( })); } Err(err) => { - warn!("failed to delete vanished group - {err}"); + warn!("Encountered errors: {err}"); + warn!("Failed to remove vanished group {target_group} from remote!"); errors = true; continue; } @@ -693,7 +696,7 @@ pub(crate) async fn push_group( } if snapshot.protected { info!( - "don't delete vanished snapshot {name} (protected)", + "Kept protected snapshot {name} on remote", name = snapshot.backup ); continue; @@ -701,12 +704,16 @@ pub(crate) async fn push_group( if let Err(err) = forget_target_snapshot(params, &target_namespace, &snapshot.backup).await { + info!("Encountered errors: {err}"); info!( - "could not delete vanished snapshot {name} - {err}", + "Failed to remove vanished snapshot {name} from remote!", name = snapshot.backup ); } - info!("delete vanished snapshot {name}", name = snapshot.backup); + info!( + "Removed vanished snapshot {name} from remote", + name = snapshot.backup + ); stats.add(SyncStats::from(RemovedVanishedStats { snapshots: 1, groups: 0, -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel