Make parameter pool optional in CephFS storageclass

Signed-off-by: Daniel-Pivonka <dpivonka@redhat.com>
This commit is contained in:
Daniel-Pivonka
2019-08-05 11:40:48 -04:00
committed by mergify[bot]
parent 5b461a0787
commit 0063727199
6 changed files with 30 additions and 13 deletions

View File

@ -94,8 +94,8 @@ func createVolume(volOptions *volumeOptions, cr *util.Credentials, volID volumeI
klog.V(4).Infof("cephfs: created subvolume group csi")
cephfsInit = true
}
err := execCommandErr(
"ceph",
args := []string{
"fs",
"subvolume",
"create",
@ -104,12 +104,20 @@ func createVolume(volOptions *volumeOptions, cr *util.Credentials, volID volumeI
strconv.FormatInt(bytesQuota, 10),
"--group_name",
csiSubvolumeGroup,
"--pool_layout", volOptions.Pool,
"--mode", "777",
"-m", volOptions.Monitors,
"-c", util.CephConfigPath,
"-n", cephEntityClientPrefix+cr.ID,
"--keyfile="+cr.KeyFile)
"-n", cephEntityClientPrefix + cr.ID,
"--keyfile=" + cr.KeyFile,
}
if volOptions.Pool != "" {
args = append(args, "--pool_layout", volOptions.Pool)
}
err := execCommandErr(
"ceph",
args[:]...)
if err != nil {
klog.Errorf("failed to create subvolume %s(%s) in fs %s", string(volID), err, volOptions.FsName)
return err

View File

@ -134,7 +134,7 @@ func newVolumeOptions(requestName string, size int64, volOptions, secret map[str
return nil, err
}
if err = extractOption(&opts.Pool, "pool", volOptions); err != nil {
if err = extractOptionalOption(&opts.Pool, "pool", volOptions); err != nil {
return nil, err
}
@ -218,7 +218,7 @@ func newVolumeOptionsFromVolID(volID string, volOpt, secrets map[string]string)
}
if volOpt != nil {
if err = extractOption(&volOptions.Pool, "pool", volOpt); err != nil {
if err = extractOptionalOption(&volOptions.Pool, "pool", volOpt); err != nil {
return nil, nil, err
}