[lxc-devel] [lxd/master] rsync: Tweak transfer options (delete & compress)

stgraber on Github lxc-bot at linuxcontainers.org
Mon Oct 29 21:17:26 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 688 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181029/b23faafe/attachment.bin>
-------------- next part --------------
From 03ecaf4b2da0816ee8d9d617648a35522d050ae4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 29 Oct 2018 17:14:57 -0400
Subject: [PATCH] rsync: Tweak transfer options (delete & compress)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

LXD when interacting with recent clients will now support:
 - --delete (to avoid random conflicts)
 - --compress --compress-level=2 (to reduce bandwidth usage)

The level 2 compress appears to be the best CPU/bandwidth tradeoff for
most common images and shouldn't cause slowdowns in most cases.

Closes #5215
Closes #5212

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc-to-lxd/transfer.go         |   3 +
 lxc-to-lxd/utils.go            |  10 ++-
 lxd-p2c/transfer.go            |   3 +
 lxd-p2c/utils.go               |  10 ++-
 lxd/migrate_container.go       |  32 ++++++--
 lxd/migrate_storage_volumes.go |  32 ++++++--
 lxd/migration/migrate.pb.go    | 141 ++++++++++++++++++---------------
 lxd/migration/migrate.proto    |   2 +
 lxd/rsync.go                   |   3 +
 9 files changed, 154 insertions(+), 82 deletions(-)

diff --git a/lxc-to-lxd/transfer.go b/lxc-to-lxd/transfer.go
index c0390321e9..57c85fbcb9 100644
--- a/lxc-to-lxd/transfer.go
+++ b/lxc-to-lxd/transfer.go
@@ -74,6 +74,9 @@ func rsyncSendSetup(path string, rsyncArgs string) (*exec.Cmd, net.Conn, io.Read
 		"--partial",
 		"--sparse",
 		"--xattrs",
+		"--delete",
+		"--compress",
+		"--compress-level=2",
 	}
 
 	// Ignore deletions (requires 3.1 or higher)
diff --git a/lxc-to-lxd/utils.go b/lxc-to-lxd/utils.go
index 2d3aea2381..6dcae9feec 100644
--- a/lxc-to-lxd/utils.go
+++ b/lxc-to-lxd/utils.go
@@ -31,10 +31,14 @@ func transferRootfs(dst lxd.ContainerServer, op lxd.Operation, rootfs string, rs
 
 	// Setup control struct
 	fs := migration.MigrationFSType_RSYNC
-	rsyncXattrs := true
+	rsyncHasFeature := true
 	header := migration.MigrationHeader{
-		Fs:            &fs,
-		RsyncFeatures: &migration.RsyncFeatures{Xattrs: &rsyncXattrs},
+		Fs: &fs,
+		RsyncFeatures: &migration.RsyncFeatures{
+			Xattrs:   &rsyncHasFeature,
+			Delete:   &rsyncHasFeature,
+			Compress: &rsyncHasFeature,
+		},
 	}
 
 	err = migration.ProtoSend(wsControl, &header)
diff --git a/lxd-p2c/transfer.go b/lxd-p2c/transfer.go
index d145eccf6e..4fb3068f5e 100644
--- a/lxd-p2c/transfer.go
+++ b/lxd-p2c/transfer.go
@@ -74,6 +74,9 @@ func rsyncSendSetup(path string, rsyncArgs string) (*exec.Cmd, net.Conn, io.Read
 		"--partial",
 		"--sparse",
 		"--xattrs",
+		"--delete",
+		"--compress",
+		"--compress-level=2",
 	}
 
 	// Ignore deletions (requires 3.1 or higher)
diff --git a/lxd-p2c/utils.go b/lxd-p2c/utils.go
index de82041c79..0dc44b2734 100644
--- a/lxd-p2c/utils.go
+++ b/lxd-p2c/utils.go
@@ -32,10 +32,14 @@ func transferRootfs(dst lxd.ContainerServer, op lxd.Operation, rootfs string, rs
 
 	// Setup control struct
 	fs := migration.MigrationFSType_RSYNC
-	rsyncXattrs := true
+	rsyncHasFeature := true
 	header := migration.MigrationHeader{
-		RsyncFeatures: &migration.RsyncFeatures{Xattrs: &rsyncXattrs},
-		Fs:            &fs,
+		RsyncFeatures: &migration.RsyncFeatures{
+			Xattrs:   &rsyncHasFeature,
+			Delete:   &rsyncHasFeature,
+			Compress: &rsyncHasFeature,
+		},
+		Fs: &fs,
 	}
 
 	err = migration.ProtoSend(wsControl, &header)
diff --git a/lxd/migrate_container.go b/lxd/migrate_container.go
index 013d03b931..8dc76acc0c 100644
--- a/lxd/migrate_container.go
+++ b/lxd/migrate_container.go
@@ -379,7 +379,7 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
 	// The protocol says we have to send a header no matter what, so let's
 	// do that, but then immediately send an error.
 	myType := s.container.Storage().MigrationType()
-	rsyncXattrs := true
+	rsyncHasFeature := true
 	header := migration.MigrationHeader{
 		Fs:            &myType,
 		Criu:          criuType,
@@ -387,7 +387,11 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
 		SnapshotNames: snapshotNames,
 		Snapshots:     snapshots,
 		Predump:       proto.Bool(use_pre_dumps),
-		RsyncFeatures: &migration.RsyncFeatures{Xattrs: &rsyncXattrs},
+		RsyncFeatures: &migration.RsyncFeatures{
+			Xattrs:   &rsyncHasFeature,
+			Delete:   &rsyncHasFeature,
+			Compress: &rsyncHasFeature,
+		},
 	}
 
 	err = s.send(&header)
@@ -792,11 +796,15 @@ func (c *migrationSink) Do(migrateOp *operation) error {
 
 	mySink := c.src.container.Storage().MigrationSink
 	myType := c.src.container.Storage().MigrationType()
-	rsyncXattrs := true
+	rsyncHasFeature := true
 	resp := migration.MigrationHeader{
-		Fs:            &myType,
-		Criu:          criuType,
-		RsyncFeatures: &migration.RsyncFeatures{Xattrs: &rsyncXattrs},
+		Fs:   &myType,
+		Criu: criuType,
+		RsyncFeatures: &migration.RsyncFeatures{
+			Xattrs:   &rsyncHasFeature,
+			Delete:   &rsyncHasFeature,
+			Compress: &rsyncHasFeature,
+		},
 	}
 
 	// If the storage type the source has doesn't match what we have, then
@@ -878,8 +886,18 @@ func (c *migrationSink) Do(migrateOp *operation) error {
 
 			args := MigrationSinkArgs{}
 			rsyncFeatures := header.GetRsyncFeatures()
+
+			// Handle rsync options
+			args.RsyncArgs = []string{}
 			if rsyncFeatures.GetXattrs() {
-				args.RsyncArgs = []string{"--xattrs"}
+				args.RsyncArgs = append(args.RsyncArgs, "--xattrs")
+			}
+			if rsyncFeatures.GetDelete() {
+				args.RsyncArgs = append(args.RsyncArgs, "--delete")
+			}
+			if rsyncFeatures.GetCompress() {
+				args.RsyncArgs = append(args.RsyncArgs, "--compress")
+				args.RsyncArgs = append(args.RsyncArgs, "--compress-level=2")
 			}
 
 			err = mySink(sendFinalFsDelta, c.src.container,
diff --git a/lxd/migrate_storage_volumes.go b/lxd/migrate_storage_volumes.go
index b92cb3d7b5..eb10bafc33 100644
--- a/lxd/migrate_storage_volumes.go
+++ b/lxd/migrate_storage_volumes.go
@@ -47,10 +47,14 @@ func (s *migrationSourceWs) DoStorage(migrateOp *operation) error {
 	// The protocol says we have to send a header no matter what, so let's
 	// do that, but then immediately send an error.
 	myType := s.storage.MigrationType()
-	rsyncXattrs := true
+	rsyncHasFeature := true
 	header := migration.MigrationHeader{
-		Fs:            &myType,
-		RsyncFeatures: &migration.RsyncFeatures{Xattrs: &rsyncXattrs},
+		Fs: &myType,
+		RsyncFeatures: &migration.RsyncFeatures{
+			Xattrs:   &rsyncHasFeature,
+			Delete:   &rsyncHasFeature,
+			Compress: &rsyncHasFeature,
+		},
 	}
 
 	err = s.send(&header)
@@ -215,10 +219,14 @@ func (c *migrationSink) DoStorage(migrateOp *operation) error {
 
 	mySink := c.src.storage.StorageMigrationSink
 	myType := c.src.storage.MigrationType()
-	rsyncXattrs := true
+	rsyncHasFeature := true
 	resp := migration.MigrationHeader{
-		Fs:            &myType,
-		RsyncFeatures: &migration.RsyncFeatures{Xattrs: &rsyncXattrs},
+		Fs: &myType,
+		RsyncFeatures: &migration.RsyncFeatures{
+			Xattrs:   &rsyncHasFeature,
+			Delete:   &rsyncHasFeature,
+			Compress: &rsyncHasFeature,
+		},
 	}
 
 	// If the storage type the source has doesn't match what we have, then
@@ -231,8 +239,18 @@ func (c *migrationSink) DoStorage(migrateOp *operation) error {
 
 	args := MigrationSinkArgs{}
 	rsyncFeatures := header.GetRsyncFeatures()
+
+	// Handle rsync options
+	args.RsyncArgs = []string{}
 	if rsyncFeatures.GetXattrs() {
-		args.RsyncArgs = []string{"--xattrs"}
+		args.RsyncArgs = append(args.RsyncArgs, "--xattrs")
+	}
+	if rsyncFeatures.GetDelete() {
+		args.RsyncArgs = append(args.RsyncArgs, "--delete")
+	}
+	if rsyncFeatures.GetCompress() {
+		args.RsyncArgs = append(args.RsyncArgs, "--compress")
+		args.RsyncArgs = append(args.RsyncArgs, "--compress-level=2")
 	}
 
 	err = sender(&resp)
diff --git a/lxd/migration/migrate.pb.go b/lxd/migration/migrate.pb.go
index 456ffd16e3..682c71cb1e 100644
--- a/lxd/migration/migrate.pb.go
+++ b/lxd/migration/migrate.pb.go
@@ -296,6 +296,8 @@ func (m *Snapshot) GetLastUsedDate() int64 {
 
 type RsyncFeatures struct {
 	Xattrs           *bool  `protobuf:"varint,1,opt,name=xattrs" json:"xattrs,omitempty"`
+	Delete           *bool  `protobuf:"varint,2,opt,name=delete" json:"delete,omitempty"`
+	Compress         *bool  `protobuf:"varint,3,opt,name=compress" json:"compress,omitempty"`
 	XXX_unrecognized []byte `json:"-"`
 }
 
@@ -311,6 +313,20 @@ func (m *RsyncFeatures) GetXattrs() bool {
 	return false
 }
 
+func (m *RsyncFeatures) GetDelete() bool {
+	if m != nil && m.Delete != nil {
+		return *m.Delete
+	}
+	return false
+}
+
+func (m *RsyncFeatures) GetCompress() bool {
+	if m != nil && m.Compress != nil {
+		return *m.Compress
+	}
+	return false
+}
+
 type MigrationHeader struct {
 	Fs               *MigrationFSType `protobuf:"varint,1,req,name=fs,enum=migration.MigrationFSType" json:"fs,omitempty"`
 	Criu             *CRIUType        `protobuf:"varint,2,opt,name=criu,enum=migration.CRIUType" json:"criu,omitempty"`
@@ -610,66 +626,67 @@ func init() {
 func init() { proto.RegisterFile("lxd/migration/migrate.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-	// 972 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 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5, 0x74, 0x39, 0xfd, 0x48, 0x1d, 0x8f, 0xce, 0xe9,
-	0xc9, 0x6a, 0xda, 0x23, 0xbb, 0xd0, 0xff, 0xed, 0x64, 0x35, 0x75, 0xd4, 0x81, 0x1e, 0x1d, 0x4f,
-	0xfb, 0xfb, 0x87, 0x30, 0xb4, 0x5f, 0x14, 0xd9, 0x03, 0x50, 0xe7, 0xb0, 0x73, 0xf1, 0xec, 0xf5,
-	0x0f, 0x17, 0x6f, 0xa7, 0x3d, 0x32, 0x04, 0xf7, 0xf4, 0xe7, 0xd3, 0x1f, 0xa7, 0xce, 0xbf, 0x01,
-	0x00, 0x00, 0xff, 0xff, 0x2b, 0x3f, 0x34, 0xa3, 0xca, 0x07, 0x00, 0x00,
+	// 992 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x4d, 0x6f, 0xdb, 0x46,
+	0x10, 0xad, 0x28, 0xca, 0x16, 0x47, 0x92, 0xa3, 0x6c, 0x82, 0x82, 0x48, 0xfa, 0xa1, 0x32, 0x29,
+	0xaa, 0xfa, 0x60, 0xa7, 0x0a, 0x0a, 0xb4, 0x97, 0x02, 0xb5, 0x5c, 0x37, 0x01, 0x12, 0xd7, 0x58,
+	0xd9, 0x28, 0xda, 0x1e, 0x88, 0x2d, 0x39, 0x94, 0x17, 0xe6, 0x17, 0x76, 0x97, 0xb6, 0xe5, 0x4b,
+	0x7f, 0x4d, 0x7f, 0x4a, 0xcf, 0x3d, 0xf5, 0xff, 0x14, 0xbb, 0x4b, 0xd2, 0x54, 0x52, 0xa0, 0xb7,
+	0x9d, 0x37, 0x4f, 0xf3, 0x76, 0xe7, 0xcd, 0x50, 0xf0, 0x34, 0xbd, 0x8d, 0x0f, 0x33, 0xbe, 0x16,
+	0x4c, 0xf1, 0x22, 0xaf, 0x4f, 0x78, 0x50, 0x8a, 0x42, 0x15, 0xc4, 0x6b, 0x13, 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 0x71, 0x63,
+	0x2c, 0x73, 0xe9, 0x83, 0x6e, 0x6f, 0x96, 0xc5, 0x8d, 0xf6, 0x2d, 0x29, 0xc4, 0x55, 0x6b, 0x7e,
+	0xed, 0x5b, 0x8d, 0x35, 0xd6, 0x36, 0x97, 0xe9, 0xd8, 0x36, 0xaa, 0x31, 0x43, 0x69, 0x2f, 0x56,
+	0x83, 0xda, 0xb6, 0x5e, 0x7b, 0x31, 0x5a, 0x83, 0xc1, 0x2d, 0x8c, 0xba, 0xcf, 0x39, 0x04, 0x37,
+	0xb6, 0xa3, 0xaa, 0x57, 0xe8, 0x69, 0x67, 0x85, 0xde, 0x1d, 0x52, 0x6a, 0x88, 0xe4, 0x1b, 0xd8,
+	0xad, 0x05, 0xcc, 0x3a, 0x8c, 0x16, 0x9f, 0x74, 0xd7, 0xee, 0xfd, 0x86, 0xd1, 0x86, 0xbe, 0xff,
+	0x6d, 0xe7, 0xeb, 0x65, 0xbf, 0x4a, 0xc4, 0x83, 0x01, 0x5d, 0xfd, 0x72, 0xba, 0x9c, 0x7e, 0xa0,
+	0x8f, 0x47, 0xe7, 0xf4, 0x64, 0x35, 0xed, 0x91, 0x5d, 0xe8, 0xff, 0x7a, 0xb2, 0x9a, 0x3a, 0xfa,
+	0x40, 0x8f, 0x8e, 0xa7, 0xfd, 0xfd, 0x43, 0x18, 0x36, 0x9f, 0x28, 0xb2, 0x07, 0xa0, 0xcf, 0x61,
+	0xe7, 0x87, 0x67, 0xaf, 0xbe, 0xbf, 0x78, 0x33, 0xed, 0x91, 0x21, 0xb8, 0xa7, 0x3f, 0x9d, 0xfe,
+	0x30, 0x75, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0e, 0xf3, 0x76, 0x3c, 0xfe, 0x07, 0x00, 0x00,
 }
diff --git a/lxd/migration/migrate.proto b/lxd/migration/migrate.proto
index 7ae4591d52..b9bbe6243d 100644
--- a/lxd/migration/migrate.proto
+++ b/lxd/migration/migrate.proto
@@ -48,6 +48,8 @@ message Snapshot {
 
 message rsyncFeatures {
 	optional bool		xattrs = 1;
+	optional bool		delete = 2;
+	optional bool		compress = 3;
 }
 
 message MigrationHeader {
diff --git a/lxd/rsync.go b/lxd/rsync.go
index cb1b7f4e38..cb8874ac12 100644
--- a/lxd/rsync.go
+++ b/lxd/rsync.go
@@ -111,6 +111,9 @@ func rsyncSendSetup(name string, path string, bwlimit string, execPath string) (
 		"--partial",
 		"--sparse",
 		"--xattrs",
+		"--delete",
+		"--compress",
+		"--compress-level=2",
 		path,
 		"localhost:/tmp/foo",
 		"-e",


More information about the lxc-devel mailing list