[lxc-devel] [lxd/master] lxd/rsync: Untangle from daemon package

stgraber on Github lxc-bot at linuxcontainers.org
Wed Jul 8 14:42:22 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 450 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200708/16bc6209/attachment.bin>
-------------- next part --------------
From 0776b35fde2094a5bd1d3b5d9390811eae260566 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 8 Jul 2020 10:41:39 -0400
Subject: [PATCH] lxd/rsync: Untangle from daemon package
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As we consume lxd/rsync from lxc-to-lxd and lxd-p2c, trying to keep
dependency chain small.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/main.go        | 2 ++
 lxd/rsync/rsync.go | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lxd/main.go b/lxd/main.go
index 83a3260ea8..f8c3f83dba 100644
--- a/lxd/main.go
+++ b/lxd/main.go
@@ -12,6 +12,7 @@ import (
 	"github.com/lxc/lxd/lxd/events"
 	"github.com/lxc/lxd/lxd/operations"
 	"github.com/lxc/lxd/lxd/response"
+	"github.com/lxc/lxd/lxd/rsync"
 	"github.com/lxc/lxd/shared/logger"
 	"github.com/lxc/lxd/shared/logging"
 	"github.com/lxc/lxd/shared/version"
@@ -48,6 +49,7 @@ func (c *cmdGlobal) Run(cmd *cobra.Command, args []string) error {
 
 	// Set logging global variables
 	daemon.Debug = c.flagLogDebug
+	rsync.Debug = c.flagLogDebug
 	daemon.Verbose = c.flagLogVerbose
 
 	// Set debug for the operations package
diff --git a/lxd/rsync/rsync.go b/lxd/rsync/rsync.go
index 7a7f1a118b..db22f123ef 100644
--- a/lxd/rsync/rsync.go
+++ b/lxd/rsync/rsync.go
@@ -12,13 +12,15 @@ import (
 
 	"github.com/pborman/uuid"
 
-	"github.com/lxc/lxd/lxd/daemon"
 	"github.com/lxc/lxd/shared"
 	"github.com/lxc/lxd/shared/ioprogress"
 	"github.com/lxc/lxd/shared/logger"
 	"github.com/lxc/lxd/shared/version"
 )
 
+// Debug controls additional debugging in rsync output.
+var Debug bool
+
 // LocalCopy copies a directory using rsync (with the --devices option).
 func LocalCopy(source string, dest string, bwlimit string, xattrs bool, rsyncArgs ...string) (string, error) {
 	err := os.MkdirAll(dest, 0755)
@@ -27,7 +29,7 @@ func LocalCopy(source string, dest string, bwlimit string, xattrs bool, rsyncArg
 	}
 
 	rsyncVerbosity := "-q"
-	if daemon.Debug {
+	if Debug {
 		rsyncVerbosity = "-vi"
 	}
 


More information about the lxc-devel mailing list