mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
Automatic merge from release/2.2.0 -> release/2.3.0
* commit '3d13c99799c7c73f86b4aeb32a946e3b2eea9ab0': 避免更新Azure guest名称
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/util/seclib2"
|
||||
"yunion.io/x/pkg/utils"
|
||||
@@ -89,7 +90,25 @@ func (self *SAzureGuestDriver) RequestDetachDisk(ctx context.Context, guest *mod
|
||||
}
|
||||
|
||||
func (self *SAzureGuestDriver) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
|
||||
return self.SManagedVirtualizedGuestDriver.ValidateCreateData(ctx, userCred, data)
|
||||
data, err := self.SManagedVirtualizedGuestDriver.ValidateCreateData(ctx, userCred, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if data.Contains("net.0") && data.Contains("net.1") {
|
||||
return nil, httperrors.NewInputParameterError("cannot support more than 1 nic")
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (self *SAzureGuestDriver) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
|
||||
data, err := self.SManagedVirtualizedGuestDriver.ValidateCreateData(ctx, userCred, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if data.Contains("name") {
|
||||
return nil, httperrors.NewInputParameterError("cannot support change azure instance name")
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (self *SAzureGuestDriver) RequestDeployGuestOnHost(ctx context.Context, guest *models.SGuest, host *models.SHost, task taskman.ITask) error {
|
||||
|
||||
@@ -116,6 +116,10 @@ func (self *SBaseGuestDriver) ValidateResizeDisk(guest *models.SGuest, disk *mod
|
||||
return fmt.Errorf("This Guest driver dose not implement ValidateResizeDisk")
|
||||
}
|
||||
|
||||
func (self *SBaseGuestDriver) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (self *SBaseGuestDriver) GetDeployStatus() ([]string, error) {
|
||||
return []string{}, fmt.Errorf("This Guest driver dose not implement GetDeployStatus")
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ type IGuestDriver interface {
|
||||
|
||||
ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
|
||||
|
||||
ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
|
||||
|
||||
ValidateCreateHostData(ctx context.Context, userCred mcclient.TokenCredential, bmName string, host *SHost, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)
|
||||
|
||||
PrepareDiskRaidConfig(host *SHost, params *jsonutils.JSONDict) error
|
||||
|
||||
@@ -579,6 +579,11 @@ func (self *SGuest) ValidateUpdateData(ctx context.Context, userCred mcclient.To
|
||||
data.Add(jsonutils.NewInt(int64(vcpuCount)), "vcpu_count")
|
||||
}
|
||||
|
||||
data, err = self.GetDriver().ValidateUpdateData(ctx, userCred, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = self.checkUpdateQuota(ctx, userCred, vcpuCount, vmemSize)
|
||||
if err != nil {
|
||||
return nil, httperrors.NewOutOfQuotaError(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user