Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle vswitch reconnect gracefully (vxlan + bridge fwd mode) #101

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vxlanBridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ func (self *Vxlan) SwitchConnected(sw *ofctrl.OFSwitch) {
var err error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind about the inline assignment thing, you can't do that when assigning to struct members lol

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was think to use os.Exit().

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logrus.Fatalf() does the same logging and os.exist

os.Exit(1)
}
vlan.allFlood, err = self.ofSwitch.NewFlood()
if err != nil {
log.Errorf("Unable to assign new switch to vlan %s all flood", vlanId)
log.Errorf("Unable to assign new switch to vlan %v all flood", vlanId)
os.Exit(1)
}
}
Expand Down