mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-07-01 01:36:11 +08:00
fix: zstack reset passworkd with username
This commit is contained in:
@@ -276,7 +276,7 @@ type ICloudVM interface {
|
||||
|
||||
RebuildRoot(ctx context.Context, imageId string, passwd string, publicKey string, sysSizeGB int) (string, error)
|
||||
|
||||
DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error
|
||||
DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error
|
||||
|
||||
ChangeConfig(ctx context.Context, config *SManagedVMChangeConfig) error
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ func (self *SManagedVirtualizedGuestDriver) RemoteDeployGuestForDeploy(ctx conte
|
||||
desc.Password = ""
|
||||
}
|
||||
|
||||
e := iVM.DeployVM(ctx, desc.Name, desc.Password, desc.PublicKey, deleteKeypair, desc.Description)
|
||||
e := iVM.DeployVM(ctx, desc.Name, desc.Account, desc.Password, desc.PublicKey, deleteKeypair, desc.Description)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
@@ -459,7 +459,7 @@ func (self *SManagedVirtualizedGuestDriver) RemoteDeployGuestForDeploy(ctx conte
|
||||
//解绑秘钥后需要重置密码
|
||||
if deleteKeypair {
|
||||
desc.Password = seclib2.RandomPassword2(12)
|
||||
return iVM.DeployVM(ctx, desc.Name, desc.Password, desc.PublicKey, false, desc.Description)
|
||||
return iVM.DeployVM(ctx, desc.Name, desc.Account, desc.Password, desc.PublicKey, false, desc.Description)
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
|
||||
@@ -484,7 +484,7 @@ func (self *SInstance) UpdateVM(ctx context.Context, name string) error {
|
||||
return self.host.zone.region.UpdateVM(self.InstanceId, name)
|
||||
}
|
||||
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
var keypairName string
|
||||
if len(publicKey) > 0 {
|
||||
var err error
|
||||
|
||||
@@ -460,7 +460,7 @@ func (self *SInstance) RebuildRoot(ctx context.Context, imageId string, passwd s
|
||||
return diskId, nil
|
||||
}
|
||||
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
return self.host.zone.region.DeployVM(self.InstanceId, name, password, publicKey, deleteKeypair, description)
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ func (self *SClassicInstance) ChangeConfig(ctx context.Context, config *cloudpro
|
||||
return cloudprovider.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (self *SClassicInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SClassicInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
return cloudprovider.ErrNotImplemented
|
||||
//return self.host.zone.region.DeployVM(self.ID, name, password, publicKey, deleteKeypair, description)
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ func (region *SRegion) ChangeVMConfig(ctx context.Context, instanceId string, nc
|
||||
return instacen.ChangeConfig(ctx, &cloudprovider.SManagedVMChangeConfig{Cpu: ncpu, MemoryMB: vmem})
|
||||
}
|
||||
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
if len(publicKey) > 0 || len(password) > 0 {
|
||||
// 先判断系统是否安装了vmAgent,然后等待扩展准备完成后再重置密码
|
||||
err := self.WaitEnableVMAccessReady()
|
||||
|
||||
@@ -133,7 +133,7 @@ func (self *SVirtualMachine) GetInstanceType() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SVirtualMachine) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SVirtualMachine) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
return cloudprovider.ErrNotImplemented
|
||||
}
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ func (self *SInstance) RebuildRoot(ctx context.Context, imageId string, passwd s
|
||||
return idisks[0].GetId(), nil
|
||||
}
|
||||
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
return self.host.zone.region.DeployVM(self.GetId(), name, password, publicKey, deleteKeypair, description)
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ func (instance *SInstance) GetVNCInfo() (jsonutils.JSONObject, error) {
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (instance *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (instance *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
return instance.host.zone.region.DeployVM(instance.ID, name, password, publicKey, deleteKeypair, description)
|
||||
}
|
||||
|
||||
|
||||
@@ -422,7 +422,7 @@ func (self *SInstance) UpdateVM(ctx context.Context, name string) error {
|
||||
return self.host.zone.region.UpdateVM(self.InstanceId, name)
|
||||
}
|
||||
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
var keypairName string
|
||||
if len(publicKey) > 0 {
|
||||
var err error
|
||||
|
||||
@@ -477,7 +477,7 @@ func (self *SInstance) RebuildRoot(ctx context.Context, imageId string, passwd s
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (self *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
if len(publicKey) > 0 {
|
||||
return fmt.Errorf("DeployVM not support assign ssh keypair")
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ func (region *SRegion) UpdateVM(instanceId string, params jsonutils.JSONObject)
|
||||
return err
|
||||
}
|
||||
|
||||
func (instance *SInstance) DeployVM(ctx context.Context, name string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
func (instance *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
|
||||
if instance.Name != name || instance.Description != description {
|
||||
params := map[string]interface{}{
|
||||
"updateVmInstance": map[string]string{
|
||||
@@ -349,7 +349,7 @@ func (instance *SInstance) DeployVM(ctx context.Context, name string, password s
|
||||
if len(password) > 0 {
|
||||
params := map[string]interface{}{
|
||||
"changeVmPassword": map[string]string{
|
||||
"account": api.VM_ZSTACK_DEFAULT_LOGIN_USER,
|
||||
"account": username,
|
||||
"password": password,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user