mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
cephfs: make getFscID() a method of volumeOptions
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
6312dbd920
commit
b28ff63a29
@ -34,17 +34,17 @@ type CephFilesystemDetails struct {
|
|||||||
MDSMap MDSMap `json:"mdsmap"`
|
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
|
// ceph fs get myfs --format=json
|
||||||
// {"mdsmap":{...},"id":2}
|
// {"mdsmap":{...},"id":2}
|
||||||
var fsDetails CephFilesystemDetails
|
var fsDetails CephFilesystemDetails
|
||||||
err := execCommandJSON(ctx, &fsDetails,
|
err := execCommandJSON(ctx, &fsDetails,
|
||||||
"ceph",
|
"ceph",
|
||||||
"-m", monitors,
|
"-m", vo.Monitors,
|
||||||
"--id", cr.ID,
|
"--id", cr.ID,
|
||||||
"--keyfile="+cr.KeyFile,
|
"--keyfile="+cr.KeyFile,
|
||||||
"-c", util.CephConfigPath,
|
"-c", util.CephConfigPath,
|
||||||
"fs", "get", fsName, "--format=json",
|
"fs", "get", vo.FsName, "--format=json",
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
@ -215,7 +215,7 @@ func newVolumeOptions(ctx context.Context, requestName string, req *csi.CreateVo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.FscID, err = getFscID(ctx, opts.Monitors, cr, opts.FsName)
|
opts.FscID, err = opts.getFscID(ctx, cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user