Skip to content

Commit

Permalink
ovn: Support chassis hostname in requested-chassis.
Browse files Browse the repository at this point in the history
Previously, OVN expected the Chassis "name" in the "requested-chassis"
option for a Logical_Switch_Port.  It turns out that in the two OVN
integrations I've checked with that plan to use this option,
specifying the Chassis "hostname" is much more convenient.  This patch
extends the "requested-chassis" option to support both the Chassis
name or the hostname as a value.

Signed-off-by: Russell Bryant <[email protected]>
Acked-by: Lance Richardson <[email protected]>
  • Loading branch information
russellb authored and darball1 committed Sep 7, 2017
1 parent 4f7ad0d commit 9089475
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 13 deletions.
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Post-v2.8.0
--------------------
- Nothing yet.
- OVN:
* The "requested-chassis" option for a logical switch port now accepts a
chassis "hostname" in addition to a chassis "name".

v2.8.0 - xx xxx xxxx
---------------------
Expand Down
5 changes: 3 additions & 2 deletions ovn/controller/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ consider_local_datapath(struct controller_ctx *ctx,
if (ctx->ovnsb_idl_txn) {
const char *vif_chassis = smap_get(&binding_rec->options,
"requested-chassis");
bool can_bind = !vif_chassis || !vif_chassis[0] ||
!strcmp(vif_chassis, chassis_rec->name);
bool can_bind = !vif_chassis || !vif_chassis[0]
|| !strcmp(vif_chassis, chassis_rec->name)
|| !strcmp(vif_chassis, chassis_rec->hostname);

if (can_bind && our_chassis) {
if (binding_rec->chassis != chassis_rec) {
Expand Down
11 changes: 6 additions & 5 deletions ovn/ovn-nb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,12 @@
</p>

<column name="options" key="requested-chassis">
If set, identifies a specific chassis (by name) that is allowed to
bind this port. Using this option will prevent thrashing between
two chassis trying to bind the same port during a live migration.
It can also prevent similar thrashing due to a mis-configuration,
if a port is accidentally created on more than one chassis.
If set, identifies a specific chassis (by name or hostname) that
is allowed to bind this port. Using this option will prevent
thrashing between two chassis trying to bind the same port during
a live migration. It can also prevent similar thrashing due to a
mis-configuration, if a port is accidentally created on more than
one chassis.
</column>

<column name="options" key="qos_max_rate">
Expand Down
11 changes: 6 additions & 5 deletions ovn/ovn-sb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2160,11 +2160,12 @@ tcp.flags = RST;
</p>

<column name="options" key="requested-chassis">
If set, identifies a specific chassis (by name) that is allowed to
bind this port. Using this option will prevent thrashing between
two chassis trying to bind the same port during a live migration.
It can also prevent similar thrashing due to a mis-configuration,
if a port is accidentally created on more than one chassis.
If set, identifies a specific chassis (by name or hostname) that
is allowed to bind this port. Using this option will prevent
thrashing between two chassis trying to bind the same port during
a live migration. It can also prevent similar thrashing due to a
mis-configuration, if a port is accidentally created on more than
one chassis.
</column>

<column name="options" key="qos_max_rate">
Expand Down
33 changes: 33 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -8541,3 +8541,36 @@ OVS_WAIT_UNTIL([test $(ovn-sbctl --bare --columns chassis find port_binding logi
OVN_CLEANUP([hv1],[hv2])

AT_CLEANUP

AT_SETUP([ovn -- options:requested-chassis with hostname])

ovn_start

ovn-nbctl ls-add ls0
ovn-nbctl lsp-add ls0 lsp0

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.11
ovs-vsctl -- add-port br-int hv1-vif0

hv1_hostname=$(ovn-sbctl --bare --columns hostname find Chassis name=hv1)
echo "hv1_hostname=${hv1_hostname}"
ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=${hv1_hostname}
as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0

hv1_uuid=$(ovn-sbctl --bare --columns _uuid find Chassis name=hv1)
echo "hv1_uuid=${hv1_uuid}"
OVS_WAIT_UNTIL([test 1 = $(grep -c "Claiming lport lsp0" hv1/ovn-controller.log)])
AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv1_uuid"], [0], [])

ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=non-existant-chassis
OVS_WAIT_UNTIL([test 1 = $(grep -c "Releasing lport lsp0 from this chassis" hv1/ovn-controller.log)])
ovn-nbctl --wait=hv --timeout=3 sync
AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x], [0], [])

OVN_CLEANUP([hv1])

AT_CLEANUP

0 comments on commit 9089475

Please sign in to comment.