mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
tier: Add force param to force tiering removal (#20355)
Currently, it is not possible to remove a tier if it is not accessible or contains some data, add a force flag to make the removal successful in that case.
This commit is contained in:
12
cmd/tier.go
12
cmd/tier.go
@@ -248,7 +248,7 @@ func (config *TierConfigMgr) Add(ctx context.Context, tier madmin.TierConfig, ig
|
||||
}
|
||||
|
||||
// Remove removes tier if it is empty.
|
||||
func (config *TierConfigMgr) Remove(ctx context.Context, tier string) error {
|
||||
func (config *TierConfigMgr) Remove(ctx context.Context, tier string, force bool) error {
|
||||
d, err := config.getDriver(ctx, tier)
|
||||
if err != nil {
|
||||
if errors.Is(err, errTierNotFound) {
|
||||
@@ -256,10 +256,12 @@ func (config *TierConfigMgr) Remove(ctx context.Context, tier string) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
if inuse, err := d.InUse(ctx); err != nil {
|
||||
return err
|
||||
} else if inuse {
|
||||
return errTierBackendNotEmpty
|
||||
if !force {
|
||||
if inuse, err := d.InUse(ctx); err != nil {
|
||||
return err
|
||||
} else if inuse {
|
||||
return errTierBackendNotEmpty
|
||||
}
|
||||
}
|
||||
config.Lock()
|
||||
delete(config.Tiers, tier)
|
||||
|
||||
Reference in New Issue
Block a user