Merge lp://staging/~allenap/gwacl/add-virtual-network into lp://staging/gwacl
Proposed by
Gavin Panella
Status: | Merged |
---|---|
Approved by: | Gavin Panella |
Approved revision: | 206 |
Merged at revision: | 180 |
Proposed branch: | lp://staging/~allenap/gwacl/add-virtual-network |
Merge into: | lp://staging/gwacl |
Diff against target: |
427 lines (+337/-24) 5 files modified
example/management/run.go (+9/-21) management.go (+53/-0) management_base_test.go (+11/-2) management_test.go (+264/-0) xmlobjects.go (+0/-1) |
To merge this branch: | bzr merge lp://staging/~allenap/gwacl/add-virtual-network |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raphaël Badin (community) | Approve | ||
Review via email:
|
Commit message
Two new methods, {Add,Remove}
To post a comment you must log in.
Looks generally good but I've got a question (see [0]).
[0]
76 + for _, existingSite := range *networkConfig. VirtualNetworkS ites {
77 + if existingSite.Name == site.Name {
78 + // Network already defined.
79 + return nil
80 + }
That's a weird behavior don't you think? Say I try adding a network with the same name but a different affinity group; the method will return with a nil error so I'll think that everything is ok and it will be a lie :). I /think/ returning an error (maybe only if the network you're trying to add has exactly the same characteristics as the one with the same name which already exists) is more appropriate here. What do you think?
[1]
102 + for _, existingSite := range *networkConfig. VirtualNetworkS ites { virtualNetworkS ites, existingSite)
103 + if existingSite.Name != siteName {
104 + virtualNetworkSites = append(
105 + }
We cannot just remove the network in question from networkConfig. VirtualNetworkS ites can we :/
[2]
208 + virtualNetwork := &VirtualNetwork Site{Name: MakeRandomVirtu alNetworkName( "test-" )} etworkSite( virtualNetwork)
209 + err := api.AddVirtualN
210 + c.Assert(err, IsNil)
211 + c.Check(record, HasLen, 2)
It's a detail but that's something Jeroen and I have tried to do in tests, especially when the tests are long: put a empty line between the initialization code and the method you're testing, and another after that. This way, we have 3 visually well-separated blocks: initialization, method call, checks.
[3]
You could add a check in example/ management/ run.go to make sure that the created machine effectively has an IP in the virtual network.