diff --git a/cmd/admin-bucket-handlers.go b/cmd/admin-bucket-handlers.go index bc87d6131..fcf3c6cc6 100644 --- a/cmd/admin-bucket-handlers.go +++ b/cmd/admin-bucket-handlers.go @@ -71,7 +71,7 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r * return } - if err = globalBucketMetadataSys.Update(bucket, bucketQuotaConfigFile, data); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, data); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -115,7 +115,7 @@ func (a adminAPIHandlers) GetBucketQuotaConfigHandler(w http.ResponseWriter, r * return } - config, err := globalBucketMetadataSys.GetQuotaConfig(bucket) + config, err := globalBucketMetadataSys.GetQuotaConfig(ctx, bucket) if err != nil { writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL) return @@ -246,7 +246,7 @@ func (a adminAPIHandlers) SetRemoteTargetHandler(w http.ResponseWriter, r *http. writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErrWithErr(ErrAdminConfigBadJSON, err), r.URL) return } - if err = globalBucketMetadataSys.Update(bucket, bucketTargetsFile, tgtBytes); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketTargetsFile, tgtBytes); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -340,7 +340,7 @@ func (a adminAPIHandlers) RemoveRemoteTargetHandler(w http.ResponseWriter, r *ht writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErrWithErr(ErrAdminConfigBadJSON, err), r.URL) return } - if err = globalBucketMetadataSys.Update(bucket, bucketTargetsFile, tgtBytes); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketTargetsFile, tgtBytes); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/admin-handlers-users.go b/cmd/admin-handlers-users.go index 52855fbe9..43e8ef543 100644 --- a/cmd/admin-handlers-users.go +++ b/cmd/admin-handlers-users.go @@ -1170,7 +1170,7 @@ func (a adminAPIHandlers) AccountInfoHandler(w http.ResponseWriter, r *http.Requ } lcfg, _ := globalBucketObjectLockSys.Get(bucket.Name) - quota, _ := globalBucketQuotaSys.Get(bucket.Name) + quota, _ := globalBucketQuotaSys.Get(ctx, bucket.Name) rcfg, _ := globalBucketMetadataSys.GetReplicationConfig(ctx, bucket.Name) tcfg, _ := globalBucketMetadataSys.GetTaggingConfig(bucket.Name) diff --git a/cmd/bucket-encryption-handlers.go b/cmd/bucket-encryption-handlers.go index 74e5f5a7f..e26957303 100644 --- a/cmd/bucket-encryption-handlers.go +++ b/cmd/bucket-encryption-handlers.go @@ -92,7 +92,7 @@ func (api objectAPIHandlers) PutBucketEncryptionHandler(w http.ResponseWriter, r } // Store the bucket encryption configuration in the object layer - if err = globalBucketMetadataSys.Update(bucket, bucketSSEConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -186,7 +186,7 @@ func (api objectAPIHandlers) DeleteBucketEncryptionHandler(w http.ResponseWriter } // Delete bucket encryption config from object layer - if err = globalBucketMetadataSys.Update(bucket, bucketSSEConfig, nil); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, nil); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/bucket-handlers.go b/cmd/bucket-handlers.go index 7754741cb..fa92f50c0 100644 --- a/cmd/bucket-handlers.go +++ b/cmd/bucket-handlers.go @@ -1368,7 +1368,7 @@ func (api objectAPIHandlers) PutBucketObjectLockConfigHandler(w http.ResponseWri return } - if err = globalBucketMetadataSys.Update(bucket, objectLockConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, objectLockConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -1473,7 +1473,7 @@ func (api objectAPIHandlers) PutBucketTaggingHandler(w http.ResponseWriter, r *h return } - if err = globalBucketMetadataSys.Update(bucket, bucketTaggingConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -1555,7 +1555,7 @@ func (api objectAPIHandlers) DeleteBucketTaggingHandler(w http.ResponseWriter, r return } - if err := globalBucketMetadataSys.Update(bucket, bucketTaggingConfig, nil); err != nil { + if err := globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, nil); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -1629,7 +1629,7 @@ func (api objectAPIHandlers) PutBucketReplicationConfigHandler(w http.ResponseWr writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } - if err = globalBucketMetadataSys.Update(bucket, bucketReplicationConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketReplicationConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -1708,7 +1708,7 @@ func (api objectAPIHandlers) DeleteBucketReplicationConfigHandler(w http.Respons writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrReplicationDenyEditError), r.URL) return } - if err := globalBucketMetadataSys.Update(bucket, bucketReplicationConfig, nil); err != nil { + if err := globalBucketMetadataSys.Update(ctx, bucket, bucketReplicationConfig, nil); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -1861,7 +1861,7 @@ func (api objectAPIHandlers) ResetBucketReplicationStateHandler(w http.ResponseW writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErrWithErr(ErrAdminConfigBadJSON, err), r.URL) return } - if err = globalBucketMetadataSys.Update(bucket, bucketTargetsFile, tgtBytes); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketTargetsFile, tgtBytes); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/bucket-lifecycle-handlers.go b/cmd/bucket-lifecycle-handlers.go index a1673324b..5b6317ce1 100644 --- a/cmd/bucket-lifecycle-handlers.go +++ b/cmd/bucket-lifecycle-handlers.go @@ -91,7 +91,7 @@ func (api objectAPIHandlers) PutBucketLifecycleHandler(w http.ResponseWriter, r return } - if err = globalBucketMetadataSys.Update(bucket, bucketLifecycleConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketLifecycleConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -168,7 +168,7 @@ func (api objectAPIHandlers) DeleteBucketLifecycleHandler(w http.ResponseWriter, return } - if err := globalBucketMetadataSys.Update(bucket, bucketLifecycleConfig, nil); err != nil { + if err := globalBucketMetadataSys.Update(ctx, bucket, bucketLifecycleConfig, nil); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/bucket-metadata-sys.go b/cmd/bucket-metadata-sys.go index 76f6279a9..79bcc3bfa 100644 --- a/cmd/bucket-metadata-sys.go +++ b/cmd/bucket-metadata-sys.go @@ -74,7 +74,7 @@ func (sys *BucketMetadataSys) Set(bucket string, meta BucketMetadata) { // Update update bucket metadata for the specified config file. // The configData data should not be modified after being sent here. -func (sys *BucketMetadataSys) Update(bucket string, configFile string, configData []byte) error { +func (sys *BucketMetadataSys) Update(ctx context.Context, bucket string, configFile string, configData []byte) error { objAPI := newObjectLayerFn() if objAPI == nil { return errServerNotInitialized @@ -83,13 +83,13 @@ func (sys *BucketMetadataSys) Update(bucket string, configFile string, configDat if globalIsGateway && globalGatewayName != NASBackendGateway { if configFile == bucketPolicyConfig { if configData == nil { - return objAPI.DeleteBucketPolicy(GlobalContext, bucket) + return objAPI.DeleteBucketPolicy(ctx, bucket) } config, err := policy.ParseConfig(bytes.NewReader(configData), bucket) if err != nil { return err } - return objAPI.SetBucketPolicy(GlobalContext, bucket, config) + return objAPI.SetBucketPolicy(ctx, bucket, config) } return NotImplemented{} } @@ -98,7 +98,7 @@ func (sys *BucketMetadataSys) Update(bucket string, configFile string, configDat return errInvalidArgument } - meta, err := loadBucketMetadata(GlobalContext, objAPI, bucket) + meta, err := loadBucketMetadata(ctx, objAPI, bucket) if err != nil { if !globalIsErasure && !globalIsDistErasure && errors.Is(err, errVolumeNotFound) { // Only single drive mode needs this fallback. @@ -148,12 +148,12 @@ func (sys *BucketMetadataSys) Update(bucket string, configFile string, configDat return fmt.Errorf("Unknown bucket %s metadata update requested %s", bucket, configFile) } - if err := meta.Save(GlobalContext, objAPI); err != nil { + if err := meta.Save(ctx, objAPI); err != nil { return err } sys.Set(bucket, meta) - globalNotificationSys.LoadBucketMetadata(GlobalContext, bucket) + globalNotificationSys.LoadBucketMetadata(bgContext(ctx), bucket) // Do not use caller context here return nil } @@ -187,7 +187,7 @@ func (sys *BucketMetadataSys) Get(bucket string) (BucketMetadata, error) { // GetVersioningConfig returns configured versioning config // The returned object may not be modified. func (sys *BucketMetadataSys) GetVersioningConfig(bucket string) (*versioning.Versioning, error) { - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { return nil, err } @@ -197,7 +197,7 @@ func (sys *BucketMetadataSys) GetVersioningConfig(bucket string) (*versioning.Ve // GetTaggingConfig returns configured tagging config // The returned object may not be modified. func (sys *BucketMetadataSys) GetTaggingConfig(bucket string) (*tags.Tags, error) { - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { if errors.Is(err, errConfigNotFound) { return nil, BucketTaggingNotFound{Bucket: bucket} @@ -213,7 +213,7 @@ func (sys *BucketMetadataSys) GetTaggingConfig(bucket string) (*tags.Tags, error // GetObjectLockConfig returns configured object lock config // The returned object may not be modified. func (sys *BucketMetadataSys) GetObjectLockConfig(bucket string) (*objectlock.Config, error) { - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { if errors.Is(err, errConfigNotFound) { return nil, BucketObjectLockConfigNotFound{Bucket: bucket} @@ -245,7 +245,7 @@ func (sys *BucketMetadataSys) GetLifecycleConfig(bucket string) (*lifecycle.Life return meta.lifecycleConfig, nil } - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { if errors.Is(err, errConfigNotFound) { return nil, BucketLifecycleNotFound{Bucket: bucket} @@ -274,7 +274,7 @@ func (sys *BucketMetadataSys) GetNotificationConfig(bucket string) (*event.Confi return meta.notificationConfig, nil } - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { return nil, err } @@ -284,7 +284,7 @@ func (sys *BucketMetadataSys) GetNotificationConfig(bucket string) (*event.Confi // GetSSEConfig returns configured SSE config // The returned object may not be modified. func (sys *BucketMetadataSys) GetSSEConfig(bucket string) (*bucketsse.BucketSSEConfig, error) { - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { if errors.Is(err, errConfigNotFound) { return nil, BucketSSEConfigNotFound{Bucket: bucket} @@ -308,7 +308,7 @@ func (sys *BucketMetadataSys) GetPolicyConfig(bucket string) (*policy.Policy, er return objAPI.GetBucketPolicy(GlobalContext, bucket) } - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { if errors.Is(err, errConfigNotFound) { return nil, BucketPolicyNotFound{Bucket: bucket} @@ -323,8 +323,8 @@ func (sys *BucketMetadataSys) GetPolicyConfig(bucket string) (*policy.Policy, er // GetQuotaConfig returns configured bucket quota // The returned object may not be modified. -func (sys *BucketMetadataSys) GetQuotaConfig(bucket string) (*madmin.BucketQuota, error) { - meta, err := sys.GetConfig(bucket) +func (sys *BucketMetadataSys) GetQuotaConfig(ctx context.Context, bucket string) (*madmin.BucketQuota, error) { + meta, err := sys.GetConfig(ctx, bucket) if err != nil { return nil, err } @@ -334,7 +334,7 @@ func (sys *BucketMetadataSys) GetQuotaConfig(bucket string) (*madmin.BucketQuota // GetReplicationConfig returns configured bucket replication config // The returned object may not be modified. func (sys *BucketMetadataSys) GetReplicationConfig(ctx context.Context, bucket string) (*replication.Config, error) { - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(ctx, bucket) if err != nil { if errors.Is(err, errConfigNotFound) { return nil, BucketReplicationConfigNotFound{Bucket: bucket} @@ -351,7 +351,7 @@ func (sys *BucketMetadataSys) GetReplicationConfig(ctx context.Context, bucket s // GetBucketTargetsConfig returns configured bucket targets for this bucket // The returned object may not be modified. func (sys *BucketMetadataSys) GetBucketTargetsConfig(bucket string) (*madmin.BucketTargets, error) { - meta, err := sys.GetConfig(bucket) + meta, err := sys.GetConfig(GlobalContext, bucket) if err != nil { return nil, err } @@ -377,7 +377,7 @@ func (sys *BucketMetadataSys) GetBucketTarget(bucket string, arn string) (madmin // GetConfig returns a specific configuration from the bucket metadata. // The returned object may not be modified. -func (sys *BucketMetadataSys) GetConfig(bucket string) (BucketMetadata, error) { +func (sys *BucketMetadataSys) GetConfig(ctx context.Context, bucket string) (BucketMetadata, error) { objAPI := newObjectLayerFn() if objAPI == nil { return newBucketMetadata(bucket), errServerNotInitialized @@ -397,7 +397,7 @@ func (sys *BucketMetadataSys) GetConfig(bucket string) (BucketMetadata, error) { if ok { return meta, nil } - meta, err := loadBucketMetadata(GlobalContext, objAPI, bucket) + meta, err := loadBucketMetadata(ctx, objAPI, bucket) if err != nil { return meta, err } diff --git a/cmd/bucket-notification-handlers.go b/cmd/bucket-notification-handlers.go index 7ac658cd6..ee92de3d4 100644 --- a/cmd/bucket-notification-handlers.go +++ b/cmd/bucket-notification-handlers.go @@ -160,7 +160,7 @@ func (api objectAPIHandlers) PutBucketNotificationHandler(w http.ResponseWriter, return } - if err = globalBucketMetadataSys.Update(bucketName, bucketNotificationConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucketName, bucketNotificationConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/bucket-policy-handlers.go b/cmd/bucket-policy-handlers.go index b0952a61a..5e405d79f 100644 --- a/cmd/bucket-policy-handlers.go +++ b/cmd/bucket-policy-handlers.go @@ -103,7 +103,7 @@ func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *ht return } - if err = globalBucketMetadataSys.Update(bucket, bucketPolicyConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } @@ -148,7 +148,7 @@ func (api objectAPIHandlers) DeleteBucketPolicyHandler(w http.ResponseWriter, r return } - if err := globalBucketMetadataSys.Update(bucket, bucketPolicyConfig, nil); err != nil { + if err := globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, nil); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/bucket-quota.go b/cmd/bucket-quota.go index 2f3451b41..59dc5c1c8 100644 --- a/cmd/bucket-quota.go +++ b/cmd/bucket-quota.go @@ -32,7 +32,7 @@ type BucketQuotaSys struct { } // Get - Get quota configuration. -func (sys *BucketQuotaSys) Get(bucketName string) (*madmin.BucketQuota, error) { +func (sys *BucketQuotaSys) Get(ctx context.Context, bucketName string) (*madmin.BucketQuota, error) { if globalIsGateway { objAPI := newObjectLayerFn() if objAPI == nil { @@ -41,7 +41,7 @@ func (sys *BucketQuotaSys) Get(bucketName string) (*madmin.BucketQuota, error) { return &madmin.BucketQuota{}, nil } - return globalBucketMetadataSys.GetQuotaConfig(bucketName) + return globalBucketMetadataSys.GetQuotaConfig(ctx, bucketName) } // NewBucketQuotaSys returns initialized BucketQuotaSys @@ -95,7 +95,7 @@ func (sys *BucketQuotaSys) enforceQuotaHard(ctx context.Context, bucket string, return nil } - q, err := sys.Get(bucket) + q, err := sys.Get(ctx, bucket) if err != nil { return err } diff --git a/cmd/bucket-versioning-handler.go b/cmd/bucket-versioning-handler.go index 49e9d815d..d121f41d3 100644 --- a/cmd/bucket-versioning-handler.go +++ b/cmd/bucket-versioning-handler.go @@ -95,7 +95,7 @@ func (api objectAPIHandlers) PutBucketVersioningHandler(w http.ResponseWriter, r return } - if err = globalBucketMetadataSys.Update(bucket, bucketVersioningConfig, configData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketVersioningConfig, configData); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } diff --git a/cmd/erasure-healing_test.go b/cmd/erasure-healing_test.go index f961dbe41..63894d2ea 100644 --- a/cmd/erasure-healing_test.go +++ b/cmd/erasure-healing_test.go @@ -368,7 +368,7 @@ func TestHealingDanglingObject(t *testing.T) { orgDisks := append([]StorageAPI{}, disks...) // Enable versioning. - globalBucketMetadataSys.Update(bucket, bucketVersioningConfig, []byte(`Enabled`)) + globalBucketMetadataSys.Update(ctx, bucket, bucketVersioningConfig, []byte(`Enabled`)) _, err = objLayer.PutObject(ctx, bucket, object, mustGetPutObjReader(t, bytes.NewReader(data), int64(len(data)), "", ""), ObjectOptions{ Versioned: true, diff --git a/cmd/metrics-v2.go b/cmd/metrics-v2.go index b0ceba2ba..47769461d 100644 --- a/cmd/metrics-v2.go +++ b/cmd/metrics-v2.go @@ -117,6 +117,7 @@ const ( softwareSubsystem MetricSubsystem = "software" sysCallSubsystem MetricSubsystem = "syscall" usageSubsystem MetricSubsystem = "usage" + quotaSubsystem MetricSubsystem = "quota" ilmSubsystem MetricSubsystem = "ilm" scannerSubsystem MetricSubsystem = "scanner" ) @@ -409,6 +410,16 @@ func getUsageLastScanActivityMD() MetricDescription { } } +func getBucketUsageQuotaTotalBytesMD() MetricDescription { + return MetricDescription{ + Namespace: bucketMetricNamespace, + Subsystem: quotaSubsystem, + Name: totalBytes, + Help: "Total bucket quota size in bytes", + Type: gaugeMetric, + } +} + func getBucketUsageTotalBytesMD() MetricDescription { return MetricDescription{ Namespace: bucketMetricNamespace, @@ -1502,6 +1513,8 @@ func getBucketUsageMetrics() *MetricsGroup { for bucket, usage := range dataUsageInfo.BucketsUsage { stats := getLatestReplicationStats(bucket, usage) + quota, _ := globalBucketQuotaSys.Get(ctx, bucket) + metrics = append(metrics, Metric{ Description: getBucketUsageTotalBytesMD(), Value: float64(usage.Size), @@ -1520,6 +1533,14 @@ func getBucketUsageMetrics() *MetricsGroup { VariableLabels: map[string]string{"bucket": bucket}, }) + if quota != nil && quota.Quota > 0 { + metrics = append(metrics, Metric{ + Description: getBucketUsageQuotaTotalBytesMD(), + Value: float64(quota.Quota), + VariableLabels: map[string]string{"bucket": bucket}, + }) + } + if stats.hasReplicationUsage() { for arn, stat := range stats.Stats { metrics = append(metrics, Metric{ diff --git a/cmd/site-replication.go b/cmd/site-replication.go index 1bcf2796d..dcdcd2a18 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -809,7 +809,7 @@ func (c *SiteReplicationSys) PeerBucketConfigureReplHandler(ctx context.Context, if err != nil { return err } - if err = globalBucketMetadataSys.Update(bucket, bucketTargetsFile, tgtBytes); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketTargetsFile, tgtBytes); err != nil { return err } targetARN = bucketTarget.Arn @@ -908,7 +908,7 @@ func (c *SiteReplicationSys) PeerBucketConfigureReplHandler(ctx context.Context, if err != nil { return err } - err = globalBucketMetadataSys.Update(bucket, bucketReplicationConfig, replCfgData) + err = globalBucketMetadataSys.Update(ctx, bucket, bucketReplicationConfig, replCfgData) logger.LogIf(ctx, c.annotatePeerErr(peer.Name, "Error updating replication configuration", err)) return err } @@ -1217,7 +1217,7 @@ func (c *SiteReplicationSys) PeerBucketPolicyHandler(ctx context.Context, bucket return wrapSRErr(err) } - err = globalBucketMetadataSys.Update(bucket, bucketPolicyConfig, configData) + err = globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, configData) if err != nil { return wrapSRErr(err) } @@ -1225,7 +1225,7 @@ func (c *SiteReplicationSys) PeerBucketPolicyHandler(ctx context.Context, bucket } // Delete the bucket policy - err := globalBucketMetadataSys.Update(bucket, bucketPolicyConfig, nil) + err := globalBucketMetadataSys.Update(ctx, bucket, bucketPolicyConfig, nil) if err != nil { return wrapSRErr(err) } @@ -1240,7 +1240,7 @@ func (c *SiteReplicationSys) PeerBucketTaggingHandler(ctx context.Context, bucke if err != nil { return wrapSRErr(err) } - err = globalBucketMetadataSys.Update(bucket, bucketTaggingConfig, configData) + err = globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, configData) if err != nil { return wrapSRErr(err) } @@ -1248,7 +1248,7 @@ func (c *SiteReplicationSys) PeerBucketTaggingHandler(ctx context.Context, bucke } // Delete the tags - err := globalBucketMetadataSys.Update(bucket, bucketTaggingConfig, nil) + err := globalBucketMetadataSys.Update(ctx, bucket, bucketTaggingConfig, nil) if err != nil { return wrapSRErr(err) } @@ -1263,7 +1263,7 @@ func (c *SiteReplicationSys) PeerBucketObjectLockConfigHandler(ctx context.Conte if err != nil { return wrapSRErr(err) } - err = globalBucketMetadataSys.Update(bucket, objectLockConfig, configData) + err = globalBucketMetadataSys.Update(ctx, bucket, objectLockConfig, configData) if err != nil { return wrapSRErr(err) } @@ -1280,7 +1280,7 @@ func (c *SiteReplicationSys) PeerBucketSSEConfigHandler(ctx context.Context, buc if err != nil { return wrapSRErr(err) } - err = globalBucketMetadataSys.Update(bucket, bucketSSEConfig, configData) + err = globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, configData) if err != nil { return wrapSRErr(err) } @@ -1288,7 +1288,7 @@ func (c *SiteReplicationSys) PeerBucketSSEConfigHandler(ctx context.Context, buc } // Delete sse config - err := globalBucketMetadataSys.Update(bucket, bucketSSEConfig, nil) + err := globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, nil) if err != nil { return wrapSRErr(err) } @@ -1303,7 +1303,7 @@ func (c *SiteReplicationSys) PeerBucketQuotaConfigHandler(ctx context.Context, b return wrapSRErr(err) } - if err = globalBucketMetadataSys.Update(bucket, bucketQuotaConfigFile, quotaData); err != nil { + if err = globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, quotaData); err != nil { return wrapSRErr(err) } @@ -1311,7 +1311,7 @@ func (c *SiteReplicationSys) PeerBucketQuotaConfigHandler(ctx context.Context, b } // Delete the bucket policy - err := globalBucketMetadataSys.Update(bucket, bucketQuotaConfigFile, nil) + err := globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, nil) if err != nil { return wrapSRErr(err) } @@ -1496,7 +1496,7 @@ func (c *SiteReplicationSys) syncToAllPeers(ctx context.Context) error { } } - quotaConfig, err := globalBucketMetadataSys.GetQuotaConfig(bucket) + quotaConfig, err := globalBucketMetadataSys.GetQuotaConfig(ctx, bucket) found = true if _, ok := err.(BucketQuotaConfigNotFound); ok { found = false @@ -2608,7 +2608,7 @@ func (c *SiteReplicationSys) SiteReplicationMetaInfo(ctx context.Context, objAPI } // Get quota config if present - quotaConfig, err := globalBucketMetadataSys.GetQuotaConfig(bucket) + quotaConfig, err := globalBucketMetadataSys.GetQuotaConfig(ctx, bucket) found = true if _, ok := err.(BucketQuotaConfigNotFound); ok { found = false diff --git a/docs/metrics/prometheus/list.md b/docs/metrics/prometheus/list.md index 617b4d995..ce305dd8f 100644 --- a/docs/metrics/prometheus/list.md +++ b/docs/metrics/prometheus/list.md @@ -14,6 +14,7 @@ These metrics can be from any MinIO server once per collection. | `minio_bucket_replication_failed_count` | Total number of replication foperations failed for this bucket. | | `minio_bucket_usage_object_total` | Total number of objects | | `minio_bucket_usage_total_bytes` | Total bucket size in bytes | +| `minio_bucket_quota_total_bytes` | Total bucket quota size in bytes | | `minio_cache_hits_total` | Total number of disk cache hits | | `minio_cache_missed_total` | Total number of disk cache misses | | `minio_cache_sent_bytes` | Total number of bytes served from cache |