-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for syncing block volumes
Right now we only support syncing file volumes. This adds support for block volumes using the blockrsync utility code here: https://github.com/awels/blockrsync This also modifies the transport code to allow a second transport to be used. This is needed because we start a second blockrsync server that needs a different transport to get the routing of data correct. Added unit tests for the transport and rsync code Signed-off-by: Alexander Wels <[email protected]>
- Loading branch information
Showing
27 changed files
with
1,735 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package blockrsync | ||
|
||
import ( | ||
"github.com/go-logr/logr" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"github.com/konveyor/crane-lib/state_transfer/endpoint" | ||
"github.com/konveyor/crane-lib/state_transfer/transfer" | ||
"github.com/konveyor/crane-lib/state_transfer/transport" | ||
) | ||
|
||
const ( | ||
blockrsyncImage = "quay.io/awels/blockrsync:latest" | ||
volumeName = "volume" | ||
BlockRsyncContainer = "blockrsync" | ||
Proxy = "proxy" | ||
) | ||
|
||
type BlockrsyncTransfer struct { | ||
log logr.Logger | ||
username string | ||
password string | ||
source client.Client | ||
destination client.Client | ||
pvcList transfer.PVCPairList | ||
transport transport.Transport | ||
endpoint endpoint.Endpoint | ||
transferOptions *TransferOptions | ||
} | ||
|
||
func NewTransfer(t transport.Transport, e endpoint.Endpoint, src client.Client, | ||
dest client.Client, pvcList transfer.PVCPairList, log logr.Logger, options *TransferOptions) (transfer.Transfer, error) { | ||
err := validatePVCList(pvcList) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &BlockrsyncTransfer{ | ||
log: log, | ||
transport: t, | ||
endpoint: e, | ||
source: src, | ||
destination: dest, | ||
pvcList: pvcList, | ||
transferOptions: options, | ||
}, nil | ||
} | ||
|
||
func (r *BlockrsyncTransfer) PVCs() transfer.PVCPairList { | ||
return r.pvcList | ||
} | ||
|
||
func (r *BlockrsyncTransfer) Endpoint() endpoint.Endpoint { | ||
return r.endpoint | ||
} | ||
|
||
func (r *BlockrsyncTransfer) Transport() transport.Transport { | ||
return r.transport | ||
} | ||
|
||
func (r *BlockrsyncTransfer) Source() client.Client { | ||
return r.source | ||
} | ||
|
||
func (r *BlockrsyncTransfer) Destination() client.Client { | ||
return r.destination | ||
} | ||
|
||
func (r *BlockrsyncTransfer) Username() string { | ||
return r.username | ||
} | ||
|
||
func (r *BlockrsyncTransfer) Password() string { | ||
return r.password | ||
} |
Oops, something went wrong.