mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
cephfs: make getSubVolumeInfo() a method of volumeOptions
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
79e7c6a3e2
commit
429f7acd8f
@ -513,7 +513,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
|||||||
// request to create snapshot.
|
// request to create snapshot.
|
||||||
// TODO: For this purpose we could make use of cached clusterAdditionalInfo too.
|
// TODO: For this purpose we could make use of cached clusterAdditionalInfo too.
|
||||||
var info Subvolume
|
var info Subvolume
|
||||||
info, err = getSubVolumeInfo(ctx, parentVolOptions, cr, volumeID(vid.FsSubvolName))
|
info, err = parentVolOptions.getSubVolumeInfo(ctx, cr, volumeID(vid.FsSubvolName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Check error code value against ErrInvalidCommand to understand the cluster
|
// Check error code value against ErrInvalidCommand to understand the cluster
|
||||||
// support it or not, its safe to evaluat as the filtering
|
// support it or not, its safe to evaluat as the filtering
|
||||||
|
@ -94,7 +94,7 @@ func getVolumeRootPathCeph(ctx context.Context, volOptions *volumeOptions, cr *u
|
|||||||
return strings.TrimSuffix(stdout, "\n"), nil
|
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{}
|
info := Subvolume{}
|
||||||
err := execCommandJSON(
|
err := execCommandJSON(
|
||||||
ctx,
|
ctx,
|
||||||
@ -103,11 +103,11 @@ func getSubVolumeInfo(ctx context.Context, volOptions *volumeOptions, cr *util.C
|
|||||||
"fs",
|
"fs",
|
||||||
"subvolume",
|
"subvolume",
|
||||||
"info",
|
"info",
|
||||||
volOptions.FsName,
|
vo.FsName,
|
||||||
string(volID),
|
string(volID),
|
||||||
"--group_name",
|
"--group_name",
|
||||||
volOptions.SubvolumeGroup,
|
vo.SubvolumeGroup,
|
||||||
"-m", volOptions.Monitors,
|
"-m", vo.Monitors,
|
||||||
"-c", util.CephConfigPath,
|
"-c", util.CephConfigPath,
|
||||||
"-n", cephEntityClientPrefix+cr.ID,
|
"-n", cephEntityClientPrefix+cr.ID,
|
||||||
"--keyfile="+cr.KeyFile)
|
"--keyfile="+cr.KeyFile)
|
||||||
|
@ -339,7 +339,7 @@ func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secret
|
|||||||
|
|
||||||
volOptions.ProvisionVolume = true
|
volOptions.ProvisionVolume = true
|
||||||
|
|
||||||
info, err = getSubVolumeInfo(ctx, &volOptions, cr, volumeID(vid.FsSubvolName))
|
info, err = volOptions.getSubVolumeInfo(ctx, cr, volumeID(vid.FsSubvolName))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
volOptions.RootPath = info.Path
|
volOptions.RootPath = info.Path
|
||||||
volOptions.Features = info.Features
|
volOptions.Features = info.Features
|
||||||
@ -525,7 +525,7 @@ func newSnapshotOptionsFromID(ctx context.Context, snapID string, cr *util.Crede
|
|||||||
sid.FsSnapshotName = imageAttributes.ImageName
|
sid.FsSnapshotName = imageAttributes.ImageName
|
||||||
sid.FsSubvolName = imageAttributes.SourceName
|
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 {
|
if err != nil {
|
||||||
return &volOptions, nil, &sid, err
|
return &volOptions, nil, &sid, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user