-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fix OVS test flake on release-1.5 #13200
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ package plugin | |
import ( | ||
"fmt" | ||
"net" | ||
"sort" | ||
"strconv" | ||
"strings" | ||
|
||
log "github.com/golang/glog" | ||
|
||
|
@@ -266,13 +268,14 @@ func (plugin *OsdnNode) updateVXLANMulticastRules(subnets hostSubnetMap) { | |
otx := plugin.ovs.NewTransaction() | ||
|
||
// Build the list of all nodes for multicast forwarding | ||
tun_dsts := "" | ||
tun_dsts := make([]string, 0, len(subnets)) | ||
for _, subnet := range subnets { | ||
if subnet.HostIP != plugin.localIP { | ||
tun_dsts += fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP) | ||
tun_dsts = append(tun_dsts, fmt.Sprintf(",set_field:%s->tun_dst,output:1", subnet.HostIP)) | ||
} | ||
} | ||
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", tun_dsts) | ||
sort.Strings(sort.StringSlice(tun_dsts)) | ||
otx.AddFlow("table=111, priority=100, actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31]%s,goto_table:120", strings.Join(tun_dsts, "")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are going to keep each string in the slice why not handle the commas in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we don't want "a comma between each element", we want "a comma before each element". If you look at how the tun_dsts get fit into the rest of the flow string, the string has to be "" when there are no tun_dsts, but it has to start with "," otherwise. |
||
|
||
if err := otx.EndTransaction(); err != nil { | ||
log.Errorf("Error updating OVS VXLAN multicast flows: %v", err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need the
sort.StringSlice()
? Doesn'tsort.Strings()
take a[]string
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. However, this is a cherry-pick from master, so we should keep it the same. (Or fix it there as well I guess.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I say send a PR to fix in master and we'll allow the double casting since it apparently doesn't hurt much.