Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Merge master onto maas-spaces #4139
Closed
Commits
Show all changes
211 commits
Select commit
Hold shift + click to select a range
a8b76db
Implement SupportsSpaces for maas 1.9
decb14a
Test
d0ceb68
Extended test
2f88706
Rename capability
a2e49ad
Add server url back
f1ca5ae
Properly check result of calling SupportsSpaces
a3e3ce6
Remove unneeded logging
3527c10
Implemented spaces constraints and initial interface bindings handlin…
32bf39e
Changes after review
7c66b6a
Fixed imports ordering
a41dc80
Initial commit
2b0286a
merged: Implement SupportsSpaces for maas 1.9
8e5cc60
state: Service endpoint bindings
5822746
Service bindings created and removed, using defaults when unspecified
30a91bd
Finished endpoint bindings initial implementation, no tests yet
3b34390
Drive-by fix for subnetDoc
cec723a
Dropped unnecessary test
51fdc8a
Endpoint bindings almost fully implemented, but yet untested
1fade4c
Initial set of tests for bindings - not finished
72bc07d
About to rebase onto upstream
17d6449
Finally fixed service tests
2c4cd0a
Half of the endpoint bindings internals are tested
3de455e
endpoint bindings internals fully tested
0acc6cb
Fixed a few corner cases for bindings internals
59b9599
Finished service endpoint tests
114f3b8
Added default endpoint bindings for all services during upgrade
04df70d
Added upgrade step for 1.26 to add default endpoint bindings to all s…
18035f9
Drive-by simplification in provider/maas
5b80e5c
Drive-by fix to omit LXD from the container types, causing test failu…
322f349
Simplified and improved endpoint bindings tests and implementation
59cbc48
Changes after review, further simplifications
e6328a6
Fixed the cause of a test failure due to last commit
3556fe1
Merge pull request #3915 from dimitern/maas-spaces-lost-in-rebasing
jujubot 7280f7c
Merge lost PR #3854: MAAS Provider: Spaces and updated Subnets method
2dfddce
Merge lost PR #3875: Add logic to parse "juju deploy --bind relation@…
828606c
Merge lost PR #3888: Add ProviderId to Spaces
192ad36
Merge pull request #3917 from dimitern/maas-spaces-lost-in-rebasing-2
jujubot 1f625c0
Initial commit
4e4d362
Minor tweaks
aaf4b37
Fixes
f807d9e
Moving code into common
600b712
Fix conflicts
4ae08e2
Shared implementation of CreateSpace
3f83070
deploy --bind wired up through to API server (which doesn't do anythi…
dooferlad b03c25b
Build fixes
e5011ea
Remove duplicated interface
4cec1f2
Remove whitespace
1f5b0de
Moving subnets code into common
6aee365
Moving subnets code into common
eea27d4
Test fixes
1f3507e
* Changed name of SpaceRelationBindings to EndpointBindings for consi…
dooferlad b278b9a
Merge pull request #3931 from dooferlad/maas-spaces-bind
jujubot bfb7e17
maas: Spaces constraints now handled as interface bindings
38a92a0
maas: Subnets() work now without instance ID and/or subnet IDs with t…
d40c82e
Negative spaces now applied globally, rather than per interface
6b36516
Fixed not_networks format after maas live test
f951dd8
Changes after last review
b29e2ac
Build fixes
b41b257
Test fix
8206a8e
Add SupportsSpaceDiscovery
09797d3
Typo fix
db6e0c4
Skeleton for api and worker
a5cfadf
Fleshing out API
e0851a5
Tests improved after last review
7abd659
Wire up bindings.
dooferlad 9e57db8
Fleshing out api methods
36e951a
Listen for dying
2c1d97b
Typo fix
9a61055
Minor worker fleshing out
2008153
Comment updates
facf923
Comment updates
effa83c
Comment updates
2ace5de
Add ProviderId to CreateSpaceParams and use it
55b7fbc
Type correction
f2ee6ff
Comment updates
3f4135e
Starting the worker
9de6ba1
Registering facade
4d50296
Fixed up test.
dooferlad e58de0e
correct tag creation and adding missing spaceShim method
477c603
Added test for default bindings vs specified ones.
dooferlad 442217f
Allow different endpoints bound to the same space
e4009d8
Merge pull request #3956 from dooferlad/maas-spaces-bind
jujubot 7774ee9
Merge pull request #3921 from dimitern/maas-spaces-fix-subnets-maas
jujubot cb93d96
Initial commit
94fcd73
Minor tweaks
c789647
Fixes
4bc54fe
Moving code into common
7f69128
Shared implementation of CreateSpace
6f3c246
Build fixes
1cff07c
Remove duplicated interface
f5d62fc
Remove whitespace
f6d1642
Moving subnets code into common
d3ae9a2
Moving subnets code into common
7ffff03
Test fixes
e7fe29d
Build fixes
44f9a28
Test fix
b2d3c32
Add SupportsSpaceDiscovery
8051eb1
Typo fix
7a4b26b
Skeleton for api and worker
011c48b
Fleshing out API
4a61b1f
Fleshing out api methods
14e214f
Listen for dying
4b92ada
Typo fix
af884c6
Minor worker fleshing out
09f7535
Comment updates
23ca56a
Comment updates
a890f8c
Comment updates
ed5afa1
Add ProviderId to CreateSpaceParams and use it
b62d0cf
Type correction
0a223ce
Comment updates
6746170
Starting the worker
509982a
Registering facade
6bf383d
correct tag creation and adding missing spaceShim method
133da5a
Error handling
1c78e43
Conflict resolution
5e85060
Bug fix
7e4724a
Hardcode default zone
94800a4
Added NetworkConfig API to uniter (no tests yet).
dooferlad 6462cb5
Use correct facade version number
3e24b3b
maas: add a bridge to all active interfaces
34e6a63
Add SupportsSpaceDiscovery to dummy provider
9bda5f1
Skeleton test
b213cbc
Test fix
9dc0f93
Fix import ordering and add comment
a57243d
Add worker to list of singular workers
31f0ad2
Merge pull request #3976 from frobware/maas-spaces-multi-bridge-script
jujubot 8039a95
maas: add bridge script using AddBootTextFile()
3b22163
Merge pull request #3987 from voidspace/maas-spaces-networking-api3
jujubot 824c18b
Address review comments
2185345
Simplify repeated arg in fmt.Sprintf
b596ff7
Tests and fixes
dooferlad 010d9c1
Merge pull request #3992 from frobware/maas-spaces-add-bridge-script-…
jujubot b1e21e1
Merge pull request #3993 from dooferlad/uniter-network-config
jujubot 73e140c
Check for existing subnets in worker
f98fc5d
Correct api method name
6c2d5f1
Comment
89e875e
Change log level
fe79af4
Merge pull request #3997 from voidspace/maas-spaces-networking-api4
jujubot 92a05cd
Added SpaceName to network.Address, fixed tests
4b945d2
maas: instance.Addresses() now includes spaces for each address, if a…
f0b308a
use default space to select API/mongo endpoint
c1d2277
Modified uniter NetworkConfig API to work properly
063160a
network-get minimal implementation done and barely tested
6a1ba20
endpoint bindings now passed to StartInstance and used in maas
9c693e0
Changes after review
04cc631
Changes after second review
a9980c8
Test ListSpaces
0124611
Test AddSubnets api
7b4befe
Test CreateSpaces
ce1db03
Added a TODO about SelectControllerAddress
455452f
Merge pull request #4037 from voidspace/maas-spaces-networking-api5
jujubot 4601152
Added LKK card link to the last TODO
f21d00a
Merge pull request #4029 from dimitern/maas-spaces-network-get-min
jujubot 8409536
Initial test for networking common spaces code
d3b0ce6
Test extension
9b57d82
Further testing of SupportsSpaces
b65c906
Add ProviderId test
6599f4e
Year correction
a8f044c
Adding skeleton subnets tests
dad6d37
Merge remote-tracking branch 'upstream/maas-spaces' into maas-spaces-…
c5e4bdd
Adding formatting directive
080e800
Review comments
e3bae77
Merge branch 'maas-spaces-networking-api6' into maas-spaces-networkin…
e905811
Test improvements
40e2b03
Merge pull request #4038 from voidspace/maas-spaces-networking-api6
jujubot 1b5fb9c
Skip re-registering provider
e39bccf
Moar line wrapping
c1f4329
Merge remote-tracking branch 'upstream/maas-spaces' into maas-spaces-…
bc59835
Merge pull request #4044 from voidspace/maas-spaces-networking-api7
jujubot 12ad8a1
Added better parsing for interfaces and simple tests
1cfe6db
Moved legacy NetworkInterfaces() implementation details to interfaces.go
eb7ad5e
Moved common helpers to providerSuite
cd4abf5
Simplified a couple of places to use cached API capabilities
0ec2cd0
Extra whitespace dropped
a785ee0
Moved legacy NetworkInterfaces()-related tests to interfaces_test.go
3082395
Implemented NetworkInterfaces() and a simple test for it, using the n…
98e6084
Added NewAddressOnSpace and a test for it
85d6750
Added NewAddressesOnSpace as well, improved tests
f2af612
Added SpaceName at the end of the address string representation, if n…
c1bafc2
Finished new API NetworkInterfaces() implementation and tests
ff6e36f
StartInstance uses the new API to get the InterfaceInfo if possible
29fd0a8
Fixed a go vet warning
4ee89a6
Added LKK cards for TODOs, added MTU to network.InterfaceInfo
bad67d0
Merge pull request #4043 from dimitern/maas-spaces-better-interfaces
jujubot babb002
Basic test infrastructure plus apiserver improvement
8369070
Remove unneeded EnvironObserver stuff from the worker and add Environ…
601a4bf
Really add EnvironConfig to the API
b99dfad
More resilient handling of NICs w/o IPs and more logging
eac67ab
Fixed a go vet issue
dbfc220
Test EnvironConfig
d0bd80d
Remove EnvironWatcher from api
c6f2586
Skeleton test
38db4e9
Test fix
67762db
Merge pull request #4046 from dimitern/maas-spaces-demo-hotfix
jujubot 8f53f43
Test ListSubnets
4d8a1f7
Test extension
ba78137
Add endpoint binding support to charm bundle deployment.
dooferlad c441990
Indentation arguments
d829f9d
Merge pull request #4056 from dooferlad/bundle-endpoint-bindings
jujubot 6220a2b
Merge pull request #4054 from voidspace/maas-spaces-networking-api8
jujubot 8568630
provider/maas: DNS entries do not demarcate stanzas
84e785d
Add additional test from dellstack setup
92d040b
Merge pull request #4062 from frobware/maas-spaces-lp1516891
jujubot fb3add1
Merged ipAddresses() into legacyAddresses() as it's only used there a…
668ac10
Simplified instance.Addresses() to use maasObjectNetworkInterfaces in…
b0e9f8b
Cleaning up obsolete/legacy/no longer needed code paths
fd4f137
Changes after second review
480bed5
Merge pull request #4063 from dimitern/maas-spaces-better-addresses
jujubot b319d7c
Mega monster master merge
dbe656f
Revert dependencies change
231a8b3
Correct dependencies
Jump to file or symbol
Failed to load files and symbols.
| @@ -0,0 +1,81 @@ | ||
| +// Copyright 2015 Canonical Ltd. | ||
| +// Licensed under the AGPLv3, see LICENCE file for details. | ||
| + | ||
| +package discoverspaces | ||
| + | ||
| +import ( | ||
| + "github.com/juju/errors" | ||
| + "github.com/juju/loggo" | ||
| + | ||
| + "github.com/juju/juju/api/base" | ||
| + "github.com/juju/juju/apiserver/params" | ||
| + "github.com/juju/juju/environs/config" | ||
| +) | ||
| + | ||
| +var logger = loggo.GetLogger("juju.api.discoverspaces") | ||
| + | ||
| +const discoverspacesFacade = "DiscoverSpaces" | ||
| + | ||
| +// API provides access to the DiscoverSpaces API facade. | ||
| +type API struct { | ||
| + facade base.FacadeCaller | ||
| +} | ||
| + | ||
| +// NewAPI creates a new facade. | ||
| +func NewAPI(caller base.APICaller) *API { | ||
| + if caller == nil { | ||
| + panic("caller is nil") | ||
| + } | ||
| + facadeCaller := base.NewFacadeCaller(caller, discoverspacesFacade) | ||
| + return &API{ | ||
| + facade: facadeCaller, | ||
| + } | ||
| +} | ||
| + | ||
| +func (api *API) ListSpaces() (params.DiscoverSpacesResults, error) { | ||
| + var result params.DiscoverSpacesResults | ||
| + if err := api.facade.FacadeCall("ListSpaces", nil, &result); err != nil { | ||
| + return result, errors.Trace(err) | ||
| + } | ||
| + return result, nil | ||
| +} | ||
| + | ||
| +func (api *API) AddSubnets(args params.AddSubnetsParams) (params.ErrorResults, error) { | ||
| + var result params.ErrorResults | ||
| + err := api.facade.FacadeCall("AddSubnets", args, &result) | ||
| + if err != nil { | ||
| + return result, errors.Trace(err) | ||
| + } | ||
| + return result, nil | ||
| +} | ||
| + | ||
| +func (api *API) CreateSpaces(args params.CreateSpacesParams) (results params.ErrorResults, err error) { | ||
| + var result params.ErrorResults | ||
| + err = api.facade.FacadeCall("CreateSpaces", args, &result) | ||
| + if err != nil { | ||
| + return result, errors.Trace(err) | ||
| + } | ||
| + return result, nil | ||
| +} | ||
| + | ||
| +func (api *API) ListSubnets(args params.SubnetsFilters) (params.ListSubnetsResults, error) { | ||
| + var result params.ListSubnetsResults | ||
| + if err := api.facade.FacadeCall("ListSubnets", args, &result); err != nil { | ||
| + return result, errors.Trace(err) | ||
| + } | ||
| + return result, nil | ||
| +} | ||
| + | ||
| +// EnvironConfig returns the current environment configuration. | ||
| +func (api *API) EnvironConfig() (*config.Config, error) { | ||
| + var result params.EnvironConfigResult | ||
| + err := api.facade.FacadeCall("EnvironConfig", nil, &result) | ||
| + if err != nil { | ||
| + return nil, err | ||
| + } | ||
| + conf, err := config.New(config.NoDefaults, result.Config) | ||
| + if err != nil { | ||
| + return nil, err | ||
| + } | ||
| + return conf, nil | ||
| +} |
| @@ -0,0 +1,129 @@ | ||
| +// Copyright 2015 Canonical Ltd. | ||
| +// Licensed under the AGPLv3, see LICENCE file for details. | ||
| + | ||
| +package discoverspaces_test | ||
| + | ||
| +import ( | ||
| + "errors" | ||
| + | ||
| + jc "github.com/juju/testing/checkers" | ||
| + gc "gopkg.in/check.v1" | ||
| + | ||
| + "github.com/juju/juju/api/base" | ||
| + apitesting "github.com/juju/juju/api/base/testing" | ||
| + "github.com/juju/juju/api/discoverspaces" | ||
| + "github.com/juju/juju/apiserver/params" | ||
| + "github.com/juju/juju/environs/config" | ||
| + coretesting "github.com/juju/juju/testing" | ||
| +) | ||
| + | ||
| +type DiscoverSpacesSuite struct { | ||
| + coretesting.BaseSuite | ||
| +} | ||
| + | ||
| +var _ = gc.Suite(&DiscoverSpacesSuite{}) | ||
| + | ||
| +func (s *DiscoverSpacesSuite) TestNewAPI(c *gc.C) { | ||
| + var called int | ||
| + apiCaller := clientErrorAPICaller(c, "ListSpaces", nil, &called) | ||
| + api := discoverspaces.NewAPI(apiCaller) | ||
| + c.Check(api, gc.NotNil) | ||
| + c.Check(called, gc.Equals, 0) | ||
| + | ||
| + // Make a call so that an error will be returned. | ||
| + _, err := api.ListSpaces() | ||
| + c.Assert(err, gc.ErrorMatches, "client error!") | ||
| + c.Assert(called, gc.Equals, 1) | ||
| +} | ||
| + | ||
| +func clientErrorAPICaller(c *gc.C, method string, expectArgs interface{}, numCalls *int) base.APICaller { | ||
| + args := &apitesting.CheckArgs{ | ||
| + Facade: "DiscoverSpaces", | ||
| + VersionIsZero: true, | ||
| + IdIsEmpty: true, | ||
| + Method: method, | ||
| + Args: expectArgs, | ||
| + } | ||
| + return apitesting.CheckingAPICaller(c, args, numCalls, errors.New("client error!")) | ||
| +} | ||
| + | ||
| +func successAPICaller(c *gc.C, method string, expectArgs, useResults interface{}, numCalls *int) base.APICaller { | ||
| + args := &apitesting.CheckArgs{ | ||
| + Facade: "DiscoverSpaces", | ||
| + VersionIsZero: true, | ||
| + IdIsEmpty: true, | ||
| + Method: method, | ||
| + Args: expectArgs, | ||
| + Results: useResults, | ||
| + } | ||
| + return apitesting.CheckingAPICaller(c, args, numCalls, nil) | ||
| +} | ||
| + | ||
| +func (s *DiscoverSpacesSuite) TestNewAPIWithNilCaller(c *gc.C) { | ||
| + panicFunc := func() { discoverspaces.NewAPI(nil) } | ||
| + c.Assert(panicFunc, gc.PanicMatches, "caller is nil") | ||
| +} | ||
| + | ||
| +func (s *DiscoverSpacesSuite) TestListSpaces(c *gc.C) { | ||
| + var called int | ||
| + expectedResult := params.DiscoverSpacesResults{ | ||
| + Results: []params.ProviderSpace{{Name: "foobar"}}, | ||
| + } | ||
| + apiCaller := successAPICaller(c, "ListSpaces", nil, expectedResult, &called) | ||
| + api := discoverspaces.NewAPI(apiCaller) | ||
| + | ||
| + result, err := api.ListSpaces() | ||
| + c.Assert(err, jc.ErrorIsNil) | ||
| + c.Assert(result, jc.DeepEquals, expectedResult) | ||
| + c.Assert(called, gc.Equals, 1) | ||
| +} | ||
| + | ||
| +func (s *DiscoverSpacesSuite) TestAddSubnets(c *gc.C) { | ||
| + var called int | ||
| + expectedResult := params.ErrorResults{ | ||
| + Results: []params.ErrorResult{{}}, | ||
| + } | ||
| + expectedArgs := params.AddSubnetsParams{ | ||
| + Subnets: []params.AddSubnetParams{{SubnetTag: "foo"}}, | ||
| + } | ||
| + apiCaller := successAPICaller(c, "AddSubnets", expectedArgs, expectedResult, &called) | ||
| + api := discoverspaces.NewAPI(apiCaller) | ||
| + | ||
| + result, err := api.AddSubnets(expectedArgs) | ||
| + c.Assert(err, jc.ErrorIsNil) | ||
| + c.Assert(result, jc.DeepEquals, expectedResult) | ||
| + c.Assert(called, gc.Equals, 1) | ||
| +} | ||
| + | ||
| +func (s *DiscoverSpacesSuite) TestCreateSpaces(c *gc.C) { | ||
| + var called int | ||
| + expectedResult := params.ErrorResults{ | ||
| + Results: []params.ErrorResult{{}}, | ||
| + } | ||
| + expectedArgs := params.CreateSpacesParams{ | ||
| + Spaces: []params.CreateSpaceParams{{SpaceTag: "foo"}}, | ||
| + } | ||
| + apiCaller := successAPICaller(c, "CreateSpaces", expectedArgs, expectedResult, &called) | ||
| + api := discoverspaces.NewAPI(apiCaller) | ||
| + | ||
| + result, err := api.CreateSpaces(expectedArgs) | ||
| + c.Assert(err, jc.ErrorIsNil) | ||
| + c.Assert(result, jc.DeepEquals, expectedResult) | ||
| + c.Assert(called, gc.Equals, 1) | ||
| +} | ||
| + | ||
| +func (s *DiscoverSpacesSuite) TestEnvironConfig(c *gc.C) { | ||
| + var called int | ||
| + cfg, err := config.New(config.UseDefaults, coretesting.FakeConfig()) | ||
| + c.Assert(err, jc.ErrorIsNil) | ||
| + expectedResult := params.EnvironConfigResult{ | ||
| + Config: cfg.AllAttrs(), | ||
| + } | ||
| + apiCaller := successAPICaller(c, "EnvironConfig", nil, expectedResult, &called) | ||
| + api := discoverspaces.NewAPI(apiCaller) | ||
| + | ||
| + result, err := api.EnvironConfig() | ||
| + c.Assert(err, jc.ErrorIsNil) | ||
| + c.Assert(result, jc.DeepEquals, cfg) | ||
| + c.Assert(called, gc.Equals, 1) | ||
| +} |
| @@ -0,0 +1,14 @@ | ||
| +// Copyright 2015 Canonical Ltd. | ||
| +// Licensed under the AGPLv3, see LICENCE file for details. | ||
| + | ||
| +package discoverspaces_test | ||
| + | ||
| +import ( | ||
| + stdtesting "testing" | ||
| + | ||
| + "github.com/juju/juju/testing" | ||
| +) | ||
| + | ||
| +func TestAll(t *stdtesting.T) { | ||
| + testing.MgoTestPackage(t) | ||
| +} |
Oops, something went wrong.