stgraber on Github
2018-11-26 07:05:57 UTC
From e6198024b85ed488efcae9ad595ac9452439111d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <***@ubuntu.com>
Date: Mon, 26 Nov 2018 02:05:03 -0500
Subject: [PATCH] lxd/migration: Negotiate ZFS compression
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <***@ubuntu.com>
---
lxd/migrate.go | 1 +
lxd/migrate_container.go | 44 ++++++---
lxd/migrate_storage_volumes.go | 44 ++++++---
lxd/migration/migrate.pb.go | 171 +++++++++++++++++++--------------
lxd/migration/migrate.proto | 5 +
lxd/storage_zfs.go | 8 +-
6 files changed, 178 insertions(+), 95 deletions(-)
diff --git a/lxd/migrate.go b/lxd/migrate.go
index 070c0fd044..d2589f3a5d 100644
--- a/lxd/migrate.go
+++ b/lxd/migrate.go
@@ -276,6 +276,7 @@ type MigrationSinkArgs struct {
type MigrationSourceArgs struct {
// transport specific fields
RsyncArgs []string
+ ZfsArgs []string
}
func (c *migrationSink) connectWithSecret(secret string) (*websocket.Conn, error) {
diff --git a/lxd/migrate_container.go b/lxd/migrate_container.go
index ec4f279c3e..e911784d38 100644
--- a/lxd/migrate_container.go
+++ b/lxd/migrate_container.go
@@ -378,7 +378,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()
- rsyncHasFeature := true
+ hasFeature := true
header := migration.MigrationHeader{
Fs: &myType,
Criu: criuType,
@@ -387,13 +387,19 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
Snapshots: snapshots,
Predump: proto.Bool(use_pre_dumps),
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ header.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
err = s.send(&header)
if err != nil {
s.sendControl(err)
@@ -428,7 +434,17 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
rsyncArgs = append(rsyncArgs, "--compress-level=2")
}
}
- sourceArgs := MigrationSourceArgs{rsyncArgs}
+
+ // Handle zfs options
+ zfsArgs := []string{}
+ zfsFeatures := header.GetZfsFeatures()
+ if zfsFeatures.GetCompress() && len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ zfsArgs = append(zfsArgs, "-c")
+ zfsArgs = append(zfsArgs, "-L")
+ }
+
+ // Set source args
+ sourceArgs := MigrationSourceArgs{rsyncArgs, zfsArgs}
// Initialize storage driver
driver, fsErr := s.container.Storage().MigrationSource(s.container, s.containerOnly, sourceArgs)
@@ -845,7 +861,7 @@ func (c *migrationSink) Do(migrateOp *operation) error {
}
myType := c.src.container.Storage().MigrationType()
- rsyncHasFeature := true
+ hasFeature := true
resp := migration.MigrationHeader{
Fs: &myType,
Criu: criuType,
@@ -853,13 +869,19 @@ func (c *migrationSink) Do(migrateOp *operation) error {
SnapshotNames: header.SnapshotNames,
Refresh: &c.refresh,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ resp.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
if c.refresh {
// Get our existing snapshots
targetSnapshots, err := c.src.container.Snapshots()
diff --git a/lxd/migrate_storage_volumes.go b/lxd/migrate_storage_volumes.go
index 9b30157aea..66c8978873 100644
--- a/lxd/migrate_storage_volumes.go
+++ b/lxd/migrate_storage_volumes.go
@@ -47,17 +47,23 @@ 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()
- rsyncHasFeature := true
+ hasFeature := true
header := migration.MigrationHeader{
Fs: &myType,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ header.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
err = s.send(&header)
if err != nil {
logger.Errorf("Failed to send storage volume migration header")
@@ -94,7 +100,17 @@ func (s *migrationSourceWs) DoStorage(migrateOp *operation) error {
rsyncArgs = append(rsyncArgs, "--compress-level=2")
}
}
- sourceArgs := MigrationSourceArgs{rsyncArgs}
+
+ // Handle zfs options
+ zfsArgs := []string{}
+ zfsFeatures := header.GetZfsFeatures()
+ if zfsFeatures.GetCompress() && len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ zfsArgs = append(zfsArgs, "-c")
+ zfsArgs = append(zfsArgs, "-L")
+ }
+
+ // Set source args
+ sourceArgs := MigrationSourceArgs{rsyncArgs, zfsArgs}
driver, fsErr := s.storage.StorageMigrationSource(sourceArgs)
if fsErr != nil {
@@ -244,17 +260,23 @@ func (c *migrationSink) DoStorage(migrateOp *operation) error {
mySink := c.src.storage.StorageMigrationSink
myType := c.src.storage.MigrationType()
- rsyncHasFeature := true
+ hasFeature := true
resp := migration.MigrationHeader{
Fs: &myType,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ resp.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
// If the storage type the source has doesn't match what we have, then
// we have to use rsync.
if *header.Fs != *resp.Fs {
diff --git a/lxd/migration/migrate.pb.go b/lxd/migration/migrate.pb.go
index 9ba7f19cfc..c7e83a97d6 100644
--- a/lxd/migration/migrate.pb.go
+++ b/lxd/migration/migrate.pb.go
@@ -13,6 +13,7 @@ It has these top-level messages:
Device
Snapshot
RsyncFeatures
+ ZfsFeatures
MigrationHeader
MigrationControl
MigrationSync
@@ -335,6 +336,23 @@ func (m *RsyncFeatures) GetBidirectional() bool {
return false
}
+type ZfsFeatures struct {
+ Compress *bool `protobuf:"varint,1,opt,name=compress" json:"compress,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
+}
+
+func (m *ZfsFeatures) Reset() { *m = ZfsFeatures{} }
+func (m *ZfsFeatures) String() string { return proto.CompactTextString(m) }
+func (*ZfsFeatures) ProtoMessage() {}
+func (*ZfsFeatures) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+
+func (m *ZfsFeatures) 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"`
@@ -344,13 +362,14 @@ type MigrationHeader struct {
Predump *bool `protobuf:"varint,7,opt,name=predump" json:"predump,omitempty"`
RsyncFeatures *RsyncFeatures `protobuf:"bytes,8,opt,name=rsyncFeatures" json:"rsyncFeatures,omitempty"`
Refresh *bool `protobuf:"varint,9,opt,name=refresh" json:"refresh,omitempty"`
+ ZfsFeatures *ZfsFeatures `protobuf:"bytes,10,opt,name=zfsFeatures" json:"zfsFeatures,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *MigrationHeader) Reset() { *m = MigrationHeader{} }
func (m *MigrationHeader) String() string { return proto.CompactTextString(m) }
func (*MigrationHeader) ProtoMessage() {}
-func (*MigrationHeader) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (*MigrationHeader) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *MigrationHeader) GetFs() MigrationFSType {
if m != nil && m.Fs != nil {
@@ -408,6 +427,13 @@ func (m *MigrationHeader) GetRefresh() bool {
return false
}
+func (m *MigrationHeader) GetZfsFeatures() *ZfsFeatures {
+ if m != nil {
+ return m.ZfsFeatures
+ }
+ return nil
+}
+
type MigrationControl struct {
Success *bool `protobuf:"varint,1,req,name=success" json:"success,omitempty"`
// optional failure message if sending a failure
@@ -418,7 +444,7 @@ type MigrationControl struct {
func (m *MigrationControl) Reset() { *m = MigrationControl{} }
func (m *MigrationControl) String() string { return proto.CompactTextString(m) }
func (*MigrationControl) ProtoMessage() {}
-func (*MigrationControl) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+func (*MigrationControl) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *MigrationControl) GetSuccess() bool {
if m != nil && m.Success != nil {
@@ -442,7 +468,7 @@ type MigrationSync struct {
func (m *MigrationSync) Reset() { *m = MigrationSync{} }
func (m *MigrationSync) String() string { return proto.CompactTextString(m) }
func (*MigrationSync) ProtoMessage() {}
-func (*MigrationSync) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
+func (*MigrationSync) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *MigrationSync) GetFinalPreDump() bool {
if m != nil && m.FinalPreDump != nil {
@@ -470,7 +496,7 @@ type DumpStatsEntry struct {
func (m *DumpStatsEntry) Reset() { *m = DumpStatsEntry{} }
func (m *DumpStatsEntry) String() string { return proto.CompactTextString(m) }
func (*DumpStatsEntry) ProtoMessage() {}
-func (*DumpStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
+func (*DumpStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *DumpStatsEntry) GetFreezingTime() uint32 {
if m != nil && m.FreezingTime != nil {
@@ -561,7 +587,7 @@ type RestoreStatsEntry struct {
func (m *RestoreStatsEntry) Reset() { *m = RestoreStatsEntry{} }
func (m *RestoreStatsEntry) String() string { return proto.CompactTextString(m) }
func (*RestoreStatsEntry) ProtoMessage() {}
-func (*RestoreStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
+func (*RestoreStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *RestoreStatsEntry) GetPagesCompared() uint64 {
if m != nil && m.PagesCompared != nil {
@@ -607,7 +633,7 @@ type StatsEntry struct {
func (m *StatsEntry) Reset() { *m = StatsEntry{} }
func (m *StatsEntry) String() string { return proto.CompactTextString(m) }
func (*StatsEntry) ProtoMessage() {}
-func (*StatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
+func (*StatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *StatsEntry) GetDump() *DumpStatsEntry {
if m != nil {
@@ -629,6 +655,7 @@ func init() {
proto.RegisterType((*Device)(nil), "migration.Device")
proto.RegisterType((*Snapshot)(nil), "migration.Snapshot")
proto.RegisterType((*RsyncFeatures)(nil), "migration.rsyncFeatures")
+ proto.RegisterType((*ZfsFeatures)(nil), "migration.zfsFeatures")
proto.RegisterType((*MigrationHeader)(nil), "migration.MigrationHeader")
proto.RegisterType((*MigrationControl)(nil), "migration.MigrationControl")
proto.RegisterType((*MigrationSync)(nil), "migration.MigrationSync")
@@ -642,69 +669,71 @@ func init() {
func init() { proto.RegisterFile("lxd/migration/migrate.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 1022 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x4d, 0x6f, 0xdb, 0x46,
- 0x13, 0x7e, 0x25, 0x51, 0xb6, 0x38, 0x92, 0x1c, 0x65, 0x13, 0xbc, 0x20, 0x92, 0x7e, 0xa8, 0x4c,
- 0x8a, 0xaa, 0x3e, 0xc4, 0xa9, 0x82, 0x02, 0xed, 0xa5, 0x40, 0x2d, 0xd7, 0x4d, 0x80, 0xc4, 0x35,
- 0x56, 0x36, 0x8a, 0xf6, 0x42, 0x6c, 0xc8, 0xa1, 0xbc, 0x30, 0xbf, 0xb0, 0x4b, 0xd9, 0x96, 0x2f,
- 0x45, 0x7f, 0x4c, 0x7f, 0x4f, 0x4f, 0x3d, 0xf7, 0xaf, 0x14, 0x3b, 0x4b, 0xd2, 0x94, 0x53, 0xa0,
- 0xb7, 0x9d, 0x67, 0x1e, 0xce, 0xcc, 0xce, 0x33, 0xb3, 0x84, 0xa7, 0xc9, 0x4d, 0x74, 0x90, 0xca,
- 0x95, 0x12, 0xa5, 0xcc, 0xb3, 0xea, 0x84, 0x2f, 0x0a, 0x95, 0x97, 0x39, 0x73, 0x1b, 0x87, 0xff,
- 0x1b, 0xb8, 0x6f, 0x8e, 0xde, 0x89, 0xe2, 0x6c, 0x53, 0x20, 0x7b, 0x0c, 0x7d, 0xa9, 0xd7, 0x32,
- 0xf2, 0x3a, 0xd3, 0xee, 0x6c, 0xc0, 0xad, 0x61, 0xd1, 0x95, 0x8c, 0xbc, 0x6e, 0x8d, 0xae, 0x64,
- 0xc4, 0xfe, 0x0f, 0x3b, 0x17, 0xb9, 0x2e, 0x65, 0xe4, 0xf5, 0xa6, 0xdd, 0x59, 0x9f, 0x57, 0x16,
- 0x63, 0xe0, 0x64, 0x5a, 0x46, 0x9e, 0x43, 0x28, 0x9d, 0xd9,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aa, 0x19, 0x9f, 0xa7, 0x8d, 0xf1, 0xb9,
+ 0xdf, 0xa4, 0x9c, 0x88, 0xec, 0xb5, 0x19, 0x48, 0xd2, 0xa2, 0x71, 0x18, 0xcc, 0x3e, 0x6f, 0x8e,
+ 0xf2, 0xc7, 0x09, 0xe3, 0x15, 0x7d, 0xef, 0xbb, 0xc6, 0x46, 0xb4, 0x9b, 0x8e, 0x39, 0xd0, 0xe3,
+ 0x8b, 0x5f, 0x4f, 0xe6, 0xe3, 0x4f, 0xcc, 0xf1, 0xf0, 0x8c, 0x1f, 0x2f, 0xc6, 0x2d, 0xb6, 0x0d,
+ 0x9d, 0xdf, 0x8e, 0x17, 0xe3, 0xb6, 0x39, 0xf0, 0xc3, 0xa3, 0x71, 0x67, 0xef, 0x00, 0xfa, 0xd5,
+ 0xda, 0x63, 0x3b, 0x00, 0xe6, 0xec, 0x37, 0x3e, 0x3c, 0x7d, 0xf3, 0xc3, 0xf9, 0xbb, 0x71, 0x8b,
+ 0xf5, 0xa1, 0x7b, 0xf2, 0xf3, 0xc9, 0x8f, 0xe3, 0xf6, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcf,
+ 0xd6, 0xdc, 0x0b, 0xa4, 0x08, 0x00, 0x00,
}
diff --git a/lxd/migration/migrate.proto b/lxd/migration/migrate.proto
index 938e73af0d..df01b51e5c 100644
--- a/lxd/migration/migrate.proto
+++ b/lxd/migration/migrate.proto
@@ -53,6 +53,10 @@ message rsyncFeatures {
optional bool bidirectional = 4;
}
+message zfsFeatures {
+ optional bool compress = 1;
+}
+
message MigrationHeader {
required MigrationFSType fs = 1;
optional CRIUType criu = 2;
@@ -62,6 +66,7 @@ message MigrationHeader {
optional bool predump = 7;
optional rsyncFeatures rsyncFeatures = 8;
optional bool refresh = 9;
+ optional zfsFeatures zfsFeatures = 10;
}
message MigrationControl {
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 9f89244317..a008909172 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -2541,6 +2541,7 @@ type zfsMigrationSourceDriver struct {
zfs *storageZfs
runningSnapName string
stoppedSnapName string
+ zfsArgs []string
}
func (s *zfsMigrationSourceDriver) Snapshots() []container {
@@ -2550,7 +2551,9 @@ func (s *zfsMigrationSourceDriver) Snapshots() []container {
func (s *zfsMigrationSourceDriver) send(conn *websocket.Conn, zfsName string, zfsParent string, readWrapper func(io.ReadCloser) io.ReadCloser) error {
sourceParentName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
poolName := s.zfs.getOnDiskPoolName()
- args := []string{"send", fmt.Sprintf("%s/containers/%s@%s", poolName, projectPrefix(s.container.Project(), sourceParentName), zfsName)}
+ args := []string{"send"}
+ args = append(args, s.zfsArgs...)
+ args = append(args, []string{fmt.Sprintf("%s/containers/%s@%s", poolName, projectPrefix(s.container.Project(), sourceParentName), zfsName)}...)
if zfsParent != "" {
args = append(args, "-i", fmt.Sprintf("%s/containers/%s@%s", poolName, projectPrefix(s.container.Project(), s.container.Name()), zfsParent))
}
@@ -2665,7 +2668,7 @@ func (s *storageZfs) MigrationSource(ct container, containerOnly bool, args Migr
* to send anything else, because that's all the user asked for.
*/
if ct.IsSnapshot() {
- return &zfsMigrationSourceDriver{container: ct, zfs: s}, nil
+ return &zfsMigrationSourceDriver{container: ct, zfs: s, zfsArgs: args.ZfsArgs}, nil
}
driver := zfsMigrationSourceDriver{
@@ -2673,6 +2676,7 @@ func (s *storageZfs) MigrationSource(ct container, containerOnly bool, args Migr
snapshots: []container{},
zfsSnapshotNames: []string{},
zfs: s,
+ zfsArgs: args.ZfsArgs,
}
if containerOnly {
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <***@ubuntu.com>
Date: Mon, 26 Nov 2018 02:05:03 -0500
Subject: [PATCH] lxd/migration: Negotiate ZFS compression
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <***@ubuntu.com>
---
lxd/migrate.go | 1 +
lxd/migrate_container.go | 44 ++++++---
lxd/migrate_storage_volumes.go | 44 ++++++---
lxd/migration/migrate.pb.go | 171 +++++++++++++++++++--------------
lxd/migration/migrate.proto | 5 +
lxd/storage_zfs.go | 8 +-
6 files changed, 178 insertions(+), 95 deletions(-)
diff --git a/lxd/migrate.go b/lxd/migrate.go
index 070c0fd044..d2589f3a5d 100644
--- a/lxd/migrate.go
+++ b/lxd/migrate.go
@@ -276,6 +276,7 @@ type MigrationSinkArgs struct {
type MigrationSourceArgs struct {
// transport specific fields
RsyncArgs []string
+ ZfsArgs []string
}
func (c *migrationSink) connectWithSecret(secret string) (*websocket.Conn, error) {
diff --git a/lxd/migrate_container.go b/lxd/migrate_container.go
index ec4f279c3e..e911784d38 100644
--- a/lxd/migrate_container.go
+++ b/lxd/migrate_container.go
@@ -378,7 +378,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()
- rsyncHasFeature := true
+ hasFeature := true
header := migration.MigrationHeader{
Fs: &myType,
Criu: criuType,
@@ -387,13 +387,19 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
Snapshots: snapshots,
Predump: proto.Bool(use_pre_dumps),
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ header.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
err = s.send(&header)
if err != nil {
s.sendControl(err)
@@ -428,7 +434,17 @@ func (s *migrationSourceWs) Do(migrateOp *operation) error {
rsyncArgs = append(rsyncArgs, "--compress-level=2")
}
}
- sourceArgs := MigrationSourceArgs{rsyncArgs}
+
+ // Handle zfs options
+ zfsArgs := []string{}
+ zfsFeatures := header.GetZfsFeatures()
+ if zfsFeatures.GetCompress() && len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ zfsArgs = append(zfsArgs, "-c")
+ zfsArgs = append(zfsArgs, "-L")
+ }
+
+ // Set source args
+ sourceArgs := MigrationSourceArgs{rsyncArgs, zfsArgs}
// Initialize storage driver
driver, fsErr := s.container.Storage().MigrationSource(s.container, s.containerOnly, sourceArgs)
@@ -845,7 +861,7 @@ func (c *migrationSink) Do(migrateOp *operation) error {
}
myType := c.src.container.Storage().MigrationType()
- rsyncHasFeature := true
+ hasFeature := true
resp := migration.MigrationHeader{
Fs: &myType,
Criu: criuType,
@@ -853,13 +869,19 @@ func (c *migrationSink) Do(migrateOp *operation) error {
SnapshotNames: header.SnapshotNames,
Refresh: &c.refresh,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ resp.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
if c.refresh {
// Get our existing snapshots
targetSnapshots, err := c.src.container.Snapshots()
diff --git a/lxd/migrate_storage_volumes.go b/lxd/migrate_storage_volumes.go
index 9b30157aea..66c8978873 100644
--- a/lxd/migrate_storage_volumes.go
+++ b/lxd/migrate_storage_volumes.go
@@ -47,17 +47,23 @@ 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()
- rsyncHasFeature := true
+ hasFeature := true
header := migration.MigrationHeader{
Fs: &myType,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ header.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
err = s.send(&header)
if err != nil {
logger.Errorf("Failed to send storage volume migration header")
@@ -94,7 +100,17 @@ func (s *migrationSourceWs) DoStorage(migrateOp *operation) error {
rsyncArgs = append(rsyncArgs, "--compress-level=2")
}
}
- sourceArgs := MigrationSourceArgs{rsyncArgs}
+
+ // Handle zfs options
+ zfsArgs := []string{}
+ zfsFeatures := header.GetZfsFeatures()
+ if zfsFeatures.GetCompress() && len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ zfsArgs = append(zfsArgs, "-c")
+ zfsArgs = append(zfsArgs, "-L")
+ }
+
+ // Set source args
+ sourceArgs := MigrationSourceArgs{rsyncArgs, zfsArgs}
driver, fsErr := s.storage.StorageMigrationSource(sourceArgs)
if fsErr != nil {
@@ -244,17 +260,23 @@ func (c *migrationSink) DoStorage(migrateOp *operation) error {
mySink := c.src.storage.StorageMigrationSink
myType := c.src.storage.MigrationType()
- rsyncHasFeature := true
+ hasFeature := true
resp := migration.MigrationHeader{
Fs: &myType,
RsyncFeatures: &migration.RsyncFeatures{
- Xattrs: &rsyncHasFeature,
- Delete: &rsyncHasFeature,
- Compress: &rsyncHasFeature,
- Bidirectional: &rsyncHasFeature,
+ Xattrs: &hasFeature,
+ Delete: &hasFeature,
+ Compress: &hasFeature,
+ Bidirectional: &hasFeature,
},
}
+ if len(zfsVersion) >= 3 && zfsVersion[0:3] != "0.6" {
+ resp.ZfsFeatures = &migration.ZfsFeatures{
+ Compress: &hasFeature,
+ }
+ }
+
// If the storage type the source has doesn't match what we have, then
// we have to use rsync.
if *header.Fs != *resp.Fs {
diff --git a/lxd/migration/migrate.pb.go b/lxd/migration/migrate.pb.go
index 9ba7f19cfc..c7e83a97d6 100644
--- a/lxd/migration/migrate.pb.go
+++ b/lxd/migration/migrate.pb.go
@@ -13,6 +13,7 @@ It has these top-level messages:
Device
Snapshot
RsyncFeatures
+ ZfsFeatures
MigrationHeader
MigrationControl
MigrationSync
@@ -335,6 +336,23 @@ func (m *RsyncFeatures) GetBidirectional() bool {
return false
}
+type ZfsFeatures struct {
+ Compress *bool `protobuf:"varint,1,opt,name=compress" json:"compress,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
+}
+
+func (m *ZfsFeatures) Reset() { *m = ZfsFeatures{} }
+func (m *ZfsFeatures) String() string { return proto.CompactTextString(m) }
+func (*ZfsFeatures) ProtoMessage() {}
+func (*ZfsFeatures) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+
+func (m *ZfsFeatures) 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"`
@@ -344,13 +362,14 @@ type MigrationHeader struct {
Predump *bool `protobuf:"varint,7,opt,name=predump" json:"predump,omitempty"`
RsyncFeatures *RsyncFeatures `protobuf:"bytes,8,opt,name=rsyncFeatures" json:"rsyncFeatures,omitempty"`
Refresh *bool `protobuf:"varint,9,opt,name=refresh" json:"refresh,omitempty"`
+ ZfsFeatures *ZfsFeatures `protobuf:"bytes,10,opt,name=zfsFeatures" json:"zfsFeatures,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *MigrationHeader) Reset() { *m = MigrationHeader{} }
func (m *MigrationHeader) String() string { return proto.CompactTextString(m) }
func (*MigrationHeader) ProtoMessage() {}
-func (*MigrationHeader) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (*MigrationHeader) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *MigrationHeader) GetFs() MigrationFSType {
if m != nil && m.Fs != nil {
@@ -408,6 +427,13 @@ func (m *MigrationHeader) GetRefresh() bool {
return false
}
+func (m *MigrationHeader) GetZfsFeatures() *ZfsFeatures {
+ if m != nil {
+ return m.ZfsFeatures
+ }
+ return nil
+}
+
type MigrationControl struct {
Success *bool `protobuf:"varint,1,req,name=success" json:"success,omitempty"`
// optional failure message if sending a failure
@@ -418,7 +444,7 @@ type MigrationControl struct {
func (m *MigrationControl) Reset() { *m = MigrationControl{} }
func (m *MigrationControl) String() string { return proto.CompactTextString(m) }
func (*MigrationControl) ProtoMessage() {}
-func (*MigrationControl) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+func (*MigrationControl) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *MigrationControl) GetSuccess() bool {
if m != nil && m.Success != nil {
@@ -442,7 +468,7 @@ type MigrationSync struct {
func (m *MigrationSync) Reset() { *m = MigrationSync{} }
func (m *MigrationSync) String() string { return proto.CompactTextString(m) }
func (*MigrationSync) ProtoMessage() {}
-func (*MigrationSync) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
+func (*MigrationSync) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *MigrationSync) GetFinalPreDump() bool {
if m != nil && m.FinalPreDump != nil {
@@ -470,7 +496,7 @@ type DumpStatsEntry struct {
func (m *DumpStatsEntry) Reset() { *m = DumpStatsEntry{} }
func (m *DumpStatsEntry) String() string { return proto.CompactTextString(m) }
func (*DumpStatsEntry) ProtoMessage() {}
-func (*DumpStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
+func (*DumpStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *DumpStatsEntry) GetFreezingTime() uint32 {
if m != nil && m.FreezingTime != nil {
@@ -561,7 +587,7 @@ type RestoreStatsEntry struct {
func (m *RestoreStatsEntry) Reset() { *m = RestoreStatsEntry{} }
func (m *RestoreStatsEntry) String() string { return proto.CompactTextString(m) }
func (*RestoreStatsEntry) ProtoMessage() {}
-func (*RestoreStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
+func (*RestoreStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *RestoreStatsEntry) GetPagesCompared() uint64 {
if m != nil && m.PagesCompared != nil {
@@ -607,7 +633,7 @@ type StatsEntry struct {
func (m *StatsEntry) Reset() { *m = StatsEntry{} }
func (m *StatsEntry) String() string { return proto.CompactTextString(m) }
func (*StatsEntry) ProtoMessage() {}
-func (*StatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
+func (*StatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *StatsEntry) GetDump() *DumpStatsEntry {
if m != nil {
@@ -629,6 +655,7 @@ func init() {
proto.RegisterType((*Device)(nil), "migration.Device")
proto.RegisterType((*Snapshot)(nil), "migration.Snapshot")
proto.RegisterType((*RsyncFeatures)(nil), "migration.rsyncFeatures")
+ proto.RegisterType((*ZfsFeatures)(nil), "migration.zfsFeatures")
proto.RegisterType((*MigrationHeader)(nil), "migration.MigrationHeader")
proto.RegisterType((*MigrationControl)(nil), "migration.MigrationControl")
proto.RegisterType((*MigrationSync)(nil), "migration.MigrationSync")
@@ -642,69 +669,71 @@ func init() {
func init() { proto.RegisterFile("lxd/migration/migrate.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 1022 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x4d, 0x6f, 0xdb, 0x46,
- 0x13, 0x7e, 0x25, 0x51, 0xb6, 0x38, 0x92, 0x1c, 0x65, 0x13, 0xbc, 0x20, 0x92, 0x7e, 0xa8, 0x4c,
- 0x8a, 0xaa, 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0xe6, 0xe3, 0x4f, 0xcc, 0xf1, 0xf0, 0x8c, 0x1f, 0x2f, 0xc6, 0x2d, 0xb6, 0x0d,
+ 0x9d, 0xdf, 0x8e, 0x17, 0xe3, 0xb6, 0x39, 0xf0, 0xc3, 0xa3, 0x71, 0x67, 0xef, 0x00, 0xfa, 0xd5,
+ 0xda, 0x63, 0x3b, 0x00, 0xe6, 0xec, 0x37, 0x3e, 0x3c, 0x7d, 0xf3, 0xc3, 0xf9, 0xbb, 0x71, 0x8b,
+ 0xf5, 0xa1, 0x7b, 0xf2, 0xf3, 0xc9, 0x8f, 0xe3, 0xf6, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcf,
+ 0xd6, 0xdc, 0x0b, 0xa4, 0x08, 0x00, 0x00,
}
diff --git a/lxd/migration/migrate.proto b/lxd/migration/migrate.proto
index 938e73af0d..df01b51e5c 100644
--- a/lxd/migration/migrate.proto
+++ b/lxd/migration/migrate.proto
@@ -53,6 +53,10 @@ message rsyncFeatures {
optional bool bidirectional = 4;
}
+message zfsFeatures {
+ optional bool compress = 1;
+}
+
message MigrationHeader {
required MigrationFSType fs = 1;
optional CRIUType criu = 2;
@@ -62,6 +66,7 @@ message MigrationHeader {
optional bool predump = 7;
optional rsyncFeatures rsyncFeatures = 8;
optional bool refresh = 9;
+ optional zfsFeatures zfsFeatures = 10;
}
message MigrationControl {
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 9f89244317..a008909172 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -2541,6 +2541,7 @@ type zfsMigrationSourceDriver struct {
zfs *storageZfs
runningSnapName string
stoppedSnapName string
+ zfsArgs []string
}
func (s *zfsMigrationSourceDriver) Snapshots() []container {
@@ -2550,7 +2551,9 @@ func (s *zfsMigrationSourceDriver) Snapshots() []container {
func (s *zfsMigrationSourceDriver) send(conn *websocket.Conn, zfsName string, zfsParent string, readWrapper func(io.ReadCloser) io.ReadCloser) error {
sourceParentName, _, _ := containerGetParentAndSnapshotName(s.container.Name())
poolName := s.zfs.getOnDiskPoolName()
- args := []string{"send", fmt.Sprintf("%s/containers/%s@%s", poolName, projectPrefix(s.container.Project(), sourceParentName), zfsName)}
+ args := []string{"send"}
+ args = append(args, s.zfsArgs...)
+ args = append(args, []string{fmt.Sprintf("%s/containers/%s@%s", poolName, projectPrefix(s.container.Project(), sourceParentName), zfsName)}...)
if zfsParent != "" {
args = append(args, "-i", fmt.Sprintf("%s/containers/%s@%s", poolName, projectPrefix(s.container.Project(), s.container.Name()), zfsParent))
}
@@ -2665,7 +2668,7 @@ func (s *storageZfs) MigrationSource(ct container, containerOnly bool, args Migr
* to send anything else, because that's all the user asked for.
*/
if ct.IsSnapshot() {
- return &zfsMigrationSourceDriver{container: ct, zfs: s}, nil
+ return &zfsMigrationSourceDriver{container: ct, zfs: s, zfsArgs: args.ZfsArgs}, nil
}
driver := zfsMigrationSourceDriver{
@@ -2673,6 +2676,7 @@ func (s *storageZfs) MigrationSource(ct container, containerOnly bool, args Migr
snapshots: []container{},
zfsSnapshotNames: []string{},
zfs: s,
+ zfsArgs: args.ZfsArgs,
}
if containerOnly {