diff --git a/pkg/cloudprovider/resources.go b/pkg/cloudprovider/resources.go index f1a96a305c..93da3ed59f 100644 --- a/pkg/cloudprovider/resources.go +++ b/pkg/cloudprovider/resources.go @@ -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 diff --git a/pkg/compute/guestdrivers/managedvirtual.go b/pkg/compute/guestdrivers/managedvirtual.go index c380cea5d5..2085346981 100644 --- a/pkg/compute/guestdrivers/managedvirtual.go +++ b/pkg/compute/guestdrivers/managedvirtual.go @@ -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 }() diff --git a/pkg/multicloud/aliyun/instance.go b/pkg/multicloud/aliyun/instance.go index 17372ffae8..3dcf3e1d8b 100644 --- a/pkg/multicloud/aliyun/instance.go +++ b/pkg/multicloud/aliyun/instance.go @@ -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 diff --git a/pkg/multicloud/aws/instance.go b/pkg/multicloud/aws/instance.go index 260ea0fe26..c363a26842 100644 --- a/pkg/multicloud/aws/instance.go +++ b/pkg/multicloud/aws/instance.go @@ -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) } diff --git a/pkg/multicloud/azure/classic_instance.go b/pkg/multicloud/azure/classic_instance.go index 912471405c..1f3ff202fc 100644 --- a/pkg/multicloud/azure/classic_instance.go +++ b/pkg/multicloud/azure/classic_instance.go @@ -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) } diff --git a/pkg/multicloud/azure/instance.go b/pkg/multicloud/azure/instance.go index 919507fa2e..d886e0b28d 100644 --- a/pkg/multicloud/azure/instance.go +++ b/pkg/multicloud/azure/instance.go @@ -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() diff --git a/pkg/multicloud/esxi/virtualmachine.go b/pkg/multicloud/esxi/virtualmachine.go index dcff9c28aa..b5c2953c15 100644 --- a/pkg/multicloud/esxi/virtualmachine.go +++ b/pkg/multicloud/esxi/virtualmachine.go @@ -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 } diff --git a/pkg/multicloud/huawei/instance.go b/pkg/multicloud/huawei/instance.go index c20d48aecb..ad64735860 100644 --- a/pkg/multicloud/huawei/instance.go +++ b/pkg/multicloud/huawei/instance.go @@ -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) } diff --git a/pkg/multicloud/openstack/instance.go b/pkg/multicloud/openstack/instance.go index 48a71e220b..8a2ea48e02 100644 --- a/pkg/multicloud/openstack/instance.go +++ b/pkg/multicloud/openstack/instance.go @@ -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) } diff --git a/pkg/multicloud/qcloud/instance.go b/pkg/multicloud/qcloud/instance.go index 466ea3dee0..bf1e95ce38 100644 --- a/pkg/multicloud/qcloud/instance.go +++ b/pkg/multicloud/qcloud/instance.go @@ -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 diff --git a/pkg/multicloud/ucloud/instance.go b/pkg/multicloud/ucloud/instance.go index 817ea28923..d56d442278 100644 --- a/pkg/multicloud/ucloud/instance.go +++ b/pkg/multicloud/ucloud/instance.go @@ -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") } diff --git a/pkg/multicloud/zstack/instance.go b/pkg/multicloud/zstack/instance.go index 7e247b31f9..9f9c0d2f0a 100644 --- a/pkg/multicloud/zstack/instance.go +++ b/pkg/multicloud/zstack/instance.go @@ -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, }, }