Merge pull request #8130 from subhamkrai/remove-force

ceph: remove --force when creating filesystem
This commit is contained in:
Travis Nielsen
2021-06-16 09:06:45 -06:00
committed by GitHub
2 changed files with 3 additions and 10 deletions
+2 -6
View File
@@ -132,7 +132,7 @@ func AllowStandbyReplay(context *clusterd.Context, clusterInfo *ClusterInfo, fsN
}
// CreateFilesystem performs software configuration steps for Ceph to provide a new filesystem.
func CreateFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, name, metadataPool string, dataPools []string, force bool) error {
func CreateFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, name, metadataPool string, dataPools []string) error {
if len(dataPools) == 0 {
return errors.New("at least one data pool is required")
}
@@ -152,11 +152,7 @@ func CreateFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, name,
// create the filesystem
args := []string{"fs", "new", name, metadataPool, dataPools[0]}
// Force to use pre-existing pools
if force {
args = append(args, "--force")
logger.Infof("Filesystem %q will reuse pre-existing pools", name)
}
_, err = NewCephCommand(context, clusterInfo, args).Run()
if err != nil {
return errors.Wrapf(err, "failed enabling ceph fs %q", name)
+1 -4
View File
@@ -247,10 +247,8 @@ func (f *Filesystem) doFilesystemCreate(context *clusterd.Context, clusterInfo *
reversedPoolMap[value] = key
}
poolsCreated := false
metadataPoolName := generateMetaDataPoolName(f)
if _, poolFound := reversedPoolMap[metadataPoolName]; !poolFound {
poolsCreated = true
err = cephclient.CreatePoolWithProfile(context, clusterInfo, clusterSpec, metadataPoolName, spec.MetadataPool, "")
if err != nil {
return errors.Wrapf(err, "failed to create metadata pool %q", metadataPoolName)
@@ -261,7 +259,6 @@ func (f *Filesystem) doFilesystemCreate(context *clusterd.Context, clusterInfo *
for i, pool := range spec.DataPools {
poolName := dataPoolNames[i]
if _, poolFound := reversedPoolMap[poolName]; !poolFound {
poolsCreated = true
err = cephclient.CreatePoolWithProfile(context, clusterInfo, clusterSpec, poolName, pool, "")
if err != nil {
return errors.Wrapf(err, "failed to create data pool %q", poolName)
@@ -277,7 +274,7 @@ func (f *Filesystem) doFilesystemCreate(context *clusterd.Context, clusterInfo *
// create the filesystem ('fs new' needs to be forced in order to reuse pre-existing pools)
// if only one pool is created new it won't work (to avoid inconsistencies).
if err := cephclient.CreateFilesystem(context, clusterInfo, f.Name, metadataPoolName, dataPoolNames, !poolsCreated); err != nil {
if err := cephclient.CreateFilesystem(context, clusterInfo, f.Name, metadataPoolName, dataPoolNames); err != nil {
return err
}