Skip to content

Commit 33315ae

Browse files
danwinshipcherrypicker
authored and
cherrypicker
committed
Avoid parsing the whole dump-flows output in the OVS health check
1 parent 250e6d7 commit 33315ae

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/network/node/ovscontroller.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ func (oc *ovsController) AlreadySetUp() bool {
5858
return false
5959
}
6060
expectedVersionNote := oc.getVersionNote()
61-
for _, flow := range flows {
62-
parsed, err := ovs.ParseFlow(ovs.ParseForDump, flow)
63-
if err == nil && parsed.Table == ruleVersionTable && parsed.NoteHasPrefix(expectedVersionNote) {
64-
return true
61+
// The "version" flow should be the last one, so scan from the end
62+
for i := len(flows) - 1; i >= 0; i-- {
63+
parsed, err := ovs.ParseFlow(ovs.ParseForDump, flows[i])
64+
if err == nil && parsed.Table == ruleVersionTable {
65+
return parsed.NoteHasPrefix(expectedVersionNote)
6566
}
6667
}
6768
return false

0 commit comments

Comments
 (0)