diff --git a/northd/northd.c b/northd/northd.c index 64b2e3859d..aed1d425f4 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -3209,8 +3209,11 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn, "is-remote", false)) { sbrec_port_binding_set_chassis(op->sb, op->sb->requested_chassis); - } else { + smap_add(&options, "is-remote-nb-bound", "true"); + } else if (smap_get_bool(&op->sb->options, + "is-remote-nb-bound", false)) { 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, diff --git a/tests/ovn.at b/tests/ovn.at index 9c1c3d9fdc..39cc79459a 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -39727,3 +39727,37 @@ OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +# ovn-kubernetes used to explicitly set chassis, +# test if we don't accidentally remove it. +OVN_FOR_EACH_NORTHD([ +AT_SETUP([Remote port with explicit SB 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 lsp +check ovn-nbctl --wait=sb lsp-set-type lsp remote + +remote_chassis=$(fetch_column Chassis _uuid name=hv2) +lsp_uuid=$(fetch_column Port_Binding _uuid logical_port=lsp) + +check ovn-sbctl set Port_Binding $lsp_uuid chassis=$remote_chassis + +check ovn-nbctl --wait=hv sync + +check_column $remote_chassis Port_Binding chassis logical_port=lsp + +OVN_CLEANUP([hv1]) + +AT_CLEANUP +])