From a894da86e77396b8fa1fa73500f2b9a2b174c53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Fri, 6 Dec 2024 18:09:51 +0800 Subject: [PATCH] fix(region): keep cloudpods vm empty password (#21758) --- pkg/mcclient/cloudpods/instance.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/mcclient/cloudpods/instance.go b/pkg/mcclient/cloudpods/instance.go index 66f79674e2..e0bb447d90 100644 --- a/pkg/mcclient/cloudpods/instance.go +++ b/pkg/mcclient/cloudpods/instance.go @@ -497,13 +497,17 @@ func (self *SRegion) CreateInstance(hostId, hypervisor string, opts *cloudprovid input := api.ServerCreateInput{ ServerConfigs: &api.ServerConfigs{}, } - input.Name = opts.Name + input.GenerateName = opts.Name input.Hostname = opts.Hostname input.Description = opts.Description input.InstanceType = opts.InstanceType input.VcpuCount = opts.Cpu input.VmemSize = opts.MemoryMB input.Password = opts.Password + if len(input.Password) == 0 { + resetPasswd := false + input.ResetPassword = &resetPasswd + } input.PublicIpBw = opts.PublicIpBw input.PublicIpChargeType = string(opts.PublicIpChargeType) input.ProjectId = opts.ProjectId