cephfs: make getSubVolumeInfo() a method of volumeOptions

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-10-09 17:20:16 +02:00 committed by mergify[bot]
parent 79e7c6a3e2
commit 429f7acd8f
3 changed files with 7 additions and 7 deletions

View File

@ -513,7 +513,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
// request to create snapshot.
// TODO: For this purpose we could make use of cached clusterAdditionalInfo too.
var info Subvolume
info, err = getSubVolumeInfo(ctx, parentVolOptions, cr, volumeID(vid.FsSubvolName))
info, err = parentVolOptions.getSubVolumeInfo(ctx, cr, volumeID(vid.FsSubvolName))
if err != nil {
// Check error code value against ErrInvalidCommand to understand the cluster
// support it or not, its safe to evaluat as the filtering

View File

@ -94,7 +94,7 @@ func getVolumeRootPathCeph(ctx context.Context, volOptions *volumeOptions, cr *u
return strings.TrimSuffix(stdout, "\n"), nil
}
func getSubVolumeInfo(ctx context.Context, volOptions *volumeOptions, cr *util.Credentials, volID volumeID) (Subvolume, error) {
func (vo *volumeOptions) getSubVolumeInfo(ctx context.Context, cr *util.Credentials, volID volumeID) (Subvolume, error) {
info := Subvolume{}
err := execCommandJSON(
ctx,
@ -103,11 +103,11 @@ func getSubVolumeInfo(ctx context.Context, volOptions *volumeOptions, cr *util.C
"fs",
"subvolume",
"info",
volOptions.FsName,
vo.FsName,
string(volID),
"--group_name",
volOptions.SubvolumeGroup,
"-m", volOptions.Monitors,
vo.SubvolumeGroup,
"-m", vo.Monitors,
"-c", util.CephConfigPath,
"-n", cephEntityClientPrefix+cr.ID,
"--keyfile="+cr.KeyFile)

View File

@ -339,7 +339,7 @@ func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secret
volOptions.ProvisionVolume = true
info, err = getSubVolumeInfo(ctx, &volOptions, cr, volumeID(vid.FsSubvolName))
info, err = volOptions.getSubVolumeInfo(ctx, cr, volumeID(vid.FsSubvolName))
if err == nil {
volOptions.RootPath = info.Path
volOptions.Features = info.Features
@ -525,7 +525,7 @@ func newSnapshotOptionsFromID(ctx context.Context, snapID string, cr *util.Crede
sid.FsSnapshotName = imageAttributes.ImageName
sid.FsSubvolName = imageAttributes.SourceName
subvolInfo, err := getSubVolumeInfo(ctx, &volOptions, cr, volumeID(sid.FsSubvolName))
subvolInfo, err := volOptions.getSubVolumeInfo(ctx, cr, volumeID(sid.FsSubvolName))
if err != nil {
return &volOptions, nil, &sid, err
}