[lxc-devel] [lxd/master] lxd/migration: Fix feature negotiation

stgraber on Github lxc-bot at linuxcontainers.org
Wed Apr 24 19:17:01 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190424/39449308/attachment.bin>
-------------- next part --------------
From 4b8e15530a741c4a1881cb8701fc862482de1bd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 24 Apr 2019 15:13:11 -0400
Subject: [PATCH] lxd/migration: Fix feature negotiation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5691

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 lxd/migrate_container.go | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/lxd/migrate_container.go b/lxd/migrate_container.go
index ff4c476705..c2bda84afb 100644
--- a/lxd/migrate_container.go
+++ b/lxd/migrate_container.go
@@ -835,24 +835,40 @@ func (c *migrationSink) Do(migrateOp *operation) error {
 	}
 
 	myType := c.src.container.Storage().MigrationType()
-	hasFeature := true
 	resp := migration.MigrationHeader{
 		Fs:            &myType,
 		Criu:          criuType,
 		Snapshots:     header.Snapshots,
 		SnapshotNames: header.SnapshotNames,
 		Refresh:       &c.refresh,
-		RsyncFeatures: &migration.RsyncFeatures{
-			Xattrs:        &hasFeature,
-			Delete:        &hasFeature,
-			Compress:      &hasFeature,
-			Bidirectional: &hasFeature,
-		},
 	}
 
+	// Return those rsync features we know about (with the value sent by the remote)
+	if header.RsyncFeatures != nil {
+		resp.RsyncFeatures = &migration.RsyncFeatures{}
+		if resp.RsyncFeatures.Xattrs != nil {
+			resp.RsyncFeatures.Xattrs = header.RsyncFeatures.Xattrs
+		}
+
+		if resp.RsyncFeatures.Delete != nil {
+			resp.RsyncFeatures.Delete = header.RsyncFeatures.Delete
+		}
+
+		if resp.RsyncFeatures.Compress != nil {
+			resp.RsyncFeatures.Compress = header.RsyncFeatures.Compress
+		}
+
+		if resp.RsyncFeatures.Bidirectional != nil {
+			resp.RsyncFeatures.Bidirectional = header.RsyncFeatures.Bidirectional
+		}
+	}
+
+	// Return those ZFS features we know about (with the value sent by the remote)
 	if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
-		resp.ZfsFeatures = &migration.ZfsFeatures{
-			Compress: &hasFeature,
+		if header.ZfsFeatures != nil && header.ZfsFeatures.Compress != nil {
+			resp.ZfsFeatures = &migration.ZfsFeatures{
+				Compress: header.ZfsFeatures.Compress,
+			}
 		}
 	}
 


More information about the lxc-devel mailing list