mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): vendor update (#22920)
This commit is contained in:
@@ -96,7 +96,7 @@ require (
|
||||
k8s.io/cri-api v0.22.17
|
||||
k8s.io/klog/v2 v2.20.0
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250716110021-9441f2355a22
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250721091654-e8d3278271f1
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
@@ -1408,8 +1408,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250716110021-9441f2355a22 h1:yttqal9APls/yeyM954EmNsFR/AiD/r5tUsyS6yT120=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250716110021-9441f2355a22/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250721091654-e8d3278271f1 h1:KBL2uvo3lw1NbIWfvVnfGBHg6rH98udSAk9fm4iYtmw=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250721091654-e8d3278271f1/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
Vendored
+1
-1
@@ -1852,7 +1852,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250716110021-9441f2355a22
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250721091654-e8d3278271f1
|
||||
## explicit; go 1.21
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+26
-9
@@ -38,7 +38,7 @@ type SMongoDBBackup struct {
|
||||
BackupType string
|
||||
}
|
||||
|
||||
func (self *SRegion) GetMongoDBBackups(id string, start time.Time, end time.Time, pageSize, pageNum int) ([]SMongoDBBackup, int, error) {
|
||||
func (self *SRegion) GetMongoDBBackups(id string, nodeId string, start time.Time, end time.Time, pageSize, pageNum int) ([]SMongoDBBackup, int, error) {
|
||||
if pageSize < 1 || pageSize > 100 {
|
||||
pageSize = 100
|
||||
}
|
||||
@@ -52,6 +52,9 @@ func (self *SRegion) GetMongoDBBackups(id string, start time.Time, end time.Time
|
||||
"PageSize": fmt.Sprintf("%d", pageSize),
|
||||
"PageNumber": fmt.Sprintf("%d", pageNum),
|
||||
}
|
||||
if len(nodeId) > 0 {
|
||||
params["NodeId"] = nodeId
|
||||
}
|
||||
resp, err := self.mongodbRequest("DescribeBackups", params)
|
||||
if err != nil {
|
||||
return nil, 0, errors.Wrapf(err, "DescribeBackups")
|
||||
@@ -67,15 +70,29 @@ func (self *SRegion) GetMongoDBBackups(id string, start time.Time, end time.Time
|
||||
|
||||
func (self *SMongoDB) GetIBackups() ([]cloudprovider.SMongoDBBackup, error) {
|
||||
backups := []SMongoDBBackup{}
|
||||
now := time.Now().Add(time.Minute * -1)
|
||||
for {
|
||||
part, total, err := self.region.GetMongoDBBackups(self.DBInstanceId, self.CreationTime, now, 100, len(backups)/100)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetMongoDBBackups")
|
||||
err := self.Refresh()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Refresh")
|
||||
}
|
||||
nodeIds := []string{}
|
||||
if self.DBInstanceType == "sharding" {
|
||||
for _, shard := range self.ShardList.ShardAttribute {
|
||||
nodeIds = append(nodeIds, shard.NodeId)
|
||||
}
|
||||
backups = append(backups, part...)
|
||||
if len(backups) >= total {
|
||||
break
|
||||
} else {
|
||||
nodeIds = []string{""}
|
||||
}
|
||||
now := time.Now().Add(time.Minute * -1)
|
||||
for _, nodeId := range nodeIds {
|
||||
for {
|
||||
part, total, err := self.region.GetMongoDBBackups(self.DBInstanceId, nodeId, self.CreationTime, now, 100, len(backups)/100)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetMongoDBBackups")
|
||||
}
|
||||
backups = append(backups, part...)
|
||||
if len(backups) >= total {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
ret := []cloudprovider.SMongoDBBackup{}
|
||||
|
||||
+2
-2
@@ -443,7 +443,7 @@ func (b *SBucket) PutObject(ctx context.Context, key string, body io.Reader, siz
|
||||
|
||||
func (region *SRegion) GetBucket(name string) (*SBucket, error) {
|
||||
resource := "b/" + name
|
||||
bucket := &SBucket{}
|
||||
bucket := &SBucket{region: region}
|
||||
err := region.StorageGet(resource, bucket)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "GetBucket")
|
||||
@@ -484,7 +484,7 @@ func (region *SRegion) CreateBucket(name string, storageClass string, acl cloudp
|
||||
params.Set("predefinedAcl", "publicReadWrite")
|
||||
}
|
||||
params.Set("project", region.GetProjectId())
|
||||
bucket := &SBucket{}
|
||||
bucket := &SBucket{region: region}
|
||||
resource := fmt.Sprintf("b?%s", params.Encode())
|
||||
err := region.StorageInsert(resource, jsonutils.Marshal(body), bucket)
|
||||
if err != nil {
|
||||
|
||||
+2
-4
@@ -732,7 +732,6 @@ func (self *SInstance) Renew(bc billing.SBillingCycle) error {
|
||||
// https://console.huaweicloud.com/apiexplorer/#/openapi/ECS/doc?api=ListServersDetails
|
||||
func (self *SRegion) GetInstances(ip string) ([]SInstance, error) {
|
||||
params := url.Values{}
|
||||
params.Set("limit", "1000")
|
||||
if len(ip) > 0 {
|
||||
params.Set("ip", ip)
|
||||
}
|
||||
@@ -744,17 +743,16 @@ func (self *SRegion) GetInstances(ip string) ([]SInstance, error) {
|
||||
}
|
||||
part := struct {
|
||||
Servers []SInstance
|
||||
Count int
|
||||
}{}
|
||||
err = resp.Unmarshal(&part)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret = append(ret, part.Servers...)
|
||||
if len(ret) >= part.Count || len(part.Servers) == 0 {
|
||||
if len(part.Servers) == 0 {
|
||||
break
|
||||
}
|
||||
params.Set("offset", fmt.Sprintf("%d", len(ret)))
|
||||
params.Set("marker", part.Servers[len(part.Servers)-1].ID)
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user