mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
Merge pull request #12466 from swordqiu/automated-cherry-pick-of-#12464-upstream-release-3.7
Automated cherry pick of #12464: fix: glance depends s3fs
This commit is contained in:
@@ -2,5 +2,6 @@ FROM registry.cn-beijing.aliyuncs.com/yunionio/torrent:20210815.0
|
||||
|
||||
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
|
||||
|
||||
RUN apk add --no-cache s3fs-fuse --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/glance /opt/yunion/bin/glance
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
@@ -58,9 +57,6 @@ func Init(endpoint, accessKey, secretKey, bucket string, useSSL bool) error {
|
||||
if client != nil {
|
||||
return nil
|
||||
}
|
||||
if !strings.HasPrefix(endpoint, "http://") && !strings.HasPrefix(endpoint, "https://") {
|
||||
endpoint = "http://" + endpoint
|
||||
}
|
||||
cfg := objectstore.NewObjectStoreClientConfig(endpoint, accessKey, secretKey)
|
||||
minioClient, err := objectstore.NewObjectStoreClient(cfg)
|
||||
if err != nil {
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
@@ -135,8 +136,16 @@ func StartService() {
|
||||
}
|
||||
|
||||
func initS3() {
|
||||
url := options.Options.S3Endpoint
|
||||
if !strings.HasPrefix(url, "http://") && !strings.HasPrefix(url, "https://") {
|
||||
prefix := "http://"
|
||||
if options.Options.S3UseSSL {
|
||||
prefix = "https://"
|
||||
}
|
||||
url = prefix + url
|
||||
}
|
||||
err := s3.Init(
|
||||
options.Options.S3Endpoint,
|
||||
url,
|
||||
options.Options.S3AccessKey,
|
||||
options.Options.S3SecretKey,
|
||||
options.Options.S3BucketName,
|
||||
@@ -163,11 +172,6 @@ func initS3() {
|
||||
}
|
||||
}
|
||||
|
||||
prefix := "http://"
|
||||
if options.Options.S3UseSSL {
|
||||
prefix = "https://"
|
||||
}
|
||||
url := prefix + options.Options.S3Endpoint
|
||||
out, err := procutils.NewCommand("s3fs",
|
||||
options.Options.S3BucketName, options.Options.S3MountPoint,
|
||||
"-o", fmt.Sprintf("passwd_file=/tmp/s3-pass,use_path_request_style,url=%s", url)).Output()
|
||||
|
||||
Reference in New Issue
Block a user