mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #889 in YUNIONIO/onecloud from ~QUXUAN/onecloud:hotfix/qx-qcloud-delete-vm to release/2.4.0
* commit '630d2518b171eab4b7432c07a9e2dfb01d4277b2': 修复腾讯云无限删除预付费实例失败问题
This commit is contained in:
@@ -628,19 +628,8 @@ func (self *SRegion) DeployVM(instanceId string, name string, password string, k
|
||||
}
|
||||
|
||||
func (self *SInstance) DeleteVM(ctx context.Context) error {
|
||||
for {
|
||||
err := self.host.zone.region.DeleteVM(self.InstanceId)
|
||||
if err != nil {
|
||||
if isError(err, []string{"InvalidInstance.NotSupported", "MutexOperation.TaskRunning"}) {
|
||||
log.Infof("The instance is initializing, try later ...")
|
||||
time.Sleep(10 * time.Second)
|
||||
} else {
|
||||
log.Errorf("DeleteVM fail: %s", err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
if err := self.host.zone.region.DeleteVM(self.InstanceId); err != nil {
|
||||
return err
|
||||
}
|
||||
return cloudprovider.WaitDeleted(self, 10*time.Second, 300*time.Second) // 5minutes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user