Skip to content

Commit

Permalink
Avoid parsing the whole dump-flows output in the OVS health check
Browse files Browse the repository at this point in the history
  • Loading branch information
danwinship authored and cherrypicker committed Nov 15, 2017
1 parent 250e6d7 commit 33315ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/network/node/ovscontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ func (oc *ovsController) AlreadySetUp() bool {
return false
}
expectedVersionNote := oc.getVersionNote()
for _, flow := range flows {
parsed, err := ovs.ParseFlow(ovs.ParseForDump, flow)
if err == nil && parsed.Table == ruleVersionTable && parsed.NoteHasPrefix(expectedVersionNote) {
return true
// The "version" flow should be the last one, so scan from the end
for i := len(flows) - 1; i >= 0; i-- {
parsed, err := ovs.ParseFlow(ovs.ParseForDump, flows[i])
if err == nil && parsed.Table == ruleVersionTable {
return parsed.NoteHasPrefix(expectedVersionNote)
}
}
return false
Expand Down

0 comments on commit 33315ae

Please sign in to comment.