The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7730

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From c978a20c2432314bed0caedac2680432aa17ffd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 5 Aug 2020 18:59:32 -0400
Subject: [PATCH] lxd/rsync: Don't pass --bwlimit when no limits set
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/rsync/rsync.go | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/lxd/rsync/rsync.go b/lxd/rsync/rsync.go
index db22f123ef..13a37eeca6 100644
--- a/lxd/rsync/rsync.go
+++ b/lxd/rsync/rsync.go
@@ -33,10 +33,6 @@ func LocalCopy(source string, dest string, bwlimit string, 
xattrs bool, rsyncArg
                rsyncVerbosity = "-vi"
        }
 
-       if bwlimit == "" {
-               bwlimit = "0"
-       }
-
        args := []string{
                "-a",
                "-HA",
@@ -123,9 +119,6 @@ func sendSetup(name string, path string, bwlimit string, 
execPath string, featur
         * hardcoding that at the other end, so we can just ignore it.
         */
        rsyncCmd := fmt.Sprintf("sh -c \"%s netcat %s %s\"", execPath, auds, 
name)
-       if bwlimit == "" {
-               bwlimit = "0"
-       }
 
        args := []string{
                "-ar",
@@ -135,6 +128,10 @@ func sendSetup(name string, path string, bwlimit string, 
execPath string, featur
                "--sparse",
        }
 
+       if bwlimit != "" {
+               args = append(args, "--bwlimit", bwlimit)
+       }
+
        if features != nil && len(features) > 0 {
                args = append(args, rsyncFeatureArgs(features)...)
        }
@@ -147,9 +144,7 @@ func sendSetup(name string, path string, bwlimit string, 
execPath string, featur
                path,
                "localhost:/tmp/foo",
                "-e",
-               rsyncCmd,
-               "--bwlimit",
-               bwlimit}...)
+               rsyncCmd}...)
 
        cmd := exec.Command("rsync", args...)
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to