Handle vswitch reconnect gracefully (vxlan + bridge fwd mode)#101
Handle vswitch reconnect gracefully (vxlan + bridge fwd mode)#101kahou82 wants to merge 4 commits intocontiv:masterfrom
Conversation
With vxlan bridge fwd mode, vxlanBridge will start the ovs switch object in two of the vlan flooding objects (localFlood and allFlood). The switch object is being populated when the first vxlan is assigned. When user restart ovs switch, ofnet handle the reconnect which pass down the notification to vxlanBridge object but it doesn't refresh the existing vlans to save the new switch object. This causes netplugin stuck to talk to an unbuffered channel. This patchset is to refresh vxlan entry to store new switch object when ofnet handle ovs switch reconnection Signed-off-by: Kahou Lei <kalei@cisco.com>
| if len(self.vlanDb) != 0 { | ||
| for vlanId, vlan := range self.vlanDb { | ||
| log.Debugf(" Updating vlan %s switch object", vlanId) | ||
| var err error |
There was a problem hiding this comment.
Since none of the variables are used outside of the if statements immediately following them, I would get rid of this error variable and have the rest like this (also added error logging):
if vlan.localFlood, err := self.ofSwitch.NewFlood(); err != nil {
log.Errorf("Unable to assign new switch to vlan %s local flood: %v", vlanId, err)
return
}
if vlan.allFlood, err := self.ofSwitch.NewFlood(); err != nil {
log.Errorf("Unable to assign new switch to vlan %s all flood: %v", vlanId, err)
return
}Also, do we want to break instead of return? Do we want to exit the loop at all or try to continue processing the rest of the entries? continue?
There was a problem hiding this comment.
Never mind about the inline assignment thing, you can't do that when assigning to struct members lol
There was a problem hiding this comment.
Actually I was think to use os.Exit().
|
build PR |
vxlanBridge.go
Outdated
| vlan.localFlood, err = self.ofSwitch.NewFlood() | ||
| if err != nil { | ||
| log.Errorf("Unable to assign new switch to vlan %s local flood", vlanId) | ||
| log.Errorf("Unable to assign new switch to vlan %v local flood", vlanId) |
There was a problem hiding this comment.
logrus.Fatalf() does the same logging and os.exist
|
build PR |
|
build pr |
|
Is this good to go? |
|
@kahou82 feel free to squash merge if this is all set |
With vxlan bridge fwd mode, vxlanBridge will start the ovs switch object
in two of the vlan flooding objects (localFlood and allFlood). The switch object
is being populated when the first vxlan is assigned.
When user restart ovs switch, ofnet handle the reconnect which pass down the notification
to vxlanBridge object but it doesn't refresh the existing vlans to save the
new switch object. This causes netplugin stuck to talk to an unbuffered channel.
This patchset is to refresh vxlan entry to store new switch object
when ofnet handle ovs switch reconnection
Signed-off-by: Kahou Lei kalei@cisco.com