[lxc-devel] [lxd/master] rsync: ignore vanished file warnings

brauner on Github lxc-bot at linuxcontainers.org
Fri Sep 29 13:49:09 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 381 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170929/05c4bbb3/attachment.bin>
-------------- next part --------------
From 81a4f459280619bfa4b5a5635bb8ab0eb70edf5a Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 29 Sep 2017 15:48:28 +0200
Subject: [PATCH] rsync: ignore vanished file warnings

Closes #3859.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/rsync.go | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/lxd/rsync.go b/lxd/rsync.go
index e5f4d3d0c..3659fefbf 100644
--- a/lxd/rsync.go
+++ b/lxd/rsync.go
@@ -7,6 +7,7 @@ import (
 	"net"
 	"os"
 	"os/exec"
+	"syscall"
 
 	"github.com/gorilla/websocket"
 	"github.com/pborman/uuid"
@@ -31,7 +32,7 @@ func rsyncLocalCopy(source string, dest string, bwlimit string) (string, error)
 		bwlimit = "0"
 	}
 
-	return shared.RunCommand("rsync",
+	msg, err := shared.RunCommand("rsync",
 		"-a",
 		"-HAX",
 		"--sparse",
@@ -43,6 +44,21 @@ func rsyncLocalCopy(source string, dest string, bwlimit string) (string, error)
 		rsyncVerbosity,
 		shared.AddSlash(source),
 		dest)
+	if err != nil {
+		runError, ok := err.(shared.RunError)
+		if ok {
+			exitError, ok := runError.Err.(*exec.ExitError)
+			if ok {
+				waitStatus := exitError.Sys().(syscall.WaitStatus)
+				if waitStatus.ExitStatus() == 24 {
+					return msg, nil
+				}
+			}
+		}
+		return msg, err
+	}
+
+	return msg, nil
 }
 
 func rsyncSendSetup(name string, path string, bwlimit string) (*exec.Cmd, net.Conn, io.ReadCloser, error) {


More information about the lxc-devel mailing list