From c37465008f0ef8086411dd178915677357c61492 Mon Sep 17 00:00:00 2001 From: zhijian Date: Fri, 26 Jan 2024 09:16:27 +0800 Subject: [PATCH] cmd/gateway: create MinioMetaBucket when it doesn't exist. (#4383) --- cmd/gateway.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/gateway.go b/cmd/gateway.go index a5f363ec36ca..82775d317557 100644 --- a/cmd/gateway.go +++ b/cmd/gateway.go @@ -20,6 +20,8 @@ package cmd import ( + "context" + "errors" _ "net/http/pprof" "os" "os/signal" @@ -140,6 +142,12 @@ func gateway(c *cli.Context) error { return err } + if _, err := jfsGateway.GetBucketInfo(context.Background(), minio.MinioMetaBucket); errors.As(err, &minio.BucketNotFound{}) { + if err := jfsGateway.MakeBucketWithLocation(context.Background(), minio.MinioMetaBucket, minio.BucketOptions{}); err != nil { + logger.Fatalf("init MinioMetaBucket error %s: %s", minio.MinioMetaBucket, err) + } + } + args := []string{"server", "--address", listenAddr, "--anonymous"} if c.Bool("no-banner") { args = append(args, "--quiet")