diff mbox series

[ovs-dev] northd: Allow multichassis port to be bound on remote chassis.

Message ID 20241009080656.605381-1-amusil@redhat.com
State New
Headers show
Series [ovs-dev] northd: Allow multichassis port to be bound on remote chassis. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil Oct. 9, 2024, 8:06 a.m. UTC
In order to support tunneling with multichassis port across
multiple AZ allow the port to be bound to remote chassis if
there is multiple chassis requested.

Reported-at: https://issues.redhat.com/browse/FDP-850
Signed-off-by: Ales Musil <amusil@redhat.com>
---
 northd/northd.c | 16 ++++++++--------
 tests/ovn.at    | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 8 deletions(-)

Comments

Dumitru Ceara Oct. 10, 2024, 10:55 a.m. UTC | #1
On 10/9/24 10:06, Ales Musil wrote:
> In order to support tunneling with multichassis port across
> multiple AZ allow the port to be bound to remote chassis if
> there is multiple chassis requested.
> 
> Reported-at: https://issues.redhat.com/browse/FDP-850
> Signed-off-by: Ales Musil <amusil@redhat.com>
> ---

With https://github.com/ovn-org/ovn-kubernetes/pull/4742 ovn-kubernetes
CI should be more stable.  Triggering a re-test.

Recheck-request: github-robot

Regards,
Dumitru
diff mbox series

Patch

diff --git a/northd/northd.c b/northd/northd.c
index 0aa0de637..964cac114 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -3197,25 +3197,25 @@  ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn,
                 }
             }
 
-            if (lsp_is_remote(op->nbsp)) {
+            if (lsp_is_remote(op->nbsp) ||
+                op->sb->requested_additional_chassis) {
                 /* ovn-northd is supposed to set port_binding for remote ports
-                 * if requested chassis is marked as remote. */
+                 * if requested chassis is marked as remote. In addition,
+                 * if the primary chassis is remote bind it.*/
                 if (op->sb->requested_chassis &&
                     smap_get_bool(&op->sb->requested_chassis->other_config,
                                   "is-remote", false)) {
                     sbrec_port_binding_set_chassis(op->sb,
                                                    op->sb->requested_chassis);
-                    smap_add(&options, "is-remote-nb-bound", "true");
-                } else if (smap_get_bool(&op->sb->options,
-                                         "is-remote-nb-bound", false)) {
+                } else {
                     sbrec_port_binding_set_chassis(op->sb, NULL);
-                    smap_add(&options, "is-remote-nb-bound", "false");
                 }
             } else if (op->sb->chassis &&
                        smap_get_bool(&op->sb->chassis->other_config,
                                      "is-remote", false)) {
-                /* Its not a remote port but if the chassis is set and if its a
-                 * remote chassis then clear it. */
+                /* It's not a remote port but if the chassis is set and if
+                 * it's a remote chassis, and we don't have any additional
+                 * chassis then clear it. */
                 sbrec_port_binding_set_chassis(op->sb, NULL);
             }
 
diff --git a/tests/ovn.at b/tests/ovn.at
index 4e8c5bd8a..0eb7c6c8d 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -39027,3 +39027,53 @@  OVN_CLEANUP([hv1],[hv2])
 
 AT_CLEANUP
 ])
+
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([Multichassis port with remote chassis])
+ovn_start
+
+net_add n1
+
+sim_add hv1
+as hv1
+check ovs-vsctl add-br br-phys
+ovn_attach n1 br-phys 192.168.0.11
+
+check ovn-sbctl chassis-add hv2 geneve 192.168.0.12 \
+    -- set chassis hv2 other_config:is-remote=true
+
+check ovn-nbctl ls-add ls
+check ovn-nbctl lsp-add ls multi
+
+check ovs-vsctl -- add-port br-int multi \
+    -- set Interface multi external-ids:iface-id=multi
+
+local_chassis=$(fetch_column Chassis _uuid name=hv1)
+remote_chassis=$(fetch_column Chassis _uuid name=hv2)
+
+check ovn-nbctl --wait=hv lsp-set-options multi requested-chassis=hv1
+wait_for_ports_up multi
+
+# Check that it is bound locally
+check_column $local_chassis Port_Binding chassis logical_port=multi
+check_column "[]" Port_Binding additional_chassis logical_port=multi
+
+check ovn-nbctl --wait=hv lsp-set-options multi requested-chassis=hv2,hv1
+wait_for_ports_up multi
+
+# Check that it is bound on remote as primary and additional locally
+check_column $remote_chassis Port_Binding chassis logical_port=multi
+check_column "[$local_chassis]" Port_Binding additional_chassis logical_port=multi
+
+check ovn-nbctl --wait=hv lsp-set-options multi requested-chassis=hv2 \
+    -- lsp-set-type multi remote
+wait_for_ports_up multi
+
+# Check that it is bound remotely
+check_column $remote_chassis Port_Binding chassis logical_port=multi
+check_column "[]" Port_Binding additional_chassis logical_port=multi
+
+OVN_CLEANUP([hv1])
+
+AT_CLEANUP
+])