Merge lp:~dimitern/juju-core/397-state-networking into lp:~go-bot/juju-core/trunk
Proposed by
Dimiter Naydenov
Status: | Merged |
---|---|
Approved by: | Dimiter Naydenov |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2649 |
Proposed branch: | lp:~dimitern/juju-core/397-state-networking |
Merge into: | lp:~go-bot/juju-core/trunk |
Prerequisite: | lp:~dimitern/juju-core/396-improve-errors |
Diff against target: |
92 lines (+35/-35) 2 files modified
state/machine.go (+29/-31) state/state.go (+6/-4) |
To merge this branch: | bzr merge lp:~dimitern/juju-core/397-state-networking |
Related bugs: | |
Related blueprints: |
Support MaaS VLANs in Juju
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+215660@code.launchpad.net |
Commit message
state: Networking improvements, missed before
In this CL https:/
some of the suggestions regarding implementation
details of AddNetwork and AddNetworkInterface were
not included in time. This adds these suggestions.
https:/
R=rogpeppe
Description of the change
state: Networking improvements, missed before
In this CL https:/
some of the suggestions regarding implementation
details of AddNetwork and AddNetworkInterface were
not included in time. This adds these suggestions.
To post a comment you must log in.
Reviewers: mp+215660_ code.launchpad. net,
Message:
Please take a look.
Description:
state: Networking improvements, missed before
In this CL https:/ /codereview. appspot. com/86010044/,
some of the suggestions regarding implementation
details of AddNetwork and AddNetworkInterface were
not included in time. This adds these suggestions.
https:/ /code.launchpad .net/~dimitern/ juju-core/ 397-state- networking/ +merge/ 215660
Requires: /code.launchpad .net/~dimitern/ juju-core/ 396-improve- errors/ +merge/ 215652
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/87470044/
Affected files (+37, -35 lines):
A [revision details]
M state/machine.go
M state/state.go
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision:
<email address hidden>
Index: state/machine.go
=== modified file 'state/machine.go'
--- state/machine.go 2014-04-14 12:36:13 +0000
+++ state/machine.go 2014-04-14 13:09:55 +0000
@@ -1036,38 +1036,36 @@
Insert: doc,
}}
- for i := 0; i < 5; i++ { tion(ops) erfaces. FindId( macAddress) .One(nil) ; err == nil AlreadyExistsf( "interface with MAC address %q", networkName) ; err != nil { erfaces. FindId( macAddress) .One(nil) ; err != nil AlreadyExistsf( "%q on machine %q", interfaceName, face(m. st, doc), nil tion(ops) erfaces. FindId( macAddress) .One(nil) ; err == nil { AlreadyExistsf( "interface with MAC address %q", networkName) ; err != nil {
- err = m.st.runTransac
- switch err {
- case txn.ErrAborted:
- if err = m.st.networkInt
{
- return nil, errors.
macAddress)
- }
- if _, err = m.st.Network(
- return nil, err
- }
- if err = m.Refresh(); err != nil {
- return nil, err
- } else if m.doc.Life != Alive {
- return nil, fmt.Errorf("machine is not alive")
- } else if m.doc.Nonce != "" {
- msg := "machine already provisioned: dynamic network interfaces not
currently supported"
- return nil, fmt.Errorf(msg)
- }
- case nil:
- // For some reason when using unique indices with mgo, and
- // we have an index violation the error is nil, but the
- // document is not added. So we check if the supposedly
- // successful transaction did actually add the document.
- if err = m.st.networkInt
{
- return nil, errors.
m.doc.Id)
- }
- return newNetworkInter
- default:
- return nil, err
- }
+ err = m.st.runTransac
+ switch err {
+ case txn.ErrAborted:
+ if err = m.st.networkInt
+ return nil, errors.
macAddress)
+ }
+ if _, err = m.st.Network(
+ return nil, err
+ }
+ if err = m.Refresh(); err != nil {
+ return nil, err
+ } else if m.doc.Life != Alive {
+ return nil, fmt.Errorf("machine is not alive")
+ } else if m.doc.Nonce != "" {
+ msg := "machine already provisioned: dynamic network interfaces not
currently supported"
+ return nil, fmt.Errorf(msg)
+ }
+ case nil:
+ // We have a unique key restriction on the InterfaceName
+ // field, which will cause the insert to fail ...