New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle RESOURCE_BUSY responses from CloudControl API #11

Closed
tintoy opened this Issue Aug 23, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@tintoy
Member

tintoy commented Aug 23, 2016

Sometimes CloudControl will indicate a transient problem due to resource contention by returning RESOURCE_BUSY. If that happens we should be able to retry operations.

For example, deploying a VLAN while another VLAN is being deployed for the same organisation will result in RESOURCE_BUSY. The provider should be able to retry the operation until it succeeds or times out.

  • Retry mechanism
  • Provider settings
    • Retry period
    • Retry timeout
  • ddcloud_vlan
    • Create
    • Delete
  • ddcloud_networkdomain
    • Create
    • Delete
  • ddcloud_nat
    • Create
    • Delete
  • ddcloud_firewall_rule
    • Create
    • Delete

Let's do something like:

var apiClient *compute.Client

var result string
err := retry.Action("Deploy VLAN", 3 * time.Minute, func(context retry.Context) {
  var e error
  result, e := apiClient.DeployVLAN(name, description, baseAddress, prefixSize)
  if e != nil {
    context.Fail(e)

    return
  }

  if isBusy(result) {
    context.Retry()
  }
}

if err != nil {
  return "", err
}

return result, nil
@tintoy

This comment has been minimized.

Show comment
Hide comment
@tintoy

tintoy Nov 27, 2016

Member

Have given this a quick test-drive, @mingsheng36, and it looks promising :)

Member

tintoy commented Nov 27, 2016

Have given this a quick test-drive, @mingsheng36, and it looks promising :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment