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

Issue 89260044: various: Support multiple NICs with the same MAC (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by dimitern
Modified:
10 years ago
Reviewers:
fwereade, mp+216453
Visibility:
Public.

Description

various: Support multiple NICs with the same MAC Fixes bug #1307513, allowing more than one network interface with the same MAC address, and introduces the concept of virtual and physical NIC. This is needed because you can have more than one network interface with the same MAC address on the same machine (but it has to be on different networks): one physical and multiple virtual NICs. Changes were needed mostly in state to use a different primary key for networkinterfaces collection. Also added a unique index on "interfacename" and "networkname", improved tests. Fixed the MAAS provider to configure networks properly, so that you can have more than one VLAN virtual NIC on the same physical NIC. Introduced environs/network package and defined an Id type to make it apparent that network ids are provider-specific (like instance.Id). Also moved environs.NetworkInfo to network.Info. In a follow-up, machine addresses and networks will be integrated, so we can link a network interface's name and MAC address to its network (IP) address. Finally, networks and machine interfaces will be visible in juju status. https://code.launchpad.net/~dimitern/juju-core/400-lp-1307513-multiple-nics-same-mac/+merge/216453 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 11

Patch Set 2 : various: Support multiple NICs with the same MAC #

Total comments: 4

Patch Set 3 : various: Support multiple NICs with the same MAC #

Unified diffs Side-by-side diffs Delta from patch set Stats (+458 lines, -256 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M environs/broker.go View 1 2 3 chunks +2 lines, -27 lines 0 comments Download
A environs/network/network.go View 1 2 1 chunk +37 lines, -0 lines 0 comments Download
M juju/testing/instance.go View 1 2 4 chunks +4 lines, -3 lines 0 comments Download
M provider/azure/environ.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M provider/common/bootstrap_test.go View 1 2 5 chunks +5 lines, -4 lines 0 comments Download
M provider/common/mock_test.go View 1 2 3 chunks +3 lines, -2 lines 0 comments Download
M provider/dummy/environs.go View 1 2 4 chunks +13 lines, -11 lines 0 comments Download
M provider/ec2/ec2.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M provider/joyent/environ_instance.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M provider/local/environ.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M provider/maas/environ.go View 1 2 8 chunks +36 lines, -39 lines 0 comments Download
M provider/maas/environ_test.go View 1 2 3 chunks +20 lines, -2 lines 0 comments Download
M provider/manual/environ.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M provider/openstack/provider.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M state/api/params/internal.go View 1 2 3 chunks +6 lines, -1 line 0 comments Download
M state/api/provisioner/provisioner_test.go View 1 4 chunks +31 lines, -11 lines 0 comments Download
M state/apiserver/provisioner/provisioner.go View 1 1 chunk +1 line, -0 lines 0 comments Download
M state/apiserver/provisioner/provisioner_test.go View 1 3 chunks +34 lines, -10 lines 0 comments Download
M state/machine.go View 1 2 7 chunks +47 lines, -35 lines 0 comments Download
M state/machine_test.go View 1 2 8 chunks +43 lines, -29 lines 0 comments Download
M state/networkinterfaces.go View 4 chunks +46 lines, -6 lines 0 comments Download
M state/networkinterfaces_test.go View 1 2 chunks +11 lines, -2 lines 0 comments Download
M state/networks.go View 1 2 4 chunks +22 lines, -3 lines 0 comments Download
M state/networks_test.go View 1 2 chunks +15 lines, -5 lines 0 comments Download
M state/open.go View 1 chunk +1 line, -0 lines 0 comments Download
M state/state.go View 1 2 chunks +19 lines, -25 lines 0 comments Download
M state/state_test.go View 1 4 chunks +27 lines, -21 lines 0 comments Download
M worker/provisioner/kvm-broker.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M worker/provisioner/lxc-broker.go View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M worker/provisioner/provisioner_task.go View 1 2 3 chunks +6 lines, -4 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 2 5 chunks +11 lines, -8 lines 0 comments Download

Messages

Total messages: 6
dimitern
Please take a look.
10 years ago (2014-04-18 14:18:42 UTC) #1
fwereade
mostly looking good, but (1) IsVirtual on network still seems ill-formed to me; and (2) ...
10 years ago (2014-04-18 14:41:17 UTC) #2
dimitern
On 2014/04/18 14:41:17, fwereade wrote: > mostly looking good, but (1) IsVirtual on network still ...
10 years ago (2014-04-18 15:03:04 UTC) #3
dimitern
Please take a look. https://codereview.appspot.com/89260044/diff/1/environs/broker.go File environs/broker.go (right): https://codereview.appspot.com/89260044/diff/1/environs/broker.go#newcode51 environs/broker.go:51: ProviderId string On 2014/04/18 14:41:18, ...
10 years ago (2014-04-18 15:37:26 UTC) #4
fwereade
Thanks, LGTM with trivials. https://codereview.appspot.com/89260044/diff/1/environs/broker.go File environs/broker.go (right): https://codereview.appspot.com/89260044/diff/1/environs/broker.go#newcode51 environs/broker.go:51: ProviderId string On 2014/04/18 15:37:26, ...
10 years ago (2014-04-18 16:02:53 UTC) #5
dimitern
10 years ago (2014-04-18 16:44:34 UTC) #6
Please take a look.

https://codereview.appspot.com/89260044/diff/1/state/machine.go
File state/machine.go (right):

https://codereview.appspot.com/89260044/diff/1/state/machine.go#newcode570
state/machine.go:570: var doc networkInterfaceDoc
On 2014/04/18 16:02:54, fwereade wrote:
> On 2014/04/18 15:37:27, dimitern wrote:
> > On 2014/04/18 14:41:18, fwereade wrote:
> > > hey, I'm feeling more strongly about this now: please assert that the
> machine
> > is
> > > Dead in this method, just so that if (when) someone tries to use it from
> > > elsewhere they get something pointing out the race with adding interfaces.
> > 
> > Done.
> 
> Sorry, I expressed myself poorly. The op is nice, and could/should happily
stay
> (other invariants *should* make it unnecessary, but +1 to defence in depth),
but
> what I'm really looking for is a quick check against m.doc.Life so we can
abort
> with an error before even running the txn.

As discussed, I'm adding a check for m.doc.Life == Dead at the beginning.

https://codereview.appspot.com/89260044/diff/10021/state/api/params/internal.go
File state/api/params/internal.go (right):

https://codereview.appspot.com/89260044/diff/10021/state/api/params/internal....
state/api/params/internal.go:320: ProviderId instance.NetworkId
On 2014/04/18 16:02:54, fwereade wrote:
> hmm, instance.NetworkId doesn't feel quite right -- I'd say
environs.NetworkId,
> with the expectation that soon enough we'll want an environs/network package
and
> we can just call it network.Id.
> 
> Or if you want to start the package with a single type, and start gradually
> migrating stuff over to it as you go in future CLs, that would also work for
me.

I tried adding it to environs, but there are import loops. I like the idea of
having environs/network package, so I added that and moved environs.NetworkInfo
there.

https://codereview.appspot.com/89260044/diff/10021/state/machine.go
File state/machine.go (right):

https://codereview.appspot.com/89260044/diff/10021/state/machine.go#newcode1063
state/machine.go:1063: if err = m.st.networkInterfaces.FindId(doc.Id).One(nil);
err == nil {
On 2014/04/18 16:02:54, fwereade wrote:
> .One(&doc) perhaps? I suspect you're grabbing the data anyway, even if you're
> not storing it, so you may as well return a doc that definitely completely
> matches what's in the db.
> 
> I know it doesn't make a difference *now* but it feels like an encouragement
to
> subtle bugs.

Done.
Sign in to reply to this message.

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