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

Issue 11548044: Add Instance.Addresses() and use for openstack

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by gz
Modified:
10 years, 9 months ago
Reviewers:
mp+175714, dimitern, thumper, rog
Visibility:
Public.

Description

Add Instance.Addresses() and use for openstack Changes the Instance interface to require a new Addresses() method. This will be used to present cloud-specific address details in the generic fashion, which a future branch will record in state. The code includes the required implementation for Openstack, maintaining support for the current quirks but shifting some of the general logic into the shared instance/address.go file. Currently all calls still go back through the cloud api, but when the results are recorded in state and can be updated by the state server, it will be possible make users of DNSName and WaitDNSName consumers of machineDoc only. https://code.launchpad.net/~gz/juju-core/openstack_addresses/+merge/175714 Requires: https://code.launchpad.net/~gz/juju-core/instance_address/+merge/175713 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 17

Patch Set 2 : Add Instance.Addresses() and use for openstack #

Total comments: 9

Patch Set 3 : Add Instance.Addresses() and use for openstack #

Unified diffs Side-by-side diffs Delta from patch set Stats (+123 lines, -65 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M container/lxc/instance.go View 1 chunk +5 lines, -0 lines 0 comments Download
M environs/azure/instance.go View 1 chunk +5 lines, -0 lines 0 comments Download
M environs/dummy/environs.go View 1 chunk +5 lines, -0 lines 0 comments Download
M environs/ec2/ec2.go View 1 chunk +5 lines, -0 lines 0 comments Download
M environs/local/instance.go View 1 chunk +5 lines, -0 lines 0 comments Download
M environs/maas/instance.go View 1 chunk +5 lines, -0 lines 0 comments Download
M environs/openstack/export_test.go View 2 chunks +4 lines, -2 lines 0 comments Download
M environs/openstack/provider.go View 1 2 2 chunks +63 lines, -50 lines 0 comments Download
M environs/openstack/provider_test.go View 6 chunks +1 line, -13 lines 0 comments Download
M instance/address.go View 1 chunk +18 lines, -0 lines 0 comments Download
M instance/instance.go View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 7
gz
Please take a look.
10 years, 9 months ago (2013-07-19 01:31:49 UTC) #1
thumper
https://codereview.appspot.com/11548044/diff/1/environs/openstack/provider.go File environs/openstack/provider.go (right): https://codereview.appspot.com/11548044/diff/1/environs/openstack/provider.go#newcode245 environs/openstack/provider.go:245: addrs = server.Addresses Should you be saving this as ...
10 years, 9 months ago (2013-07-19 02:27:22 UTC) #2
dimitern
Overall LGTM, with a few suggestions. https://codereview.appspot.com/11548044/diff/1/container/lxc/instance.go File container/lxc/instance.go (right): https://codereview.appspot.com/11548044/diff/1/container/lxc/instance.go#newcode25 container/lxc/instance.go:25: return nil, nil ...
10 years, 9 months ago (2013-07-19 06:10:50 UTC) #3
dimitern
Overall LGTM, with a few suggestions. https://codereview.appspot.com/11548044/diff/1/container/lxc/instance.go File container/lxc/instance.go (right): https://codereview.appspot.com/11548044/diff/1/container/lxc/instance.go#newcode25 container/lxc/instance.go:25: return nil, nil ...
10 years, 9 months ago (2013-07-19 06:10:50 UTC) #4
gz
Please take a look. https://codereview.appspot.com/11548044/diff/1/container/lxc/instance.go File container/lxc/instance.go (right): https://codereview.appspot.com/11548044/diff/1/container/lxc/instance.go#newcode25 container/lxc/instance.go:25: return nil, nil On 2013/07/19 ...
10 years, 9 months ago (2013-07-19 17:53:34 UTC) #5
rog
LGTM with some trivial suggestion. i now see dimiter also suggested returning an error. feel ...
10 years, 9 months ago (2013-07-23 11:25:54 UTC) #6
gz
10 years, 9 months ago (2013-07-24 12:11:11 UTC) #7
Please take a look.

https://codereview.appspot.com/11548044/diff/14001/environs/openstack/provide...
File environs/openstack/provider.go (right):

https://codereview.appspot.com/11548044/diff/14001/environs/openstack/provide...
environs/openstack/provider.go:239: addrs := inst.ServerDetail.Addresses
On 2013/07/23 11:25:54, rog wrote:
> if len(addrs) > 0 {
>     return addrs, nil
> }
> then lose a level of indentation in the rest?

Hm, just tweaked that, but then I deunify the success return statement...

https://codereview.appspot.com/11548044/diff/14001/environs/openstack/provide...
environs/openstack/provider.go:280: machineAddr :=
instance.Address{address.Address,
On 2013/07/23 11:25:54, rog wrote:
> i'd prefer to see a tagged initialisation literal here

Seems fair, should be a NewSomething eventually I think.

https://codereview.appspot.com/11548044/diff/14001/instance/address.go
File instance/address.go (right):

https://codereview.appspot.com/11548044/diff/14001/instance/address.go#newcode68
instance/address.go:68: if addr.Type != Ipv6Address {
On 2013/07/23 11:25:54, rog wrote:
> if addr.Type == IPv6Address {
>     continue
> }
> ?

I generally prefer conditional bodies unless using break anyway, to limit the
gotoness.
Sign in to reply to this message.

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