Deprecate root disk for disk caching (#14527)

This PR modifies #14513 to issue a deprecation
warning rather than reject settings on startup.
This commit is contained in:
Poorna
2022-03-10 18:42:44 -08:00
committed by GitHub
parent 91d419ee6c
commit 75b925c326
2 changed files with 15 additions and 12 deletions

View File

@@ -20,12 +20,10 @@ package cache
import (
"encoding/json"
"errors"
"os"
"path/filepath"
"strings"
"github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/disk"
"github.com/minio/pkg/ellipses"
)
@@ -117,20 +115,10 @@ func parseCacheDrives(drives string) ([]string, error) {
endpoints = append(endpoints, d)
}
}
isCICD := os.Getenv("MINIO_CI_CD") != "" || os.Getenv("CI") != ""
for _, d := range endpoints {
if !filepath.IsAbs(d) {
return nil, config.ErrInvalidCacheDrivesValue(nil).Msg("cache dir should be absolute path: %s", d)
}
if !isCICD {
rootDsk, err := disk.IsRootDisk(d, "/")
if err != nil {
return nil, config.ErrInvalidCacheDrivesValue(nil).Msg("Invalid cache dir %s err : %s", d, err.Error())
}
if rootDsk {
return nil, config.ErrInvalidCacheDrivesValue(nil).Msg("cache dir cannot be part of root disk: %s", d)
}
}
}
return endpoints, nil
}