mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #5247 from ioito/hotfix/qx-azure-change-config-error
fix: 返回azure api 错误信息
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/osprofile"
|
||||
|
||||
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
|
||||
@@ -611,19 +612,21 @@ func (self *SInstance) ChangeConfig(ctx context.Context, config *cloudprovider.S
|
||||
if len(config.InstanceType) > 0 {
|
||||
return self.ChangeConfig2(ctx, config.InstanceType)
|
||||
}
|
||||
var err error
|
||||
status := self.GetStatus()
|
||||
for _, vmSize := range self.host.zone.region.getHardwareProfile(config.Cpu, config.MemoryMB) {
|
||||
self.Properties.HardwareProfile.VMSize = vmSize
|
||||
self.Properties.ProvisioningState = ""
|
||||
self.Properties.InstanceView = nil
|
||||
log.Debugf("Try HardwareProfile : %s", vmSize)
|
||||
err := self.host.zone.region.client.Update(jsonutils.Marshal(self), nil)
|
||||
err = self.host.zone.region.client.Update(jsonutils.Marshal(self), nil)
|
||||
if err == nil {
|
||||
return cloudprovider.WaitStatus(self, status, 10*time.Second, 300*time.Second)
|
||||
} else {
|
||||
log.Debugf("ChangeConfig %s", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "client.Update")
|
||||
}
|
||||
return fmt.Errorf("Failed to change vm config, specification not supported")
|
||||
}
|
||||
|
||||
@@ -634,13 +637,10 @@ func (self *SInstance) ChangeConfig2(ctx context.Context, instanceType string) e
|
||||
self.Properties.InstanceView = nil
|
||||
log.Debugf("Try HardwareProfile : %s", instanceType)
|
||||
err := self.host.zone.region.client.Update(jsonutils.Marshal(self), nil)
|
||||
if err == nil {
|
||||
return cloudprovider.WaitStatus(self, status, 10*time.Second, 300*time.Second)
|
||||
} else {
|
||||
log.Errorf("ChangeConfig2 %s", err)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "client.Update")
|
||||
}
|
||||
|
||||
return fmt.Errorf("Failed to change vm config, specification not supported")
|
||||
return cloudprovider.WaitStatus(self, status, 10*time.Second, 300*time.Second)
|
||||
}
|
||||
|
||||
func (region *SRegion) ChangeVMConfig2(ctx context.Context, instanceId string, instanceType string) error {
|
||||
|
||||
Reference in New Issue
Block a user