Skip to content

Commit

Permalink
fix(region): reset password for cloudpods baremetal (#20485)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Jun 7, 2024
1 parent cdd5977 commit ad5ae93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions pkg/compute/guestdrivers/cloudpods-baremetals.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion pkg/mcclient/cloudpods/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ad5ae93

Please sign in to comment.