mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): hcs misc fix
This commit is contained in:
@@ -282,7 +282,7 @@ dep:
|
||||
@echo "$$depDeprecated"
|
||||
@$(MAKE) mod
|
||||
|
||||
RELEASE_BRANCH:=master
|
||||
RELEASE_BRANCH:=release/3.10
|
||||
GOPROXY ?= direct
|
||||
|
||||
mod:
|
||||
|
||||
@@ -84,7 +84,7 @@ require (
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221122135203-3316ad5fc700
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221123072409-a80b2bf17fb5
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
|
||||
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd
|
||||
yunion.io/x/log v1.0.0
|
||||
|
||||
@@ -1176,8 +1176,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.20221122135203-3316ad5fc700 h1:qrzb/D3fktCw6Ovi4kgxJk60EAFVrWp0eSuUd7zM63c=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221122135203-3316ad5fc700/go.mod h1:drc/WDD65r6wI1tSejk19xcl9QwmzZlgJGXN7a9o2KQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221123072409-a80b2bf17fb5 h1:arPz0o1TQDGMvvywaCqHF343LpUod0uZ1c8ANHJIA+Y=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221123072409-a80b2bf17fb5/go.mod h1:drc/WDD65r6wI1tSejk19xcl9QwmzZlgJGXN7a9o2KQ=
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 h1:0zlZD5uhZoIHgLVAWCz2aHaYk2ZrNsACCYD7R6EIBII=
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
@@ -718,8 +718,7 @@ func (self *SManagedVirtualizedGuestDriver) RemoteDeployGuestForRebuildRoot(ctx
|
||||
}
|
||||
if len(idisks) < len(desc.DataDisks)+1 {
|
||||
if waited > maxWaitSecs {
|
||||
log.Errorf("inconsistent disk number, wait timeout, must be something wrong on remote")
|
||||
return nil, cloudprovider.ErrTimeout
|
||||
return nil, errors.Wrapf(cloudprovider.ErrTimeout, "inconsistent disk number %d < %d, wait timeout, must be something wrong on remote", len(idisks), len(desc.DataDisks)+1)
|
||||
}
|
||||
log.Debugf("inconsistent disk number???? %d != %d", len(idisks), len(desc.DataDisks)+1)
|
||||
time.Sleep(time.Second * 5)
|
||||
|
||||
@@ -155,7 +155,8 @@ func (manager *SElasticipManager) ListItemFilter(
|
||||
return nil, httperrors.NewGeneralError(err)
|
||||
}
|
||||
guest := serverObj.(*SGuest)
|
||||
if guest.Hypervisor == api.HYPERVISOR_KVM || (utils.IsInStringArray(guest.Hypervisor, api.PRIVATE_CLOUD_HYPERVISORS) && guest.Hypervisor != api.HYPERVISOR_HCSO) {
|
||||
if guest.Hypervisor == api.HYPERVISOR_KVM || (utils.IsInStringArray(guest.Hypervisor, api.PRIVATE_CLOUD_HYPERVISORS) &&
|
||||
guest.Hypervisor != api.HYPERVISOR_HCSO && guest.Hypervisor != api.HYPERVISOR_HCS) {
|
||||
zone, _ := guest.getZone()
|
||||
networks := NetworkManager.Query().SubQuery()
|
||||
wires := WireManager.Query().SubQuery()
|
||||
|
||||
@@ -41,7 +41,7 @@ func (self *SHCSRegionDriver) IsSecurityGroupBelongVpc() bool {
|
||||
}
|
||||
|
||||
func (self *SHCSRegionDriver) IsSupportedElasticcacheSecgroup() bool {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *SHCSRegionDriver) GetMaxElasticcacheSecurityGroupCount() int {
|
||||
|
||||
@@ -1790,6 +1790,7 @@ func (self *SManagedVirtualizationRegionDriver) RequestCreateElasticcache(ctx co
|
||||
MaintainBegin: ec.MaintainStartTime,
|
||||
MaintainEnd: ec.MaintainEndTime,
|
||||
}
|
||||
params.Password, _ = task.GetParams().GetString("password")
|
||||
if ec.BillingType == billing_api.BILLING_TYPE_PREPAID {
|
||||
bc, err := billing.ParseBillingCycle(ec.BillingCycle)
|
||||
if err != nil {
|
||||
@@ -1822,7 +1823,6 @@ func (self *SManagedVirtualizationRegionDriver) RequestCreateElasticcache(ctx co
|
||||
}
|
||||
}
|
||||
|
||||
params.Password, _ = data.GetString("password")
|
||||
data.Unmarshal(¶ms.SecurityGroupIds, "ext_secgroup_ids")
|
||||
|
||||
provider := iprovider.(*models.SCloudprovider)
|
||||
@@ -1841,7 +1841,7 @@ func (self *SManagedVirtualizationRegionDriver) RequestCreateElasticcache(ctx co
|
||||
return nil, errors.Wrap(err, "SetExternalId")
|
||||
}
|
||||
|
||||
err = cloudprovider.WaitStatusWithDelay(iec, api.ELASTIC_CACHE_STATUS_RUNNING, 30*time.Second, 15*time.Second, 10*time.Minute)
|
||||
err = cloudprovider.WaitStatusWithDelay(iec, api.ELASTIC_CACHE_STATUS_RUNNING, 30*time.Second, 15*time.Second, 30*time.Minute)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "WaitStatusWithDelay")
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1439,7 +1439,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.20221122135203-3316ad5fc700
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221123072409-a80b2bf17fb5
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+3
-1
@@ -389,7 +389,9 @@ func (self *SRegion) ResizeDisk(id string, sizeGb int64) error {
|
||||
|
||||
func (self *SRegion) ResetDisk(diskId, snapshotId string) error {
|
||||
params := map[string]interface{}{
|
||||
"volume_id": diskId,
|
||||
"rollback": map[string]interface{}{
|
||||
"volume_id": diskId,
|
||||
},
|
||||
}
|
||||
res := fmt.Sprintf("os-vendor-snapshots/%s", snapshotId)
|
||||
return self.evsPerform(res, "rollback", params)
|
||||
|
||||
+1
-1
@@ -260,7 +260,7 @@ func (self *SEip) Dissociate() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cloudprovider.WaitStatus(self, api.EIP_STATUS_READY, 10*time.Second, 180*time.Second)
|
||||
return cloudprovider.WaitStatusWithDelay(self, api.EIP_STATUS_READY, time.Second*10, 10*time.Second, 3*time.Minute)
|
||||
}
|
||||
|
||||
func (self *SEip) ChangeBandwidth(bw int) error {
|
||||
|
||||
+3
@@ -565,6 +565,9 @@ func (self *SHcsClient) get(product, version, regionId string, resource string,
|
||||
}
|
||||
|
||||
func (self *SHcsClient) _getJob(product, regionId string, jobId string) (jsonutils.JSONObject, error) {
|
||||
if product == "ims" { // 保存镜像时,使用ecs查询job
|
||||
product = "ecs"
|
||||
}
|
||||
url := self._url(product, "v1", regionId, fmt.Sprintf("jobs/%s", jobId))
|
||||
resp, err := self.request(httputils.GET, url, nil, nil)
|
||||
if err != nil {
|
||||
|
||||
+20
-5
@@ -635,9 +635,14 @@ func (self *SInstance) RebuildRoot(ctx context.Context, desc *cloudprovider.SMan
|
||||
}
|
||||
}
|
||||
|
||||
err = self.Refresh()
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "Refresh")
|
||||
}
|
||||
|
||||
idisks, err := self.GetIDisks()
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", errors.Wrapf(err, "GetIDisks")
|
||||
}
|
||||
|
||||
if len(idisks) == 0 {
|
||||
@@ -930,8 +935,6 @@ func (self *SRegion) RebuildRoot(ctx context.Context, userId, instanceId, passwd
|
||||
return self.ecsPerform("cloudservers/"+instanceId, "reinstallos", params, nil)
|
||||
}
|
||||
|
||||
// https://support.huaweicloud.com/api-ecs/zh-cn_topic_0067876971.html
|
||||
// 返回job id
|
||||
func (self *SRegion) ChangeRoot(ctx context.Context, userId, instanceId, imageId, passwd, publicKeyName, userData string) error {
|
||||
osChange := map[string]interface{}{}
|
||||
if len(publicKeyName) > 0 {
|
||||
@@ -1116,8 +1119,20 @@ func (self *SRegion) SaveImage(instanceId string, opts *cloudprovider.SaveImageO
|
||||
return opts.Notes
|
||||
}()
|
||||
}
|
||||
ret := &SImage{cache: &SStoragecache{region: self}}
|
||||
return ret, self.perform("ims", "v2", "cloudimages", "action", params, ret)
|
||||
job := &SJob{}
|
||||
err := self.perform("ims", "v2", "cloudimages", "action", params, job)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, id := range job.GetIds() {
|
||||
image, err := self.GetImage(id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetImage(%s)", id)
|
||||
}
|
||||
image.cache = &SStoragecache{region: self}
|
||||
return image, nil
|
||||
}
|
||||
return nil, errors.Wrapf(cloudprovider.ErrNotFound, jsonutils.Marshal(job).String())
|
||||
}
|
||||
|
||||
func (self *SInstance) SaveImage(opts *cloudprovider.SaveImageOptions) (cloudprovider.ICloudImage, error) {
|
||||
|
||||
+3
@@ -59,6 +59,9 @@ func (self *SJob) GetIds() []string {
|
||||
if len(sub.Entities.ServerId) > 0 {
|
||||
ret = append(ret, sub.Entities.ServerId)
|
||||
}
|
||||
if len(sub.Entities.ImageId) > 0 {
|
||||
ret = append(ret, sub.Entities.ImageId)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
+3
-3
@@ -168,7 +168,7 @@ func (self *SElasticcache) GetArchType() string {
|
||||
if strings.Contains(self.ResourceSpecCode, "single") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_SINGLE
|
||||
}
|
||||
if strings.Contains(self.ResourceSpecCode, "ha") {
|
||||
if strings.Contains(self.ResourceSpecCode, "ha") || strings.Contains(self.ResourceSpecCode, "master") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_MASTER
|
||||
}
|
||||
if strings.Contains(self.ResourceSpecCode, "cluster") {
|
||||
@@ -177,7 +177,7 @@ func (self *SElasticcache) GetArchType() string {
|
||||
if strings.Contains(self.ResourceSpecCode, "proxy") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_CLUSTER
|
||||
}
|
||||
return ""
|
||||
return self.ResourceSpecCode
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetNodeType() string {
|
||||
@@ -447,7 +447,7 @@ func (self *SRegion) DeleteElasticcache(id string) error {
|
||||
}
|
||||
|
||||
func (self *SElasticcache) ChangeInstanceSpec(spec string) error {
|
||||
return cloudprovider.ErrNotImplemented
|
||||
return cloudprovider.ErrNotSupported
|
||||
}
|
||||
|
||||
// https://support.huaweicloud.com/api-dcs/dcs-zh-api-180423021.html
|
||||
|
||||
+3
-9
@@ -111,12 +111,7 @@ func (self *SElasticcache) Refresh() error {
|
||||
return errors.Wrap(err, "Elasticcache.Refresh.GetElasticCache")
|
||||
}
|
||||
|
||||
err = jsonutils.Update(self, cache)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Elasticcache.Refresh.Update")
|
||||
}
|
||||
|
||||
return nil
|
||||
return jsonutils.Update(self, cache)
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetStatus() string {
|
||||
@@ -186,15 +181,14 @@ func (self *SElasticcache) GetArchType() string {
|
||||
*/
|
||||
if strings.Contains(self.ResourceSpecCode, "single") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_SINGLE
|
||||
} else if strings.Contains(self.ResourceSpecCode, "ha") {
|
||||
} else if strings.Contains(self.ResourceSpecCode, "ha") || strings.Contains(self.ResourceSpecCode, "master") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_MASTER
|
||||
} else if strings.Contains(self.ResourceSpecCode, "cluster") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_CLUSTER
|
||||
} else if strings.Contains(self.ResourceSpecCode, "proxy") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_CLUSTER
|
||||
}
|
||||
|
||||
return ""
|
||||
return self.ResourceSpecCode
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetNodeType() string {
|
||||
|
||||
Reference in New Issue
Block a user