mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Make storage class config dynamic (#14791)
Updating the storage class is already thread safe, so we can do this safely.
This commit is contained in:
parent
ddf84f8257
commit
96adfaebe1
@ -484,22 +484,6 @@ func lookupConfigs(s config.Config, objAPI ObjectLayer) {
|
|||||||
getRemoteInstanceTransport = newGatewayHTTPTransport(apiConfig.RemoteTransportDeadline)
|
getRemoteInstanceTransport = newGatewayHTTPTransport(apiConfig.RemoteTransportDeadline)
|
||||||
})
|
})
|
||||||
|
|
||||||
if globalIsErasure && objAPI != nil {
|
|
||||||
setDriveCounts := objAPI.SetDriveCounts()
|
|
||||||
for i, setDriveCount := range setDriveCounts {
|
|
||||||
sc, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount)
|
|
||||||
if err != nil {
|
|
||||||
logger.LogIf(ctx, fmt.Errorf("Unable to initialize storage class config: %w", err))
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// if we validated all setDriveCounts and it was successful
|
|
||||||
// proceed to store the correct storage class globally.
|
|
||||||
if i == len(setDriveCounts)-1 {
|
|
||||||
globalStorageClass.Update(sc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
globalCacheConfig, err = cache.LookupConfig(s[config.CacheSubSys][config.Default])
|
globalCacheConfig, err = cache.LookupConfig(s[config.CacheSubSys][config.Default])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if globalIsGateway {
|
if globalIsGateway {
|
||||||
@ -670,6 +654,22 @@ func applyDynamicConfigForSubSys(ctx context.Context, objAPI ObjectLayer, s conf
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogIf(ctx, fmt.Errorf("Unable to update audit kafka targets: %w", err))
|
logger.LogIf(ctx, fmt.Errorf("Unable to update audit kafka targets: %w", err))
|
||||||
}
|
}
|
||||||
|
case config.StorageClassSubSys:
|
||||||
|
if globalIsErasure && objAPI != nil {
|
||||||
|
setDriveCounts := objAPI.SetDriveCounts()
|
||||||
|
for i, setDriveCount := range setDriveCounts {
|
||||||
|
sc, err := storageclass.LookupConfig(s[config.StorageClassSubSys][config.Default], setDriveCount)
|
||||||
|
if err != nil {
|
||||||
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize storage class config: %w", err))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// if we validated all setDriveCounts and it was successful
|
||||||
|
// proceed to store the correct storage class globally.
|
||||||
|
if i == len(setDriveCounts)-1 {
|
||||||
|
globalStorageClass.Update(sc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
globalServerConfigMu.Lock()
|
globalServerConfigMu.Lock()
|
||||||
defer globalServerConfigMu.Unlock()
|
defer globalServerConfigMu.Unlock()
|
||||||
|
@ -169,6 +169,7 @@ var SubSystemsDynamic = set.CreateStringSet(
|
|||||||
LoggerWebhookSubSys,
|
LoggerWebhookSubSys,
|
||||||
AuditWebhookSubSys,
|
AuditWebhookSubSys,
|
||||||
AuditKafkaSubSys,
|
AuditKafkaSubSys,
|
||||||
|
StorageClassSubSys,
|
||||||
)
|
)
|
||||||
|
|
||||||
// SubSystemsSingleTargets - subsystems which only support single target.
|
// SubSystemsSingleTargets - subsystems which only support single target.
|
||||||
|
Loading…
Reference in New Issue
Block a user