Skip to content

Commit

Permalink
lxd/storage/drivers/powerflex: Add volume migration support
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Pelizäus <[email protected]>
  • Loading branch information
roosterfish committed Oct 17, 2023
1 parent 4502a6b commit 1ed8558
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
43 changes: 42 additions & 1 deletion lxd/storage/drivers/driver_powerflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,46 @@ func (d *powerflex) GetResources() (*api.ResourcesStoragePool, error) {

// MigrationType returns the type of transfer methods to be used when doing migrations between pools in preference order.
func (d *powerflex) MigrationTypes(contentType ContentType, refresh bool, copySnapshots bool) []migration.Type {
return []migration.Type{}
var rsyncFeatures []string

// Do not pass compression argument to rsync if the associated
// config key, that is rsync.compression, is set to false.
if shared.IsFalse(d.Config()["rsync.compression"]) {
rsyncFeatures = []string{"xattrs", "delete", "bidirectional"}
} else {
rsyncFeatures = []string{"xattrs", "delete", "compress", "bidirectional"}
}

if refresh {
var transportType migration.MigrationFSType

if IsContentBlock(contentType) {
transportType = migration.MigrationFSType_BLOCK_AND_RSYNC
} else {
transportType = migration.MigrationFSType_RSYNC
}

return []migration.Type{
{
FSType: transportType,
Features: rsyncFeatures,
},
}
}

if contentType == ContentTypeBlock {
return []migration.Type{
{
FSType: migration.MigrationFSType_BLOCK_AND_RSYNC,
Features: rsyncFeatures,
},
}
}

return []migration.Type{
{
FSType: migration.MigrationFSType_RSYNC,
Features: rsyncFeatures,
},
}
}
4 changes: 2 additions & 2 deletions lxd/storage/drivers/driver_powerflex_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func (d *powerflex) CreateVolumeFromCopy(vol Volume, srcVol Volume, copySnapshot

// CreateVolumeFromMigration creates a volume being sent via a migration.
func (d *powerflex) CreateVolumeFromMigration(vol Volume, conn io.ReadWriteCloser, volTargetArgs migration.VolumeTargetArgs, preFiller *VolumeFiller, op *operations.Operation) error {
return ErrNotSupported
return genericVFSCreateVolumeFromMigration(d, nil, vol, conn, volTargetArgs, preFiller, op)
}

// RefreshVolume updates an existing volume to match the state of another.
Expand Down Expand Up @@ -719,7 +719,7 @@ func (d *powerflex) RenameVolume(vol Volume, newVolName string, op *operations.O

// MigrateVolume sends a volume for migration.
func (d *powerflex) MigrateVolume(vol Volume, conn io.ReadWriteCloser, volSrcArgs *migration.VolumeSourceArgs, op *operations.Operation) error {
return ErrNotSupported
return genericVFSMigrateVolume(d, d.state, vol, conn, volSrcArgs, op)
}

// BackupVolume creates an exported version of a volume.
Expand Down

0 comments on commit 1ed8558

Please sign in to comment.