cephfs: make getFscID() a method of volumeOptions

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-10-02 09:57:18 +02:00 committed by mergify[bot]
parent 6312dbd920
commit b28ff63a29
2 changed files with 4 additions and 4 deletions

View File

@ -34,17 +34,17 @@ type CephFilesystemDetails struct {
MDSMap MDSMap `json:"mdsmap"`
}
func getFscID(ctx context.Context, monitors string, cr *util.Credentials, fsName string) (int64, error) {
func (vo *volumeOptions) getFscID(ctx context.Context, cr *util.Credentials) (int64, error) {
// ceph fs get myfs --format=json
// {"mdsmap":{...},"id":2}
var fsDetails CephFilesystemDetails
err := execCommandJSON(ctx, &fsDetails,
"ceph",
"-m", monitors,
"-m", vo.Monitors,
"--id", cr.ID,
"--keyfile="+cr.KeyFile,
"-c", util.CephConfigPath,
"fs", "get", fsName, "--format=json",
"fs", "get", vo.FsName, "--format=json",
)
if err != nil {
return 0, err

View File

@ -215,7 +215,7 @@ func newVolumeOptions(ctx context.Context, requestName string, req *csi.CreateVo
return nil, err
}
opts.FscID, err = getFscID(ctx, opts.Monitors, cr, opts.FsName)
opts.FscID, err = opts.getFscID(ctx, cr)
if err != nil {
return nil, err
}