Skip to content

Commit ecd7763

Browse files
author
OpenShift Bot
authored
Merge pull request #15023 from dcbw/ofport-failure-logging
Merged by openshift-bot
2 parents 26585bb + 322f686 commit ecd7763

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pkg/util/ovs/ovs.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (ovsif *ovsExec) GetOFPort(port string) (int, error) {
177177
}
178178
ofport, err := strconv.Atoi(ofportStr)
179179
if err != nil {
180-
return -1, fmt.Errorf("Could not parse allocated ofport %q: %v", ofportStr, err)
180+
return -1, fmt.Errorf("could not parse allocated ofport %q: %v", ofportStr, err)
181181
}
182182
return ofport, nil
183183
}
@@ -198,8 +198,11 @@ func (ovsif *ovsExec) AddPort(port string, ofportRequest int, properties ...stri
198198
return -1, err
199199
}
200200
ofport, err := ovsif.GetOFPort(port)
201+
if err != nil {
202+
return -1, fmt.Errorf("failed to get %q OVS port: %v", port, err)
203+
}
201204
if ofportRequest > 0 && ofportRequest != ofport {
202-
return -1, fmt.Errorf("Allocated ofport (%d) did not match request (%d)", ofport, ofportRequest)
205+
return -1, fmt.Errorf("allocated ofport (%d) did not match request (%d)", ofport, ofportRequest)
203206
}
204207
return ofport, nil
205208
}

pkg/util/ovs/ovs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func TestAddPort(t *testing.T) {
190190
if err == nil {
191191
t.Fatalf("Unexpectedly failed to get error")
192192
}
193-
if err.Error() != "Allocated ofport (3) did not match request (5)" {
193+
if err.Error() != "allocated ofport (3) did not match request (5)" {
194194
t.Fatalf("Got wrong error: %v", err)
195195
}
196196
ensureTestResults(t, fexec)

0 commit comments

Comments
 (0)