mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 05:47:55 +00:00
ovs-vsctl: Drop redundant {port,iface}-{set,get}-external-ids commands.
These commands can be implemented just as well, and in a more general-purpose way, using the "set", "remove", and "get" commands. The br-{get,set}-external-ids commands have slightly more specialized behavior and so we can't drop them (yet).
This commit is contained in:
parent
987ae96159
commit
e328faadc4
@ -286,10 +286,10 @@ AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
|
||||
[add-port a a1],
|
||||
[add-bond a bond0 a2 a3],
|
||||
[br-set-external-id a key0 value0],
|
||||
[port-set-external-id a1 key1 value1],
|
||||
[iface-set-external-id a2 key2 value2],
|
||||
[iface-set-external-id a2 key3 value3],
|
||||
[iface-set-external-id a3 key4 value4],
|
||||
[set port a1 external-ids:key1=value1],
|
||||
[set interface a2 external-ids:key2=value2],
|
||||
[set interface a2 external-ids:key3=value3],
|
||||
[set interface a3 external-ids:key4=value4],
|
||||
[br-get-external-id a],
|
||||
[br-get-external-id a key0],
|
||||
[br-get-external-id a key1],
|
||||
@ -297,9 +297,9 @@ AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
|
||||
[br-get-external-id a],
|
||||
[br-set-external-id a key0],
|
||||
[br-get-external-id a],
|
||||
[port-get-external-id a1],
|
||||
[iface-get-external-id a2],
|
||||
[iface-get-external-id a3])], [0], [
|
||||
[get port a1 external-ids],
|
||||
[get interface a2 external-ids],
|
||||
[get interface a3 external-ids])], [0], [
|
||||
|
||||
|
||||
|
||||
@ -314,19 +314,19 @@ value0
|
||||
key0=othervalue
|
||||
|
||||
|
||||
key1=value1
|
||||
key2=value2\nkey3=value3
|
||||
key4=value4
|
||||
{"key1"="value1"}
|
||||
{"key2"="value2", "key3"="value3"}
|
||||
{"key4"="value4"}
|
||||
], [], [OVS_VSCTL_CLEANUP])
|
||||
AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
|
||||
[br-get-external-id a],
|
||||
[port-get-external-id a1],
|
||||
[iface-get-external-id a2],
|
||||
[iface-get-external-id a3])], [0],
|
||||
[get port a1 external-ids],
|
||||
[get interface a2 external-ids],
|
||||
[get interface a3 external-ids])], [0],
|
||||
[
|
||||
key1=value1
|
||||
key2=value2\nkey3=value3
|
||||
key4=value4
|
||||
{"key1"="value1"}
|
||||
{"key2"="value2", "key3"="value3"}
|
||||
{"key4"="value4"}
|
||||
], [], [OVS_VSCTL_CLEANUP])
|
||||
CHECK_BRIDGES([a, a, 0])
|
||||
CHECK_PORTS([a], [a1], [bond0])
|
||||
|
@ -181,12 +181,22 @@ If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
|
||||
\fIbridge\fR, overwriting any previous value. If \fIvalue\fR is
|
||||
omitted, then \fIkey\fR is removed from \fIbridge\fR's set of external
|
||||
IDs (if it was present).
|
||||
.IP
|
||||
For real bridges, the effect of this command is similar to that of a
|
||||
\fBset\fR or \fBremove\fR command in the \fBexternal\-ids\fR column of
|
||||
the \fBBridge\fR table. For fake bridges, it actually modifies keys
|
||||
with names prefixed by \fBfake\-bridge\-\fR in the \fBPort\fR table.
|
||||
.
|
||||
.IP "\fBbr\-get\-external\-id \fIbridge\fR [\fIkey\fR]"
|
||||
Queries the external IDs on \fIbridge\fR. If \fIkey\fR is specified,
|
||||
the output is the value for that \fIkey\fR or the empty string if
|
||||
\fIkey\fR is unset. If \fIkey\fR is omitted, the output is
|
||||
\fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
|
||||
.IP
|
||||
For real bridges, the effect of this command is similar to that of a
|
||||
\fBget\fR command in the \fBexternal\-ids\fR column of the
|
||||
\fBBridge\fR table. For fake bridges, it queries keys with names
|
||||
prefixed by \fBfake\-bridge\-\fR in the \fBPort\fR table.
|
||||
.
|
||||
.SS "Port Commands"
|
||||
.
|
||||
@ -223,25 +233,6 @@ delete a port that does not exist has no effect.
|
||||
Prints the name of the bridge that contains \fIport\fR on standard
|
||||
output.
|
||||
.
|
||||
.IP "\fBport\-set\-external\-id \fIport key\fR [\fIvalue\fR]"
|
||||
Sets or clears an ``external ID'' value on \fIport\fR. These value
|
||||
are intended to identify entities external to Open vSwitch with which
|
||||
\fIport\fR is associated, e.g. the port's identifier in a
|
||||
virtualization management platform. The Open vSwitch database schema
|
||||
specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
|
||||
are otherwise arbitrary strings.
|
||||
.IP
|
||||
If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
|
||||
\fIport\fR, overwriting any previous value. If \fIvalue\fR is
|
||||
omitted, then \fIkey\fR is removed from \fIport\fR's set of external
|
||||
IDs (if it was present).
|
||||
.
|
||||
.IP "\fBbr\-get\-external\-id \fIport\fR [\fIkey\fR]"
|
||||
Queries the external IDs on \fIport\fR. If \fIkey\fR is specified,
|
||||
the output is the value for that \fIkey\fR or the empty string if
|
||||
\fIkey\fR is unset. If \fIkey\fR is omitted, the output is
|
||||
\fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
|
||||
.
|
||||
.SS "Interface Commands"
|
||||
.
|
||||
These commands examine the interfaces attached to an Open vSwitch
|
||||
@ -257,25 +248,6 @@ list.
|
||||
Prints the name of the bridge that contains \fIiface\fR on standard
|
||||
output.
|
||||
.
|
||||
.IP "\fBiface\-set\-external\-id \fIiface key\fR [\fIvalue\fR]"
|
||||
Sets or clears an ``external ID'' value on \fIiface\fR. These value
|
||||
are intended to identify entities external to Open vSwitch with which
|
||||
\fIiface\fR is associated, e.g. the interface's identifier in a
|
||||
virtualization management platform. The Open vSwitch database schema
|
||||
specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
|
||||
are otherwise arbitrary strings.
|
||||
.IP
|
||||
If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
|
||||
\fIiface\fR, overwriting any previous value. If \fIvalue\fR is
|
||||
omitted, then \fIkey\fR is removed from \fIiface\fR's set of external
|
||||
IDs (if it was present).
|
||||
.
|
||||
.IP "\fBbr\-get\-external\-id \fIiface\fR [\fIkey\fR]"
|
||||
Queries the external IDs on \fIiface\fR. If \fIkey\fR is specified,
|
||||
the output is the value for that \fIkey\fR or the empty string if
|
||||
\fIkey\fR is unset. If \fIkey\fR is omitted, the output is
|
||||
\fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
|
||||
.
|
||||
.SS "OpenFlow Controller Connectivity"
|
||||
.
|
||||
\fBovs\-vswitchd\fR can perform all configured bridging and switching
|
||||
|
@ -259,19 +259,11 @@ Port commands:\n\
|
||||
add-bond BRIDGE PORT IFACE... add bonded port PORT in BRIDGE from IFACES\n\
|
||||
del-port [BRIDGE] PORT delete PORT (which may be bonded) from BRIDGE\n\
|
||||
port-to-br PORT print name of bridge that contains PORT\n\
|
||||
port-set-external-id PORT KEY VALUE set KEY on PORT to VALUE\n\
|
||||
port-set-external-id PORT KEY unset KEY on PORT\n\
|
||||
port-get-external-id PORT KEY print value of KEY on PORT\n\
|
||||
port-get-external-id PORT list key-value pairs on PORT\n\
|
||||
A bond is considered to be a single port.\n\
|
||||
\n\
|
||||
Interface commands (a bond consists of multiple interfaces):\n\
|
||||
list-ifaces BRIDGE print the names of all interfaces on BRIDGE\n\
|
||||
iface-to-br IFACE print name of bridge that contains IFACE\n\
|
||||
iface-set-external-id IFACE KEY VALUE set KEY on IFACE to VALUE\n\
|
||||
iface-set-external-id IFACE KEY unset KEY on IFACE\n\
|
||||
iface-get-external-id IFACE KEY print value of KEY on IFACE\n\
|
||||
iface-get-external-id IFACE list key-value pairs on IFACE\n\
|
||||
\n\
|
||||
Controller commands:\n\
|
||||
get-controller [BRIDGE] print the controller for BRIDGE\n\
|
||||
@ -1076,43 +1068,6 @@ cmd_port_to_br(struct vsctl_context *ctx)
|
||||
free_info(&info);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_port_set_external_id(struct vsctl_context *ctx)
|
||||
{
|
||||
struct vsctl_info info;
|
||||
struct vsctl_port *port;
|
||||
char **keys, **values;
|
||||
size_t n;
|
||||
|
||||
get_info(ctx->ovs, &info);
|
||||
port = find_port(&info, ctx->argv[1], true);
|
||||
set_external_id(port->port_cfg->key_external_ids,
|
||||
port->port_cfg->value_external_ids,
|
||||
port->port_cfg->n_external_ids,
|
||||
ctx->argv[2], ctx->argc >= 4 ? ctx->argv[3] : NULL,
|
||||
&keys, &values, &n);
|
||||
ovsrec_port_set_external_ids(port->port_cfg, keys, values, n);
|
||||
free(keys);
|
||||
free(values);
|
||||
|
||||
free_info(&info);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_port_get_external_id(struct vsctl_context *ctx)
|
||||
{
|
||||
struct vsctl_info info;
|
||||
struct vsctl_port *port;
|
||||
|
||||
get_info(ctx->ovs, &info);
|
||||
port = find_port(&info, ctx->argv[1], true);
|
||||
get_external_id(port->port_cfg->key_external_ids,
|
||||
port->port_cfg->value_external_ids,
|
||||
port->port_cfg->n_external_ids,
|
||||
"", ctx->argc >= 3 ? ctx->argv[2] : NULL, &ctx->output);
|
||||
free_info(&info);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_br_to_vlan(struct vsctl_context *ctx)
|
||||
{
|
||||
@ -1178,43 +1133,6 @@ cmd_iface_to_br(struct vsctl_context *ctx)
|
||||
free_info(&info);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_iface_set_external_id(struct vsctl_context *ctx)
|
||||
{
|
||||
struct vsctl_info info;
|
||||
struct vsctl_iface *iface;
|
||||
char **keys, **values;
|
||||
size_t n;
|
||||
|
||||
get_info(ctx->ovs, &info);
|
||||
iface = find_iface(&info, ctx->argv[1], true);
|
||||
set_external_id(iface->iface_cfg->key_external_ids,
|
||||
iface->iface_cfg->value_external_ids,
|
||||
iface->iface_cfg->n_external_ids,
|
||||
ctx->argv[2], ctx->argc >= 4 ? ctx->argv[3] : NULL,
|
||||
&keys, &values, &n);
|
||||
ovsrec_interface_set_external_ids(iface->iface_cfg, keys, values, n);
|
||||
free(keys);
|
||||
free(values);
|
||||
|
||||
free_info(&info);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_iface_get_external_id(struct vsctl_context *ctx)
|
||||
{
|
||||
struct vsctl_info info;
|
||||
struct vsctl_iface *iface;
|
||||
|
||||
get_info(ctx->ovs, &info);
|
||||
iface = find_iface(&info, ctx->argv[1], true);
|
||||
get_external_id(iface->iface_cfg->key_external_ids,
|
||||
iface->iface_cfg->value_external_ids,
|
||||
iface->iface_cfg->n_external_ids,
|
||||
"", ctx->argc >= 3 ? ctx->argv[2] : NULL, &ctx->output);
|
||||
free_info(&info);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_get_controller(struct vsctl_context *ctx)
|
||||
{
|
||||
@ -2531,14 +2449,10 @@ get_vsctl_handler(int argc, char *argv[], struct vsctl_context *ctx)
|
||||
{"add-bond", 4, INT_MAX, cmd_add_bond, "--fake-iface"},
|
||||
{"del-port", 1, 2, cmd_del_port, "--if-exists"},
|
||||
{"port-to-br", 1, 1, cmd_port_to_br, ""},
|
||||
{"port-set-external-id", 2, 3, cmd_port_set_external_id, ""},
|
||||
{"port-get-external-id", 1, 2, cmd_port_get_external_id, ""},
|
||||
|
||||
/* Interface commands. */
|
||||
{"list-ifaces", 1, 1, cmd_list_ifaces, ""},
|
||||
{"iface-to-br", 1, 1, cmd_iface_to_br, ""},
|
||||
{"iface-set-external-id", 2, 3, cmd_iface_set_external_id, ""},
|
||||
{"iface-get-external-id", 1, 2, cmd_iface_get_external_id, ""},
|
||||
|
||||
/* Controller commands. */
|
||||
{"get-controller", 0, 1, cmd_get_controller, ""},
|
||||
|
@ -4,7 +4,7 @@
|
||||
# needed by the controller. This is called by the "vif" script,
|
||||
# which is run when virtual interfaces are added and removed.
|
||||
|
||||
# Copyright (C) 2009 Nicira Networks, Inc.
|
||||
# Copyright (C) 2009, 2010 Nicira Networks, Inc.
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# are permitted in any medium without royalty provided the copyright
|
||||
@ -39,7 +39,7 @@ def dump_vif_info(domid, devid, vif_ref):
|
||||
vif_info.append(('xs-vif-uuid', vif_rec["uuid"]))
|
||||
vif_info.append(('xs-vm-uuid', vm_uuid))
|
||||
for key, value in vif_info:
|
||||
print("-- iface-set-external-id vif%s.%s %s %s"
|
||||
print("-- set interface vif%s.%s external-ids:\"%s\"=\"%s\""
|
||||
% (domid, devid, key, value))
|
||||
|
||||
# vNetManager needs to know the network UUID(s) associated with
|
||||
|
Loading…
x
Reference in New Issue
Block a user