mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
huawei config vm config fix
This commit is contained in:
@@ -20,11 +20,9 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
errors2 "yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
@@ -362,7 +360,7 @@ func (self *SManagedVirtualizedGuestDriver) RequestDeployGuestOnHost(ctx context
|
||||
}
|
||||
|
||||
if sku == nil {
|
||||
return errors.Wrap(errors2.ErrNotFound, "ManagedVirtualizedGuestDriver.RequestDeployGuestOnHost.GetMatchedSku")
|
||||
return errors.Wrap(errors.ErrNotFound, "ManagedVirtualizedGuestDriver.RequestDeployGuestOnHost.GetMatchedSku")
|
||||
}
|
||||
|
||||
desc.InstanceType = sku.Name
|
||||
@@ -741,7 +739,7 @@ func (self *SManagedVirtualizedGuestDriver) RequestChangeVmConfig(ctx context.Co
|
||||
}
|
||||
|
||||
if sku == nil {
|
||||
return errors.Wrap(errors2.ErrNotFound, "ManagedVirtualizedGuestDriver.RequestChangeVmConfig.GetMatchedSku")
|
||||
return errors.Wrap(errors.ErrNotFound, "ManagedVirtualizedGuestDriver.RequestChangeVmConfig.GetMatchedSku")
|
||||
}
|
||||
|
||||
instanceType = sku.Name
|
||||
@@ -755,7 +753,7 @@ func (self *SManagedVirtualizedGuestDriver) RequestChangeVmConfig(ctx context.Co
|
||||
}
|
||||
err := iVM.ChangeConfig(ctx, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "GuestDriver.RequestChangeVmConfig.ChangeConfig")
|
||||
}
|
||||
|
||||
err = cloudprovider.WaitCreated(time.Second*5, time.Minute*5, func() bool {
|
||||
@@ -778,7 +776,7 @@ func (self *SManagedVirtualizedGuestDriver) RequestChangeVmConfig(ctx context.Co
|
||||
return false
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "GuestDriver.RequestChangeVmConfig.WaitCreated")
|
||||
}
|
||||
|
||||
instanceType = iVM.GetInstanceType()
|
||||
@@ -788,7 +786,7 @@ func (self *SManagedVirtualizedGuestDriver) RequestChangeVmConfig(ctx context.Co
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "GuestDriver.RequestChangeVmConfig.Update")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/osprofile"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
@@ -590,10 +589,15 @@ func (self *SInstance) ChangeConfig(ctx context.Context, config *cloudprovider.S
|
||||
func (self *SInstance) ChangeConfig2(ctx context.Context, instanceType string) error {
|
||||
err := self.host.zone.region.ChangeVMConfig2(self.OSEXTAZAvailabilityZone, self.GetId(), instanceType, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "Instance.ChangeConfig2.ChangeVMConfig2")
|
||||
}
|
||||
|
||||
return cloudprovider.WaitStatusWithDelay(self, api.VM_READY, 15*time.Second, 15*time.Second, 180*time.Second)
|
||||
err = cloudprovider.WaitStatusWithDelay(self, api.VM_READY, 15*time.Second, 15*time.Second, 180*time.Second)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Instance.ChangeConfig2.WaitStatusWithDelay")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// todo:// 返回jsonobject感觉很诡异。不能直接知道内部细节
|
||||
|
||||
Reference in New Issue
Block a user