public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container] backup: log errors from rsync
@ 2024-05-06 12:40 Fiona Ebner
  2024-06-11 11:55 ` [pve-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2024-05-06 12:40 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH container] backup: log errors from rsync
  2024-05-06 12:40 [pve-devel] [PATCH container] backup: log errors from rsync Fiona Ebner
@ 2024-06-11 11:55 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2024-06-11 11:55 UTC (permalink / raw)
  To: Proxmox VE development discussion

thanks!

On May 6, 2024 2:40 pm, Fiona Ebner wrote:
> 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
> 
> 
> 


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-11 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 12:40 [pve-devel] [PATCH container] backup: log errors from rsync Fiona Ebner
2024-06-11 11:55 ` [pve-devel] applied: " Fabian Grünbichler

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