mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Add support for minio tier type (#14468)
This commit is contained in:
committed by
GitHub
parent
879de20edf
commit
1a1b55e133
29
cmd/tier.go
29
cmd/tier.go
@@ -46,7 +46,8 @@ var (
|
||||
const (
|
||||
tierConfigFile = "tier-config.bin"
|
||||
tierConfigFormat = 1
|
||||
tierConfigVersion = 1
|
||||
tierConfigV1 = 1
|
||||
tierConfigVersion = 2
|
||||
|
||||
minioHotTier = "STANDARD"
|
||||
)
|
||||
@@ -204,6 +205,12 @@ func (config *TierConfigMgr) Edit(ctx context.Context, tierName string, creds ma
|
||||
return errTierInsufficientCreds
|
||||
}
|
||||
cfg.GCS.Creds = base64.URLEncoding.EncodeToString(creds.CredsJSON)
|
||||
case madmin.MinIO:
|
||||
if creds.AccessKey == "" || creds.SecretKey == "" {
|
||||
return errTierInsufficientCreds
|
||||
}
|
||||
cfg.MinIO.AccessKey = creds.AccessKey
|
||||
cfg.MinIO.SecretKey = creds.SecretKey
|
||||
}
|
||||
|
||||
d, err := newWarmBackend(ctx, cfg)
|
||||
@@ -375,22 +382,22 @@ func loadTierConfig(ctx context.Context, objAPI ObjectLayer) (*TierConfigMgr, er
|
||||
}
|
||||
|
||||
// Read header
|
||||
switch binary.LittleEndian.Uint16(data[0:2]) {
|
||||
switch format := binary.LittleEndian.Uint16(data[0:2]); format {
|
||||
case tierConfigFormat:
|
||||
default:
|
||||
return nil, fmt.Errorf("tierConfigInit: unknown format: %d", binary.LittleEndian.Uint16(data[0:2]))
|
||||
}
|
||||
switch binary.LittleEndian.Uint16(data[2:4]) {
|
||||
case tierConfigVersion:
|
||||
default:
|
||||
return nil, fmt.Errorf("tierConfigInit: unknown version: %d", binary.LittleEndian.Uint16(data[2:4]))
|
||||
return nil, fmt.Errorf("tierConfigInit: unknown format: %d", format)
|
||||
}
|
||||
|
||||
cfg := NewTierConfigMgr()
|
||||
_, decErr := cfg.UnmarshalMsg(data[4:])
|
||||
if decErr != nil {
|
||||
return nil, decErr
|
||||
switch version := binary.LittleEndian.Uint16(data[2:4]); version {
|
||||
case tierConfigV1, tierConfigVersion:
|
||||
if _, decErr := cfg.UnmarshalMsg(data[4:]); decErr != nil {
|
||||
return nil, decErr
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("tierConfigInit: unknown version: %d", version)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user