Skip to content

Commit

Permalink
fix(backend): add ability to set non-default tweak mode
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun authored and sandersms committed Jan 4, 2024
1 parent eef1a25 commit 1a70a6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/middleend/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func (s *Server) getAccelCryptoKeyCreateParams(volume *pb.EncryptedVolume) spdk.
params.Key = hex.EncodeToString(volume.Key[:keyHalf])
params.Key2 = hex.EncodeToString(volume.Key[keyHalf:])
params.Name = path.Base(volume.Name)
params.TweakMode = s.tweakMode

return params
}
8 changes: 8 additions & 0 deletions pkg/middleend/middleend.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ type Server struct {
rpc spdk.JSONRPC
store gokv.Store
volumes VolumeParameters
tweakMode string
Pagination map[string]int
}

// NewServer creates initialized instance of MiddleEnd server communicating
// with provided jsonRPC
func NewServer(jsonRPC spdk.JSONRPC, store gokv.Store) *Server {
return NewCustomizedServer(jsonRPC, store, spdk.TweakModeSimpleLba)
}

// NewCustomizedServer creates initialized instance of MiddleEnd server communicating
// with provided jsonRPC, store and non standard tweak mode
func NewCustomizedServer(jsonRPC spdk.JSONRPC, store gokv.Store, tweakMode string) *Server {
if jsonRPC == nil {
log.Panic("nil for JSONRPC is not allowed")
}
Expand All @@ -47,6 +54,7 @@ func NewServer(jsonRPC spdk.JSONRPC, store gokv.Store) *Server {
qosVolumes: make(map[string]*pb.QosVolume),
encVolumes: make(map[string]*pb.EncryptedVolume),
},
tweakMode: tweakMode,
Pagination: make(map[string]int),
}
}

0 comments on commit 1a70a6a

Please sign in to comment.