], [], [OVS_VSCTL_CLEANUP])
AT_CHECK([RUN_OVS_VSCTL([--may-exist add-port b b1])], [0], [], [],
[OVS_VSCTL_CLEANUP])
+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([--may-exist add-port a b1])], [1], [],
[ovs-vsctl: "--may-exist add-port a b1" but b1 is actually attached to bridge b
],
# Delete the port
AT_CHECK([ovs-vsctl del-port br0 reserved_name], [0], [], [])])
OVS_VSWITCHD_STOP
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP
{
bool must_exist = !shash_find(&ctx->options, "--if-exists");
bool with_iface = shash_find(&ctx->options, "--with-iface") != NULL;
+ const char *target = ctx->argv[ctx->argc - 1];
struct vsctl_port *port;
vsctl_context_populate_cache(ctx);
- if (!with_iface) {
- port = find_port(ctx, ctx->argv[ctx->argc - 1], must_exist);
+ 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);
+ } else if (!with_iface) {
+ port = find_port(ctx, target, must_exist);
} else {
- const char *target = ctx->argv[ctx->argc - 1];
struct vsctl_iface *iface;
port = find_port(ctx, target, false);