mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
避免Azure绑定秘钥时stop机器
This commit is contained in:
@@ -71,6 +71,10 @@ func (self *SAzureGuestDriver) GetDeployStatus() ([]string, error) {
|
||||
return []string{models.VM_RUNNING}, nil
|
||||
}
|
||||
|
||||
func (self *SAzureGuestDriver) IsNeedRestartForResetLoginInfo() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *SAzureGuestDriver) ValidateResizeDisk(guest *models.SGuest, disk *models.SDisk, storage *models.SStorage) error {
|
||||
//https://docs.microsoft.com/en-us/rest/api/compute/disks/update
|
||||
//Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size
|
||||
|
||||
@@ -119,6 +119,10 @@ func (self *SBaseGuestDriver) GetDeployStatus() ([]string, error) {
|
||||
return []string{}, fmt.Errorf("This Guest driver dose not implement GetDeployStatus")
|
||||
}
|
||||
|
||||
func (self *SBaseGuestDriver) IsNeedRestartForResetLoginInfo() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (self *SBaseGuestDriver) RequestDeleteDetachedDisk(ctx context.Context, disk *models.SDisk, task taskman.ITask, isPurge bool) error {
|
||||
return fmt.Errorf("Not Implement")
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ type IGuestDriver interface {
|
||||
GetDeployStatus() ([]string, error)
|
||||
ValidateResizeDisk(guest *SGuest, disk *SDisk, storage *SStorage) error
|
||||
CanKeepDetachDisk() bool
|
||||
IsNeedRestartForResetLoginInfo() bool
|
||||
|
||||
RequestDeleteDetachedDisk(ctx context.Context, disk *SDisk, task taskman.ITask, isPurge bool) error
|
||||
StartGuestDetachdiskTask(ctx context.Context, userCred mcclient.TokenCredential, guest *SGuest, params *jsonutils.JSONDict, parentTaskId string) error
|
||||
|
||||
@@ -1916,10 +1916,10 @@ func (self *SGuest) PerformDeploy(ctx context.Context, userCred mcclient.TokenCr
|
||||
return nil, fmt.Errorf("Parse query body error")
|
||||
}
|
||||
|
||||
// 变更密码/密钥时需要Restart才能生效。更新普通字段不需要Restart
|
||||
// 变更密码/密钥时需要Restart才能生效。更新普通字段不需要Restart, Azure需要在运行状态下操作
|
||||
doRestart := false
|
||||
if kwargs.Contains("__delete_keypair__") || kwargs.Contains("keypair") {
|
||||
doRestart = true
|
||||
doRestart = self.GetDriver().IsNeedRestartForResetLoginInfo()
|
||||
var kpId string
|
||||
if !jsonutils.QueryBoolean(kwargs, "__delete_keypair__", false) {
|
||||
keypair, _ := kwargs.GetString("keypair")
|
||||
|
||||
Reference in New Issue
Block a user