Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(194)

Issue 6920045: Retry OpenStack requests when throttled (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 5 months ago by wallyworld
Modified:
11 years, 5 months ago
Reviewers:
mp+139141
Visibility:
Public.

Description

Retry OpenStack requests when throttled When making a request to OpenStack, it may fail with a 413 if too many requests have been made in a period of time. In such cases, the response headers will contain a Retry-After value indicating that the client and resend the request after X seconds. This branch enhances the Goose HTTP client to seamlessly retry the request up to 3 times before it gives up. Note that other times a 413 may be returned is when a resource limit truly has been exceeded, eg creating a floating ip adress. In this case, the request is not resent and the call fails immediately. A fair bit of refactoring in the HTTP client was required to get things in place to allow the request to be retried. I also modified the nova test suite to support live and local testing so that I could ensure the test double could be made to generate 413s but then found that the nova test double stuff is not quite all landed yet. The new testing stuff has been left in place though for when everything catches up. I needed to capture the log output in the new test so added a Logger attribute to the HTTP client. If no logger is passed in, it defaults to the std Go logger. The retry stuff in this branch fixes some previously broken tests. I modified the remaining broken tests to make them all pass against the live system. The only ones that fail now are the floating ip ones and then only if some ip addresses are allocated and left hanging around before the test is run. We can look to make the tests clean up these perhaps. https://code.launchpad.net/~wallyworld/goose/rate-limit-retries/+merge/139141 Requires: https://code.launchpad.net/~wallyworld/goose/improved-error-handling/+merge/138394 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 22

Patch Set 2 : Retry OpenStack requests when throttled #

Patch Set 3 : Retry OpenStack requests when throttled #

Patch Set 4 : Retry OpenStack requests when throttled #

Unified diffs Side-by-side diffs Delta from patch set Stats (+659 lines, -465 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M client/client.go View 1 2 3 4 chunks +5 lines, -3 lines 0 comments Download
M client/live_test.go View 1 chunk +2 lines, -2 lines 0 comments Download
M glance/glance_test.go View 1 chunk +1 line, -1 line 0 comments Download
M http/client.go View 1 2 3 9 chunks +87 lines, -50 lines 0 comments Download
M identity/userpass.go View 1 chunk +1 line, -1 line 0 comments Download
A nova/live_test.go View 1 2 3 1 chunk +454 lines, -0 lines 0 comments Download
A nova/local_test.go View 1 chunk +71 lines, -0 lines 0 comments Download
M nova/nova.go View 1 2 3 4 chunks +24 lines, -4 lines 0 comments Download
M nova/nova_test.go View 1 2 3 1 chunk +11 lines, -403 lines 0 comments Download
M swift/live_test.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6
wallyworld
Please take a look.
11 years, 5 months ago (2012-12-11 04:23:07 UTC) #1
wallyworld
Please take a look.
11 years, 5 months ago (2012-12-12 03:32:37 UTC) #2
jameinel
I did this review yesterday, but it looks like it didn't get sent properly. So ...
11 years, 5 months ago (2012-12-12 08:47:26 UTC) #3
wallyworld
Please take a look. https://codereview.appspot.com/6920045/diff/1/http/client.go File http/client.go (right): https://codereview.appspot.com/6920045/diff/1/http/client.go#newcode87 http/client.go:87: headers.Add("Accept", "application/json") On 2012/12/12 08:47:26, ...
11 years, 5 months ago (2012-12-13 01:59:48 UTC) #4
jameinel
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 ... > > https://codereview.appspot.com/6920045/diff/1/nova/live_test.go#newcode21 > > nova/live_test.go:21: ) > ...
11 years, 5 months ago (2012-12-13 10:05:17 UTC) #5
wallyworld
11 years, 5 months ago (2012-12-19 07:13:13 UTC) #6
*** Submitted:

Retry OpenStack requests when throttled

When making a request to OpenStack, it may fail with a 413 if too many requests
have been made in a period of time. In such cases, the response headers
will contain a Retry-After value indicating that the client and resend the
request after X seconds. This branch enhances the Goose HTTP client to
seamlessly
retry the request up to 3 times before it gives up.

Note that other times a 413 may be returned is when a resource limit truly has
been exceeded, eg creating a floating ip adress. In this case, the request is
not
resent and the call fails immediately.

A fair bit of refactoring in the HTTP client was required to get things in place
to allow the request to be retried. I also modified the nova test suite to
support
live and local testing so that I could ensure the test double could be made to
generate 413s but then found that the nova test double stuff is not quite all
landed yet. The
new testing stuff has been left in place though for when everything catches up.

I needed to capture the log output in the new test so added a Logger attribute
to the HTTP client. If no logger is passed in, it defaults to the std Go logger.

The retry stuff in this branch fixes some previously broken tests. I modified
the remaining broken tests to make them all pass against the live system. 
The only ones that fail now are the floating ip ones and then only if some ip
addresses are allocated and left hanging around before the test is run.
We can look to make the tests clean up these perhaps.

R=jameinel
CC=
https://codereview.appspot.com/6920045
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b