aboutsummaryrefslogtreecommitdiff
path: root/weed/shell
diff options
context:
space:
mode:
authorSmsS4 <36403983+SmsS4@users.noreply.github.com>2023-05-16 20:09:43 +0330
committerGitHub <noreply@github.com>2023-05-16 09:39:43 -0700
commit17e91d29179a41131e2a707ac2c5e63be4a21530 (patch)
treece0aa8417e2c4d983b7f085b8f1498dc3bd4f9d4 /weed/shell
parentb7f011f777bd9fa396a607e6228f43e3be5f5437 (diff)
downloadseaweedfs-17e91d29179a41131e2a707ac2c5e63be4a21530.tar.xz
seaweedfs-17e91d29179a41131e2a707ac2c5e63be4a21530.zip
Use filerGroup for s3 buckets collection prefix (#4465)
* Use filerGroup for s3 buckets collection prefix * Fix templates * Remove flags * Remove s3CollectionPrefix
Diffstat (limited to 'weed/shell')
-rw-r--r--weed/shell/command_s3_bucket_delete.go2
-rw-r--r--weed/shell/command_s3_bucket_list.go2
-rw-r--r--weed/shell/command_s3_bucket_quota_check.go2
-rw-r--r--weed/shell/commands.go7
4 files changed, 10 insertions, 3 deletions
diff --git a/weed/shell/command_s3_bucket_delete.go b/weed/shell/command_s3_bucket_delete.go
index d0b4cb505..3b2a9c6e9 100644
--- a/weed/shell/command_s3_bucket_delete.go
+++ b/weed/shell/command_s3_bucket_delete.go
@@ -54,7 +54,7 @@ func (c *commandS3BucketDelete) Do(args []string, commandEnv *CommandEnv, writer
// delete the collection directly first
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
_, err = client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{
- Name: *bucketName,
+ Name: getCollectionName(commandEnv, *bucketName),
})
return err
})
diff --git a/weed/shell/command_s3_bucket_list.go b/weed/shell/command_s3_bucket_list.go
index 3b607a799..bf21a3a29 100644
--- a/weed/shell/command_s3_bucket_list.go
+++ b/weed/shell/command_s3_bucket_list.go
@@ -57,7 +57,7 @@ func (c *commandS3BucketList) Do(args []string, commandEnv *CommandEnv, writer i
if !entry.IsDirectory {
return nil
}
- collection := entry.Name
+ collection := getCollectionName(commandEnv, entry.Name)
var collectionSize, fileCount float64
if collectionInfo, found := collectionInfos[collection]; found {
collectionSize = collectionInfo.Size
diff --git a/weed/shell/command_s3_bucket_quota_check.go b/weed/shell/command_s3_bucket_quota_check.go
index 27f0aaee5..bc0d838f7 100644
--- a/weed/shell/command_s3_bucket_quota_check.go
+++ b/weed/shell/command_s3_bucket_quota_check.go
@@ -65,7 +65,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv,
if !entry.IsDirectory {
return nil
}
- collection := entry.Name
+ collection := getCollectionName(commandEnv, entry.Name)
var collectionSize float64
if collectionInfo, found := collectionInfos[collection]; found {
collectionSize = collectionInfo.Size
diff --git a/weed/shell/commands.go b/weed/shell/commands.go
index e67394e42..b1722edfb 100644
--- a/weed/shell/commands.go
+++ b/weed/shell/commands.go
@@ -184,3 +184,10 @@ func readNeedleStatus(grpcDialOption grpc.DialOption, sourceVolumeServer pb.Serv
)
return
}
+
+func getCollectionName(commandEnv *CommandEnv, bucket string) string {
+ if *commandEnv.option.FilerGroup != "" {
+ return fmt.Sprintf("%s_%s", *commandEnv.option.FilerGroup, bucket)
+ }
+ return bucket
+}