fix(region): cloudpods deploy api (#19447)

This commit is contained in:
屈轩
2024-02-05 11:23:45 +08:00
committed by GitHub
parent f3f9fa9886
commit 0c4b30335b
+2 -1
View File
@@ -282,6 +282,7 @@ func (self *SInstance) RebuildRoot(ctx context.Context, opts *cloudprovider.SMan
func (self *SInstance) DeployVM(ctx context.Context, opts *cloudprovider.SInstanceDeployOptions) error {
input := api.ServerDeployInput{}
input.Password = opts.Password
input.DeleteKeypair = opts.DeleteKeypair
if len(opts.PublicKey) > 0 {
keypairId, err := self.host.zone.region.syncKeypair(self.Name, opts.PublicKey)
if err != nil {
@@ -289,7 +290,7 @@ func (self *SInstance) DeployVM(ctx context.Context, opts *cloudprovider.SInstan
}
input.KeypairId = keypairId
}
cloudprovider.WaitMultiStatus(self, []string{api.VM_READY, api.VM_RUNNING}, time.Second*5, time.Minute*3)
_, err := self.host.zone.region.perform(&modules.Servers, self.Id, "deploy", input)
if err != nil {
return errors.Wrapf(err, "deploy")