[lxc-devel] [lxd/master] lxd/migration: Bi-directional rsync negotiation
stgraber on Github
lxc-bot at linuxcontainers.org
Sun Nov 25 05:39:57 UTC 2018
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/20181125/b5a831e6/attachment.bin>
-------------- next part --------------
From aca0151ed1b54cfb819344cf5509e5eed36520a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 25 Nov 2018 00:38:42 -0500
Subject: [PATCH] lxd/migration: Bi-directional rsync negotiation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #5270
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/migrate.go | 5 ++
lxd/migrate_container.go | 66 ++++++++++++----
lxd/migrate_storage_volumes.go | 54 +++++++++----
lxd/migration/migrate.pb.go | 137 ++++++++++++++++++---------------
lxd/migration/migrate.proto | 1 +
lxd/rsync.go | 23 +++---
lxd/storage.go | 4 +-
lxd/storage_btrfs.go | 8 +-
lxd/storage_ceph.go | 4 +-
lxd/storage_ceph_migration.go | 2 +-
lxd/storage_dir.go | 8 +-
lxd/storage_lvm.go | 8 +-
lxd/storage_migration.go | 21 ++---
lxd/storage_mock.go | 4 +-
lxd/storage_zfs.go | 6 +-
15 files changed, 216 insertions(+), 135 deletions(-)
diff --git a/lxd/migrate.go b/lxd/migrate.go
index 86ef2d484c..070c0fd044 100644
--- a/lxd/migrate.go
+++ b/lxd/migrate.go
@@ -273,6 +273,11 @@ type MigrationSinkArgs struct {
Refresh bool
}
+type MigrationSourceArgs struct {
+ // transport specific fields
+ RsyncArgs []string
+}
+
func (c *migrationSink) connectWithSecret(secret string) (*websocket.Conn, error) {
query := url.Values{"secret": []string{secret}}
diff --git a/lxd/migrate_container.go b/lxd/migrate_container.go
index bbc22fabcd..ec4f279c3e 100644
--- a/lxd/migrate_container.go
+++ b/lxd/migrate_container.go
@@ -220,6 +220,7 @@ type preDumpLoopArgs struct {
preDumpDir string
dumpDir string
final bool
+ rsyncArgs []string
}
// The function preDumpLoop is the main logic behind the pre-copy migration.
@@ -250,7 +251,7 @@ func (s *migrationSourceWs) preDumpLoop(args *preDumpLoopArgs) (bool, error) {
// Send the pre-dump.
ctName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
state := s.container.DaemonState()
- err = RsyncSend(ctName, shared.AddSlash(args.checkpointDir), s.criuConn, nil, args.bwlimit, state.OS.ExecPath)
+ err = RsyncSend(ctName, shared.AddSlash(args.checkpointDir), s.criuConn, nil, args.rsyncArgs, args.bwlimit, state.OS.ExecPath)
if err != nil {
return final, err
}
@@ -355,14 +356,12 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
}
}
- driver, fsErr := s.container.Storage().MigrationSource(s.container, s.containerOnly)
-
snapshots := []*migration.Snapshot{}
snapshotNames := []string{}
// Only send snapshots when requested.
if !s.containerOnly {
- if fsErr == nil {
- fullSnaps := driver.Snapshots()
+ fullSnaps, err := s.container.Snapshots()
+ if err == nil {
for _, snap := range fullSnaps {
snapshots = append(snapshots, snapshotToProtobuf(snap))
snapshotNames = append(snapshotNames, shared.ExtractSnapshotName(snap.Name()))
@@ -388,9 +387,10 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
Snapshots: snapshots,
Predump: proto.Bool(use_pre_dumps),
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
+ Xattrs: &rsyncHasFeature,
+ Delete: &rsyncHasFeature,
+ Compress: &rsyncHasFeature,
+ Bidirectional: &rsyncHasFeature,
},
}
@@ -400,26 +400,52 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
return err
}
- if fsErr != nil {
- s.sendControl(fsErr)
- return fsErr
- }
-
err = s.recv(&header)
if err != nil {
s.sendControl(err)
return err
}
+ // Handle rsync options
+ rsyncArgs := []string{}
+ rsyncFeatures := header.GetRsyncFeatures()
+ if !rsyncFeatures.GetBidirectional() {
+ // If no bi-directional support, assume LXD 3.7 level
+ // NOTE: Do NOT extend this list of arguments
+ rsyncArgs = append(rsyncArgs, "--xattrs")
+ rsyncArgs = append(rsyncArgs, "--delete")
+ rsyncArgs = append(rsyncArgs, "--compress")
+ rsyncArgs = append(rsyncArgs, "--compress-level=2")
+ } else {
+ if rsyncFeatures.GetXattrs() {
+ rsyncArgs = append(rsyncArgs, "--xattrs")
+ }
+ if rsyncFeatures.GetDelete() {
+ rsyncArgs = append(rsyncArgs, "--delete")
+ }
+ if rsyncFeatures.GetCompress() {
+ rsyncArgs = append(rsyncArgs, "--compress")
+ rsyncArgs = append(rsyncArgs, "--compress-level=2")
+ }
+ }
+ sourceArgs := MigrationSourceArgs{rsyncArgs}
+
+ // Initialize storage driver
+ driver, fsErr := s.container.Storage().MigrationSource(s.container, s.containerOnly, sourceArgs)
+ if fsErr != nil {
+ s.sendControl(fsErr)
+ return fsErr
+ }
+
bwlimit := ""
if header.GetRefresh() || *header.Fs != myType {
myType = migration.MigrationFSType_RSYNC
header.Fs = &myType
if header.GetRefresh() {
- driver, _ = rsyncRefreshSource(s.container, s.containerOnly, header.GetSnapshotNames())
+ driver, _ = rsyncRefreshSource(s.container, s.containerOnly, header.GetSnapshotNames(), sourceArgs)
} else {
- driver, _ = rsyncMigrationSource(s.container, s.containerOnly)
+ driver, _ = rsyncMigrationSource(s.container, s.containerOnly, sourceArgs)
}
// Check if this storage pool has a rate limit set for rsync.
@@ -561,6 +587,7 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
preDumpDir: preDumpDir,
dumpDir: dumpDir,
final: final,
+ rsyncArgs: rsyncArgs,
}
final, err = s.preDumpLoop(&loop_args)
if err != nil {
@@ -631,7 +658,7 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
*/
ctName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
state := s.container.DaemonState()
- err = RsyncSend(ctName, shared.AddSlash(checkpointDir), s.criuConn, nil, bwlimit, state.OS.ExecPath)
+ err = RsyncSend(ctName, shared.AddSlash(checkpointDir), s.criuConn, nil, rsyncArgs, bwlimit, state.OS.ExecPath)
if err != nil {
return abort(err)
}
@@ -818,12 +845,19 @@ func (c *migrationSink) Do(migrateOp *operation) error {
}
myType := c.src.container.Storage().MigrationType()
+ rsyncHasFeature := true
resp := migration.MigrationHeader{
Fs: &myType,
Criu: criuType,
Snapshots: header.Snapshots,
SnapshotNames: header.SnapshotNames,
Refresh: &c.refresh,
+ RsyncFeatures: &migration.RsyncFeatures{
+ Xattrs: &rsyncHasFeature,
+ Delete: &rsyncHasFeature,
+ Compress: &rsyncHasFeature,
+ Bidirectional: &rsyncHasFeature,
+ },
}
if c.refresh {
diff --git a/lxd/migrate_storage_volumes.go b/lxd/migrate_storage_volumes.go
index eb10bafc33..9b30157aea 100644
--- a/lxd/migrate_storage_volumes.go
+++ b/lxd/migrate_storage_volumes.go
@@ -51,9 +51,10 @@ func (s *migrationSourceWs) DoStorage(migrateOp *operation) error {
header := migration.MigrationHeader{
Fs: &myType,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
+ Xattrs: &rsyncHasFeature,
+ Delete: &rsyncHasFeature,
+ Compress: &rsyncHasFeature,
+ Bidirectional: &rsyncHasFeature,
},
}
@@ -64,13 +65,6 @@ func (s *migrationSourceWs) DoStorage(migrateOp *operation) error {
return err
}
- driver, fsErr := s.storage.StorageMigrationSource()
- if fsErr != nil {
- logger.Errorf("Failed to initialize new storage volume migration driver")
- s.sendControl(fsErr)
- return fsErr
- }
-
err = s.recv(&header)
if err != nil {
logger.Errorf("Failed to receive storage volume migration header")
@@ -78,12 +72,43 @@ func (s *migrationSourceWs) DoStorage(migrateOp *operation) error {
return err
}
+ // Handle rsync options
+ rsyncArgs := []string{}
+ rsyncFeatures := header.GetRsyncFeatures()
+ if !rsyncFeatures.GetBidirectional() {
+ // If no bi-directional support, assume LXD 3.7 level
+ // NOTE: Do NOT extend this list of arguments
+ rsyncArgs = append(rsyncArgs, "--xattrs")
+ rsyncArgs = append(rsyncArgs, "--delete")
+ rsyncArgs = append(rsyncArgs, "--compress")
+ rsyncArgs = append(rsyncArgs, "--compress-level=2")
+ } else {
+ if rsyncFeatures.GetXattrs() {
+ rsyncArgs = append(rsyncArgs, "--xattrs")
+ }
+ if rsyncFeatures.GetDelete() {
+ rsyncArgs = append(rsyncArgs, "--delete")
+ }
+ if rsyncFeatures.GetCompress() {
+ rsyncArgs = append(rsyncArgs, "--compress")
+ rsyncArgs = append(rsyncArgs, "--compress-level=2")
+ }
+ }
+ sourceArgs := MigrationSourceArgs{rsyncArgs}
+
+ driver, fsErr := s.storage.StorageMigrationSource(sourceArgs)
+ if fsErr != nil {
+ logger.Errorf("Failed to initialize new storage volume migration driver")
+ s.sendControl(fsErr)
+ return fsErr
+ }
+
bwlimit := ""
if *header.Fs != myType {
myType = migration.MigrationFSType_RSYNC
header.Fs = &myType
- driver, _ = rsyncStorageMigrationSource()
+ driver, _ = rsyncStorageMigrationSource(sourceArgs)
// Check if this storage pool has a rate limit set for rsync.
poolwritable := s.storage.GetStoragePoolWritable()
@@ -223,9 +248,10 @@ func (c *migrationSink) DoStorage(migrateOp *operation) error {
resp := migration.MigrationHeader{
Fs: &myType,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
+ Xattrs: &rsyncHasFeature,
+ Delete: &rsyncHasFeature,
+ Compress: &rsyncHasFeature,
+ Bidirectional: &rsyncHasFeature,
},
}
diff --git a/lxd/migration/migrate.pb.go b/lxd/migration/migrate.pb.go
index f31f9b7140..9ba7f19cfc 100644
--- a/lxd/migration/migrate.pb.go
+++ b/lxd/migration/migrate.pb.go
@@ -298,6 +298,7 @@ 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"`
+ Bidirectional *bool `protobuf:"varint,4,opt,name=bidirectional" json:"bidirectional,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
@@ -327,6 +328,13 @@ func (m *RsyncFeatures) GetCompress() bool {
return false
}
+func (m *RsyncFeatures) GetBidirectional() bool {
+ if m != nil && m.Bidirectional != nil {
+ return *m.Bidirectional
+ }
+ 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"`
@@ -634,68 +642,69 @@ func init() {
func init() { proto.RegisterFile("lxd/migration/migrate.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 1005 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcd, 0x6e, 0xdb, 0x46,
- 0x10, 0xae, 0x24, 0xca, 0x16, 0x47, 0x92, 0xa3, 0x6c, 0x82, 0x82, 0x48, 0xfa, 0xa3, 0x32, 0x29,
- 0xaa, 0xfa, 0x10, 0xa7, 0x0a, 0x0a, 0xb4, 0x97, 0x02, 0xb5, 0x5c, 0x37, 0x01, 0x12, 0xd7, 0x58,
- 0xd9, 0x28, 0xda, 0x1e, 0x88, 0x2d, 0x39, 0x94, 0x17, 0xe6, 0x1f, 0x76, 0x29, 0xdb, 0xf2, 0xa5,
- 0x4f, 0xd3, 0xe7, 0xe9, 0xa9, 0xe7, 0xbe, 0x4a, 0xb1, 0xb3, 0x24, 0x4d, 0x39, 0x05, 0x7a, 0xdb,
- 0xf9, 0xe6, 0xe3, 0xcc, 0xce, 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 0xde, 0x2c, 0xf2, 0x6b, 0xa3, 0x5b, 0x9c, 0xab, 0xcb, 0x46, 0xfc, 0x4a, 0xb7,
+ 0x0a, 0xab, 0xa5, 0xad, 0x8b, 0x69, 0xc9, 0x36, 0xac, 0x30, 0xa2, 0x34, 0x85, 0x55, 0xa0, 0x91,
+ 0xad, 0xd3, 0x14, 0xc6, 0x2b, 0xd0, 0xbf, 0x81, 0x61, 0xfb, 0x3a, 0x07, 0xe0, 0x44, 0x76, 0x54,
+ 0xcd, 0x72, 0x3d, 0x6d, 0x2d, 0xd7, 0xfd, 0x21, 0xe5, 0x44, 0x64, 0xdf, 0x98, 0xb5, 0xa2, 0x58,
+ 0xb4, 0x0e, 0xc3, 0xf9, 0x27, 0xed, 0x85, 0xfc, 0xb0, 0x61, 0xbc, 0xa6, 0xef, 0x7f, 0xdb, 0x7a,
+ 0xd7, 0xec, 0x7b, 0xc5, 0x5c, 0xe8, 0xf3, 0xe5, 0x2f, 0x27, 0x8b, 0xc9, 0xff, 0xcc, 0xf1, 0xf0,
+ 0x8c, 0x1f, 0x2f, 0x27, 0x1d, 0xb6, 0x0b, 0xbd, 0x5f, 0x8f, 0x97, 0x93, 0xae, 0x39, 0xf0, 0xc3,
+ 0xa3, 0x49, 0x6f, 0xff, 0x00, 0x06, 0xf5, 0xe3, 0xc5, 0xf6, 0x00, 0xcc, 0x39, 0x68, 0x7d, 0x78,
+ 0xfa, 0xfa, 0xfb, 0xf3, 0xb7, 0x93, 0x0e, 0x1b, 0x80, 0x73, 0xf2, 0xd3, 0xc9, 0x0f, 0x93, 0xee,
+ 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xe0, 0x8b, 0x09, 0x3f, 0x08, 0x00, 0x00,
}
diff --git a/lxd/migration/migrate.proto b/lxd/migration/migrate.proto
index 009aa8fcba..938e73af0d 100644
--- a/lxd/migration/migrate.proto
+++ b/lxd/migration/migrate.proto
@@ -50,6 +50,7 @@ message rsyncFeatures {
optional bool xattrs = 1;
optional bool delete = 2;
optional bool compress = 3;
+ optional bool bidirectional = 4;
}
message MigrationHeader {
diff --git a/lxd/rsync.go b/lxd/rsync.go
index cb8874ac12..e6bf3543ad 100644
--- a/lxd/rsync.go
+++ b/lxd/rsync.go
@@ -62,7 +62,7 @@ func rsyncLocalCopy(source string, dest string, bwlimit string) (string, error)
return msg, nil
}
-func rsyncSendSetup(name string, path string, bwlimit string, execPath string) (*exec.Cmd, net.Conn, io.ReadCloser, error) {
+func rsyncSendSetup(name string, path string, bwlimit string, execPath string, extraArgs []string) (*exec.Cmd, net.Conn, io.ReadCloser, error) {
/*
* The way rsync works, it invokes a subprocess that does the actual
* talking (given to it by a -E argument). Since there isn't an easy
@@ -104,22 +104,27 @@ func rsyncSendSetup(name string, path string, bwlimit string, execPath string) (
bwlimit = "0"
}
- cmd := exec.Command("rsync",
+ args := []string{
"-ar",
"--devices",
"--numeric-ids",
"--partial",
"--sparse",
- "--xattrs",
- "--delete",
- "--compress",
- "--compress-level=2",
+ }
+
+ if extraArgs != nil && len(extraArgs) > 0 {
+ args = append(args, extraArgs...)
+ }
+
+ args = append(args, []string{
path,
"localhost:/tmp/foo",
"-e",
rsyncCmd,
"--bwlimit",
- bwlimit)
+ bwlimit}...)
+
+ cmd := exec.Command("rsync", args...)
stderr, err := cmd.StderrPipe()
if err != nil {
@@ -143,8 +148,8 @@ func rsyncSendSetup(name string, path string, bwlimit string, execPath string) (
// RsyncSend sets up the sending half of an rsync, to recursively send the
// directory pointed to by path over the websocket.
-func RsyncSend(name string, path string, conn *websocket.Conn, readWrapper func(io.ReadCloser) io.ReadCloser, bwlimit string, execPath string) error {
- cmd, dataSocket, stderr, err := rsyncSendSetup(name, path, bwlimit, execPath)
+func RsyncSend(name string, path string, conn *websocket.Conn, readWrapper func(io.ReadCloser) io.ReadCloser, extraArgs []string, bwlimit string, execPath string) error {
+ cmd, dataSocket, stderr, err := rsyncSendSetup(name, path, bwlimit, execPath, extraArgs)
if err != nil {
return err
}
diff --git a/lxd/storage.go b/lxd/storage.go
index 5b81367b71..b394968d8d 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -232,7 +232,7 @@ type storage interface {
// We leave sending containers which are snapshots of other containers
// already present on the target instance as an exercise for the
// enterprising developer.
- MigrationSource(c container, containerOnly bool) (MigrationStorageSourceDriver, error)
+ MigrationSource(c container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error)
MigrationSink(
live bool,
c container,
@@ -243,7 +243,7 @@ type storage interface {
containerOnly bool,
args MigrationSinkArgs) error
- StorageMigrationSource() (MigrationStorageSourceDriver, error)
+ StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error)
StorageMigrationSink(conn *websocket.Conn, op *operation, storage storage, args MigrationSinkArgs) error
}
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index bd710bf4fc..3325fa0ea7 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -2625,9 +2625,9 @@ func (s *storageBtrfs) PreservesInodes() bool {
return true
}
-func (s *storageBtrfs) MigrationSource(c container, containerOnly bool) (MigrationStorageSourceDriver, error) {
+func (s *storageBtrfs) MigrationSource(c container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
if s.s.OS.RunningInUserNS {
- return rsyncMigrationSource(c, containerOnly)
+ return rsyncMigrationSource(c, containerOnly, args)
}
/* List all the snapshots in order of reverse creation. The idea here
@@ -3038,8 +3038,8 @@ func (s *btrfsMigrationSourceDriver) SendStorageVolume(conn *websocket.Conn, op
return fmt.Errorf(msg)
}
-func (s *storageBtrfs) StorageMigrationSource() (MigrationStorageSourceDriver, error) {
- return rsyncStorageMigrationSource()
+func (s *storageBtrfs) StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncStorageMigrationSource(args)
}
func (s *storageBtrfs) StorageMigrationSink(conn *websocket.Conn, op *operation, storage storage, args MigrationSinkArgs) error {
diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index 2e79ba5e11..2382757dab 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -2734,8 +2734,8 @@ func (s *rbdMigrationSourceDriver) SendStorageVolume(conn *websocket.Conn, op *o
return fmt.Errorf(msg)
}
-func (s *storageCeph) StorageMigrationSource() (MigrationStorageSourceDriver, error) {
- return rsyncStorageMigrationSource()
+func (s *storageCeph) StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncStorageMigrationSource(args)
}
func (s *storageCeph) StorageMigrationSink(conn *websocket.Conn, op *operation, storage storage, args MigrationSinkArgs) error {
diff --git a/lxd/storage_ceph_migration.go b/lxd/storage_ceph_migration.go
index 08c539e89b..6abd4d76af 100644
--- a/lxd/storage_ceph_migration.go
+++ b/lxd/storage_ceph_migration.go
@@ -159,7 +159,7 @@ func (s *storageCeph) PreservesInodes() bool {
return false
}
-func (s *storageCeph) MigrationSource(c container, containerOnly bool) (MigrationStorageSourceDriver, error) {
+func (s *storageCeph) MigrationSource(c container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
// If the container is a snapshot, let's just send that. We don't need
// to send anything else, because that's all the user asked for.
if c.IsSnapshot() {
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 66cc9a7803..20059b4993 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -1272,8 +1272,8 @@ func (s *storageDir) PreservesInodes() bool {
return false
}
-func (s *storageDir) MigrationSource(container container, containerOnly bool) (MigrationStorageSourceDriver, error) {
- return rsyncMigrationSource(container, containerOnly)
+func (s *storageDir) MigrationSource(container container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncMigrationSource(container, containerOnly, args)
}
func (s *storageDir) MigrationSink(live bool, container container, snapshots []*migration.Snapshot, conn *websocket.Conn, srcIdmap *idmap.IdmapSet, op *operation, containerOnly bool, args MigrationSinkArgs) error {
@@ -1355,8 +1355,8 @@ func (s *storageDir) StoragePoolVolumeCopy(source *api.StorageVolumeSource) erro
return nil
}
-func (s *storageDir) StorageMigrationSource() (MigrationStorageSourceDriver, error) {
- return rsyncStorageMigrationSource()
+func (s *storageDir) StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncStorageMigrationSource(args)
}
func (s *storageDir) StorageMigrationSink(conn *websocket.Conn, op *operation, storage storage, args MigrationSinkArgs) error {
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index 46281ca6f3..a2b5df8d82 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -2069,8 +2069,8 @@ func (s *storageLvm) PreservesInodes() bool {
return false
}
-func (s *storageLvm) MigrationSource(container container, containerOnly bool) (MigrationStorageSourceDriver, error) {
- return rsyncMigrationSource(container, containerOnly)
+func (s *storageLvm) MigrationSource(container container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncMigrationSource(container, containerOnly, args)
}
func (s *storageLvm) MigrationSink(live bool, container container, snapshots []*migration.Snapshot, conn *websocket.Conn, srcIdmap *idmap.IdmapSet, op *operation, containerOnly bool, args MigrationSinkArgs) error {
@@ -2278,8 +2278,8 @@ func (s *storageLvm) StoragePoolVolumeCopy(source *api.StorageVolumeSource) erro
return nil
}
-func (s *storageLvm) StorageMigrationSource() (MigrationStorageSourceDriver, error) {
- return rsyncStorageMigrationSource()
+func (s *storageLvm) StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncStorageMigrationSource(args)
}
func (s *storageLvm) StorageMigrationSink(conn *websocket.Conn, op *operation, storage storage, args MigrationSinkArgs) error {
diff --git a/lxd/storage_migration.go b/lxd/storage_migration.go
index cd3c7b03ad..c7e7c8e972 100644
--- a/lxd/storage_migration.go
+++ b/lxd/storage_migration.go
@@ -43,6 +43,7 @@ type MigrationStorageSourceDriver interface {
type rsyncStorageSourceDriver struct {
container container
snapshots []container
+ rsyncArgs []string
}
func (s rsyncStorageSourceDriver) Snapshots() []container {
@@ -66,7 +67,7 @@ func (s rsyncStorageSourceDriver) SendStorageVolume(conn *websocket.Conn, op *op
path := getStoragePoolVolumeMountPoint(pool.Name, volume.Name)
path = shared.AddSlash(path)
logger.Debugf("Starting to send storage volume %s on storage pool %s from %s", volume.Name, pool.Name, path)
- return RsyncSend(volume.Name, path, conn, wrapper, bwlimit, state.OS.ExecPath)
+ return RsyncSend(volume.Name, path, conn, wrapper, s.rsyncArgs, bwlimit, state.OS.ExecPath)
}
func (s rsyncStorageSourceDriver) SendWhileRunning(conn *websocket.Conn, op *operation, bwlimit string, containerOnly bool) error {
@@ -85,7 +86,7 @@ func (s rsyncStorageSourceDriver) SendWhileRunning(conn *websocket.Conn, op *ope
path := send.Path()
wrapper := StorageProgressReader(op, "fs_progress", send.Name())
state := s.container.DaemonState()
- err = RsyncSend(projectPrefix(s.container.Project(), ctName), shared.AddSlash(path), conn, wrapper, bwlimit, state.OS.ExecPath)
+ err = RsyncSend(projectPrefix(s.container.Project(), ctName), shared.AddSlash(path), conn, wrapper, s.rsyncArgs, bwlimit, state.OS.ExecPath)
if err != nil {
return err
}
@@ -94,25 +95,25 @@ func (s rsyncStorageSourceDriver) SendWhileRunning(conn *websocket.Conn, op *ope
wrapper := StorageProgressReader(op, "fs_progress", s.container.Name())
state := s.container.DaemonState()
- return RsyncSend(projectPrefix(s.container.Project(), ctName), shared.AddSlash(s.container.Path()), conn, wrapper, bwlimit, state.OS.ExecPath)
+ return RsyncSend(projectPrefix(s.container.Project(), ctName), shared.AddSlash(s.container.Path()), conn, wrapper, s.rsyncArgs, bwlimit, state.OS.ExecPath)
}
func (s rsyncStorageSourceDriver) SendAfterCheckpoint(conn *websocket.Conn, bwlimit string) error {
ctName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
// resync anything that changed between our first send and the checkpoint
state := s.container.DaemonState()
- return RsyncSend(projectPrefix(s.container.Project(), ctName), shared.AddSlash(s.container.Path()), conn, nil, bwlimit, state.OS.ExecPath)
+ return RsyncSend(projectPrefix(s.container.Project(), ctName), shared.AddSlash(s.container.Path()), conn, nil, s.rsyncArgs, bwlimit, state.OS.ExecPath)
}
func (s rsyncStorageSourceDriver) Cleanup() {
// noop
}
-func rsyncStorageMigrationSource() (MigrationStorageSourceDriver, error) {
- return rsyncStorageSourceDriver{nil, nil}, nil
+func rsyncStorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncStorageSourceDriver{nil, nil, args.RsyncArgs}, nil
}
-func rsyncRefreshSource(c container, containerOnly bool, refreshSnapshots []string) (MigrationStorageSourceDriver, error) {
+func rsyncRefreshSource(c container, containerOnly bool, refreshSnapshots []string, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
var snapshots = []container{}
if !containerOnly {
allSnapshots, err := c.Snapshots()
@@ -130,10 +131,10 @@ func rsyncRefreshSource(c container, containerOnly bool, refreshSnapshots []stri
}
}
- return rsyncStorageSourceDriver{c, snapshots}, nil
+ return rsyncStorageSourceDriver{c, snapshots, args.RsyncArgs}, nil
}
-func rsyncMigrationSource(c container, containerOnly bool) (MigrationStorageSourceDriver, error) {
+func rsyncMigrationSource(c container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
var err error
var snapshots = []container{}
if !containerOnly {
@@ -143,7 +144,7 @@ func rsyncMigrationSource(c container, containerOnly bool) (MigrationStorageSour
}
}
- return rsyncStorageSourceDriver{c, snapshots}, nil
+ return rsyncStorageSourceDriver{c, snapshots, args.RsyncArgs}, nil
}
func snapshotProtobufToContainerArgs(project string, containerName string, snap *migration.Snapshot) db.ContainerArgs {
diff --git a/lxd/storage_mock.go b/lxd/storage_mock.go
index ed81e1a841..d7757612f4 100644
--- a/lxd/storage_mock.go
+++ b/lxd/storage_mock.go
@@ -226,7 +226,7 @@ func (s *storageMock) PreservesInodes() bool {
return false
}
-func (s *storageMock) MigrationSource(container container, containerOnly bool) (MigrationStorageSourceDriver, error) {
+func (s *storageMock) MigrationSource(container container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
return nil, fmt.Errorf("not implemented")
}
@@ -246,7 +246,7 @@ func (s *storageMock) StoragePoolVolumeCopy(source *api.StorageVolumeSource) err
return nil
}
-func (s *storageMock) StorageMigrationSource() (MigrationStorageSourceDriver, error) {
+func (s *storageMock) StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
return nil, nil
}
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index d10935b5ed..9f89244317 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -2660,7 +2660,7 @@ func (s *storageZfs) PreservesInodes() bool {
return true
}
-func (s *storageZfs) MigrationSource(ct container, containerOnly bool) (MigrationStorageSourceDriver, error) {
+func (s *storageZfs) MigrationSource(ct container, containerOnly bool, args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
/* If the container is a snapshot, let's just send that; we don't need
* to send anything else, because that's all the user asked for.
*/
@@ -3243,8 +3243,8 @@ func (s *zfsMigrationSourceDriver) SendStorageVolume(conn *websocket.Conn, op *o
return fmt.Errorf(msg)
}
-func (s *storageZfs) StorageMigrationSource() (MigrationStorageSourceDriver, error) {
- return rsyncStorageMigrationSource()
+func (s *storageZfs) StorageMigrationSource(args MigrationSourceArgs) (MigrationStorageSourceDriver, error) {
+ return rsyncStorageMigrationSource(args)
}
func (s *storageZfs) StorageMigrationSink(conn *websocket.Conn, op *operation, storage storage, args MigrationSinkArgs) error {
More information about the lxc-devel
mailing list