mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix: qcloud storagecache bucket name too long
This commit is contained in:
@@ -28,8 +28,8 @@ import (
|
||||
type TBucketACLType string
|
||||
|
||||
const (
|
||||
// 100 MB
|
||||
MAX_PUT_OBJECT_SIZEBYTES = int64(1000 * 1000 * 100)
|
||||
// 50 MB
|
||||
MAX_PUT_OBJECT_SIZEBYTES = int64(1000 * 1000 * 50)
|
||||
|
||||
// ACLDefault = TBucketACLType("default")
|
||||
|
||||
|
||||
@@ -336,7 +336,8 @@ func (self *SManagedVirtualizationHostDriver) RequestRebuildDiskOnStorage(ctx co
|
||||
|
||||
func (driver *SManagedVirtualizationHostDriver) IsReachStoragecacheCapacityLimit(host *models.SHost, cachedImages []models.SCachedimage) bool {
|
||||
quota := host.GetHostDriver().GetStoragecacheQuota(host)
|
||||
if quota > 0 && len(cachedImages) >= quota {
|
||||
log.Debugf("Cached image total: %d quota: %d", len(cachedImages), quota)
|
||||
if quota > 0 && len(cachedImages)+1 >= quota {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -167,7 +167,10 @@ func (self *SStoragecache) uploadImage(ctx context.Context, userCred mcclient.To
|
||||
return "", err
|
||||
}
|
||||
|
||||
bucketName := strings.ToLower(fmt.Sprintf("imgcache-%s-%s", self.region.GetId(), image.ImageId))
|
||||
bucketName := strings.ReplaceAll(strings.ToLower(self.region.GetId()+image.ImageId), "-", "")
|
||||
if len(bucketName) > 40 {
|
||||
bucketName = bucketName[:40]
|
||||
}
|
||||
exists, _ := self.region.IBucketExist(bucketName)
|
||||
if !exists {
|
||||
log.Debugf("Bucket %s not exists, to create ...", bucketName)
|
||||
|
||||
Reference in New Issue
Block a user