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

Issue 12795045: HPCloud: Don't incorrectly return ErrNoInstances.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by Michael Nelson
Modified:
10 years, 8 months ago
Reviewers:
dimitern, jameinel, fwereade, mp+179899
Visibility:
Public.

Description

HPCloud: Don't incorrectly return ErrNoInstances. So this is attempt 2 - with the knowledge that when environ.Instances() returns ErrNoInstances we should not keep polling. Checking the time details on the bug [1] shows that the ErrNoInstances was returned after only 3 seconds - much shorter than the shortAttempt in environs/openstack/provider.go. It turns out that e.collectInstances() is erronously returning missing = [] when it finds a server, but that server doesn't have an expected status of BUILD or ACTIV. Moving the continue ensures that if the server is found but has the incorrect status, it is included in the returned missing slice. I would also like to explicitly test this change to collectInstances, but can't see a way to test the unexposed function from environs.openstack.local_tests.go [2]. The added test ensures simply that we do return for a BUILD(spawning) server. Testing the `juju -v bootstrap && juju -v status` 10 times showed that HPClound would get to BUILD(spawning) in around 9.1 seconds, so I've increased the shortTimeout slightly to 15. Let me know if you prefer something smaller. Other things I tried: * Avoiding the increased shortAttempt by checking for: strings.HasPrefix(server.Status, nova.StatusBuild) Testing shows that HPCloud returns not "BUILD", but rather "BUILD(networking)" and "BUILD(spawning)" [4]. But this had one main issue in that we'd return with BUILD(networking) which is before the server has a public IP address. [1] https://bugs.launchpad.net/juju-core/+bug/1208504 [2] http://paste.ubuntu.com/6002418/ [3] http://paste.ubuntu.com/5988133/ [4] See http://docs.hpcloud.com/api/compute#ServerStates (past where it states the possible values :-)) https://code.launchpad.net/~michael.nelson/juju-core/1208504-post-bootstrap-hp-no-instances-found-try2/+merge/179899 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : Openstack instance is missing if not Active/Build #

Patch Set 3 : Openstack instance is missing if not Active/Build #

Patch Set 4 : Openstack instance is missing if not Active/Build #

Patch Set 5 : Openstack instance is missing if not Active/Build #

Patch Set 6 : HPCloud: Don't incorrectly return ErrNoInstances. #

Total comments: 4

Patch Set 7 : HPCloud: Don't incorrectly return ErrNoInstances. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+63 lines, -7 lines) Patch
A [revision details] View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M dependencies.tsv View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M environs/openstack/export_test.go View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M environs/openstack/local_test.go View 1 2 3 4 5 6 1 chunk +47 lines, -0 lines 0 comments Download
M environs/openstack/provider.go View 1 2 3 2 chunks +9 lines, -6 lines 0 comments Download

Messages

Total messages: 13
Michael Nelson
Please take a look.
10 years, 8 months ago (2013-08-13 13:02:18 UTC) #1
jameinel
did you get a chance to test this live? It seems like we would want ...
10 years, 8 months ago (2013-08-13 13:29:39 UTC) #2
Michael Nelson
On 2013/08/13 13:29:39, jameinel wrote: > did you get a chance to test this live? ...
10 years, 8 months ago (2013-08-13 13:39:31 UTC) #3
fwereade
I think I'm ok with the change in itself, but... *surely* there's a test for ...
10 years, 8 months ago (2013-08-13 17:18:25 UTC) #4
jameinel
NOT LGTM testing this live showed that it didn't actually fix the problem. (juju bootstrap ...
10 years, 8 months ago (2013-08-14 10:22:23 UTC) #5
Michael Nelson
On 2013/08/14 10:22:23, jameinel wrote: > NOT LGTM > > testing this live showed that ...
10 years, 8 months ago (2013-08-15 08:48:29 UTC) #6
Michael Nelson
Please take a look.
10 years, 8 months ago (2013-08-15 14:48:53 UTC) #7
Michael Nelson
Please take a look.
10 years, 8 months ago (2013-08-19 11:01:59 UTC) #8
jameinel
The standard way to test an 'unexported' function inside its own package tests is to ...
10 years, 8 months ago (2013-08-19 12:39:54 UTC) #9
Michael Nelson
On 2013/08/19 12:39:54, jameinel wrote: > The standard way to test an 'unexported' function inside ...
10 years, 8 months ago (2013-08-19 13:00:18 UTC) #10
Michael Nelson
Please take a look.
10 years, 8 months ago (2013-08-19 13:07:11 UTC) #11
dimitern
Just a couple of comments. https://codereview.appspot.com/12795045/diff/26001/environs/openstack/local_test.go File environs/openstack/local_test.go (right): https://codereview.appspot.com/12795045/diff/26001/environs/openstack/local_test.go#newcode403 environs/openstack/local_test.go:403: // HP servers are ...
10 years, 8 months ago (2013-08-19 13:29:36 UTC) #12
Michael Nelson
10 years, 8 months ago (2013-08-19 13:47:21 UTC) #13
Please take a look.

https://codereview.appspot.com/12795045/diff/26001/environs/openstack/local_t...
File environs/openstack/local_test.go (right):

https://codereview.appspot.com/12795045/diff/26001/environs/openstack/local_t...
environs/openstack/local_test.go:403: // HP servers are available once they are
BUILD(spawning).
On 2013/08/19 13:29:36, dimitern wrote:
> Please put this comment as a first line of the function, since it's not a doc
> comment.

Done.

https://codereview.appspot.com/12795045/diff/26001/environs/openstack/local_t...
environs/openstack/local_test.go:423: c.Assert(len(instances), Equals, 1)
On 2013/08/19 13:29:36, dimitern wrote:
> c.Assert(instance, HasLen, 1)

Done.
Sign in to reply to this message.

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