Merge branch 'bugfix/qx-azure-keypair' of ssh://git.yunion.io/~quxuan/onecloud into release/2.4.0

This commit is contained in:
屈轩
2018-11-14 15:42:39 +08:00
5 changed files with 12 additions and 3 deletions
+4
View File
@@ -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
+4
View File
@@ -120,6 +120,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")
}
+1
View File
@@ -88,6 +88,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
+2 -2
View File
@@ -1975,10 +1975,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 kwargs.Contains("keypair") {
+1 -1
View File
@@ -668,7 +668,7 @@ func (region *SRegion) DeployVM(instanceId, name, password, publicKey string, de
return nil
}
if len(publicKey) > 0 {
err = region.resetPublicKey(instanceId, instance.Properties.OsProfile.AdminUsername, publicKey)
return region.resetPublicKey(instanceId, instance.Properties.OsProfile.AdminUsername, publicKey)
}
return region.resetPassword(instanceId, instance.Properties.OsProfile.AdminUsername, password)
}