From 90a541b9bf77dad72b55a2d3f8cd74d0dab7af39 Mon Sep 17 00:00:00 2001 From: TangBin Date: Tue, 14 Jan 2020 10:12:42 +0800 Subject: [PATCH] aws backendgroup delete bugfix --- pkg/cloudprovider/waitstatus.go | 5 +++++ pkg/compute/regiondrivers/aws.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/cloudprovider/waitstatus.go b/pkg/cloudprovider/waitstatus.go index e098173954..c591748073 100644 --- a/pkg/cloudprovider/waitstatus.go +++ b/pkg/cloudprovider/waitstatus.go @@ -61,6 +61,11 @@ func WaitStatusWithInstanceErrorCheck(res ICloudResource, expect string, interva return ErrTimeout } +func WaitDeletedWithDelay(res ICloudResource, delay time.Duration, interval time.Duration, timeout time.Duration) error { + time.Sleep(delay) + return WaitDeleted(res, interval, timeout) +} + func WaitDeleted(res ICloudResource, interval time.Duration, timeout time.Duration) error { startTime := time.Now() for time.Now().Sub(startTime) < timeout { diff --git a/pkg/compute/regiondrivers/aws.go b/pkg/compute/regiondrivers/aws.go index 46672ee426..4e9926bc38 100644 --- a/pkg/compute/regiondrivers/aws.go +++ b/pkg/compute/regiondrivers/aws.go @@ -20,6 +20,7 @@ import ( "fmt" "regexp" "strings" + "time" "yunion.io/x/jsonutils" "yunion.io/x/pkg/errors" @@ -1217,6 +1218,11 @@ func (self *SAwsRegionDriver) RequestDeleteLoadbalancer(ctx context.Context, use } } + err = cloudprovider.WaitDeletedWithDelay(iLoadbalancer, 10*time.Second, 10*time.Second, 60*time.Second) + if err != nil { + return nil, errors.Wrap(err, "AwsRegionDriver.RequestDeleteLoadbalancer.WaitDeleted") + } + // delete backendgroups { // delete remote lbbgs