]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovn: Support chassis hostname in requested-chassis.
authorRussell Bryant <russell@ovn.org>
Fri, 1 Sep 2017 18:24:12 +0000 (14:24 -0400)
committerRussell Bryant <russell@ovn.org>
Wed, 6 Sep 2017 21:11:55 +0000 (17:11 -0400)
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 <russell@ovn.org>
Acked-by: Lance Richardson <lrichard@redhat.com>
NEWS
ovn/controller/binding.c
ovn/ovn-nb.xml
ovn/ovn-sb.xml
tests/ovn.at

diff --git a/NEWS b/NEWS
index 5d32566aca9797fa2528b28a19bd50d5a18dcf37..6a5d2bf98d358a39c45bec36c90942f31c55bbe7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
 ---------------------
index 6a56e26caf9498e91f05bb9785b3e5a31f52c8e1..ca1d43395fdbe1bfbf8c4f007441a61985e70633 100644 (file)
@@ -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) {
index be72610c0d137d9e0f3f20738fef1f6815357aa7..9869d7ed72bffeb00e36b58666eb5ae46bcd094f 100644 (file)
         </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">
index 7098194c6644597d6d4b0246085771aa642e9611..0a894f8cb0f09bf64df066a538dbb362ff9a773f 100644 (file)
@@ -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">
index fb9fc73526a14bfc27d332767fd817b8208feeb2..bb9999ce0b1ba8095a511ca4a7280b7c379c3218 100644 (file)
@@ -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