public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] backup: log errors from rsync
Date: Mon,  6 May 2024 14:40:43 +0200	[thread overview]
Message-ID: <20240506124043.43046-1-f.ebner@proxmox.com> (raw)

Commit 5582b0c ("vzdump: rsync: make less verbose") talks about making
the output less verbose, but it likely did not intended to get rid of
the error messages from rsync, but only the uninteresting messages to
stdout.

The currently used log function is only matching the total
transferred and ignores everything else. Split it into an output and
error function and log all error messages from rsync.

Excerpt from the output with the patch:

> INFO: starting first sync /proc/55667/root/ to /mnt/tmp/vzdumptmp62235_113/
> ERROR: rsync: [sender] send_files failed to open "/proc/55667/root/foo/file": Input/output error (5)
> ERROR: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
> ERROR: Backup of VM 113 failed - command 'rsync --stats -h -X -A --numeric-ids -aH --delete --no-whole-file --sparse --one-file-system --relative '--exclude=/tmp/?*' '--exclude=/var/tmp/?*' '--exclude=/var/run/?*.pid' /proc/55667/root//./ /proc/55667/root//./foo /mnt/tmp/vzdumptmp62235_113/' failed: exit code 23
> INFO: Failed at 2024-05-06 14:21:58
> INFO: Backup job finished with errors

Without the patch, the first two error messages with the root cause of
the issue would not be shown, confusing users and leaving developers
in the dark when trying to help.

Examples from the forum:
https://forum.proxmox.com/threads/146415/post-660946
https://forum.proxmox.com/threads/101810/
https://forum.proxmox.com/threads/101560/
https://forum.proxmox.com/threads/79572/post-352377

Fixes: 5582b0c ("vzdump: rsync: make less verbose")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/VZDump/LXC.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index 8c28a5e..671f5f8 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -52,13 +52,15 @@ my $rsync_vm = sub {
     }
 
     my $transferred = '';
-    my $logfunc = sub {
+    my $outfunc = sub {
 	return if $_[0] !~ /^Total transferred file size: (.+)$/;
 	$transferred = $1;
     };
 
+    my $errfunc = sub { $self->logerr($_[0]); };
+
     my $starttime = time();
-    PVE::Tools::run_command([@$rsync, $to], logfunc => $logfunc);
+    PVE::Tools::run_command([@$rsync, $to], outfunc => $outfunc, errfunc => $errfunc);
     my $delay = time () - $starttime;
 
     $self->loginfo ("$text sync finished - transferred $transferred in ${delay}s");
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2024-05-06 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 12:40 Fiona Ebner [this message]
2024-06-11 11:55 ` [pve-devel] applied: " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506124043.43046-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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