Skip to content

Commit 3ec467b

Browse files
authored
Merge pull request #1235 from ioito/automated-cherry-pick-of-#1234-upstream-master
Automated cherry pick of #1234: fix(region): vm auto renew
2 parents 20810c7 + 3bfb488 commit 3ec467b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/multicloud/aliyun/instance.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,17 @@ func (region *SRegion) ModifyInstanceChargeType(vmId string, billingType string)
10271027
Count: 1,
10281028
Unit: billing.BillingCycleMonth,
10291029
}
1030-
region.SetInstanceAutoRenew(vmId, cycle)
1030+
err = cloudprovider.Wait(time.Second*10, time.Minute*3, func() (bool, error) {
1031+
err = region.SetInstanceAutoRenew(vmId, cycle)
1032+
if err != nil {
1033+
log.Errorf("set auto renew for instance %s error: %v", vmId, err)
1034+
return false, nil
1035+
}
1036+
return true, nil
1037+
})
1038+
if err != nil {
1039+
log.Errorf("set auto renew for %s error: %v", vmId, err)
1040+
}
10311041
}
10321042
return nil
10331043
}

0 commit comments

Comments
 (0)