Skip to content

Commit

Permalink
ovs-vsctl: Fix behavioral regression for "--if-exists del-port <bridg…
Browse files Browse the repository at this point in the history
…e>".

Commit 89f3c25 (ovs-vsctl: Improve error message for "ovs-vsctl del-port
<bridge>".) changed the behavior of
    ovs-vsctl --if-exists del-port <bridge>
from a silent no-op to a hard failure.  This commit fixes this regression.

This caused problems on XenServer, for which the Open vSwitch integration
runs commands like:
    /usr/bin/ovs-vsctl --timeout=20 \
        -- --with-iface --if-exists del-port xapi103 \
        -- --if-exists del-br xapi103

Bug #18276.
Reported-by: Michael Hu <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Jul 9, 2013
1 parent 8d32c1d commit 25a27ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/ovs-vsctl.at
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ AT_CHECK([RUN_OVS_VSCTL([del-port a])], [1], [],
[ovs-vsctl: cannot delete port a because it is the local port for bridge a (deleting this port requires deleting the entire bridge)
],
[OVS_VSCTL_CLEANUP])
AT_CHECK([RUN_OVS_VSCTL([--if-exists del-port a])], [0], [], [],
[OVS_VSCTL_CLEANUP])
AT_CHECK([RUN_OVS_VSCTL([--may-exist add-port a b1])], [1], [],
[ovs-vsctl: "--may-exist add-port a b1" but b1 is actually attached to bridge b
],
Expand Down
9 changes: 6 additions & 3 deletions utilities/ovs-vsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2021,9 +2021,12 @@ cmd_del_port(struct vsctl_context *ctx)

vsctl_context_populate_cache(ctx);
if (find_bridge(ctx, target, false)) {
vsctl_fatal("cannot delete port %s because it is the local port "
"for bridge %s (deleting this port requires deleting "
"the entire bridge)", target, target);
if (must_exist) {
vsctl_fatal("cannot delete port %s because it is the local port "
"for bridge %s (deleting this port requires deleting "
"the entire bridge)", target, target);
}
port = NULL;
} else if (!with_iface) {
port = find_port(ctx, target, must_exist);
} else {
Expand Down

0 comments on commit 25a27ba

Please sign in to comment.