fix(region): reset password for cloudpods baremetal (#20486)

This commit is contained in:
屈轩
2024-06-07 15:06:31 +08:00
committed by GitHub
parent a307cc9196
commit 0359bb2ac2
2 changed files with 14 additions and 5 deletions
@@ -401,13 +401,14 @@ func (self *SCloudpodsBaremetalGuestDriver) RequestDeployGuestOnHost(ctx context
log.Debugf("%s baremetal config: %s", val, jsonutils.Marshal(desc).String())
iHost, err := host.GetIHost(ctx)
if err != nil {
return err
}
switch val {
case "create":
taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) {
iHost, err := host.GetIHost(ctx)
if err != nil {
return nil, err
}
h := iHost.(*cloudpods.SHost)
opts := &api.ServerCreateInput{
ServerConfigs: &api.ServerConfigs{},
@@ -485,6 +486,10 @@ func (self *SCloudpodsBaremetalGuestDriver) RequestDeployGuestOnHost(ctx context
data := fetchIVMinfo(desc, iVM, guest.Id, desc.Account, desc.Password, desc.PublicKey, "create")
return data, nil
})
case "deploy":
taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) {
return self.SManagedVirtualizedGuestDriver.RemoteDeployGuestForDeploy(ctx, guest, iHost, task, desc)
})
case "rebuild":
taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) {
iVm, err := guest.GetIVM(ctx)
+5 -1
View File
@@ -295,7 +295,11 @@ func (self *SInstance) DeployVM(ctx context.Context, opts *cloudprovider.SInstan
if err != nil {
return errors.Wrapf(err, "deploy")
}
return cloudprovider.WaitMultiStatus(self, []string{api.VM_READY, api.VM_RUNNING}, time.Second*5, time.Minute*3)
timeout := time.Minute * 3
if self.Hypervisor == api.HYPERVISOR_BAREMETAL {
timeout = time.Minute * 10
}
return cloudprovider.WaitMultiStatus(self, []string{api.VM_READY, api.VM_RUNNING}, time.Second*5, timeout)
}
func (self *SInstance) ChangeConfig(ctx context.Context, opts *cloudprovider.SManagedVMChangeConfig) error {