From 630d2518b171eab4b7432c07a9e2dfb01d4277b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Sat, 5 Jan 2019 11:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=85=BE=E8=AE=AF=E4=BA=91?= =?UTF-8?q?=E6=97=A0=E9=99=90=E5=88=A0=E9=99=A4=E9=A2=84=E4=BB=98=E8=B4=B9?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/qcloud/instance.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/util/qcloud/instance.go b/pkg/util/qcloud/instance.go index e3b370ba64..4bf14fe318 100644 --- a/pkg/util/qcloud/instance.go +++ b/pkg/util/qcloud/instance.go @@ -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 }