From f1de2e4ea1dedde3a4be115d46439693cc2c2571 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 15 Jul 2025 11:11:14 -0500 Subject: [PATCH] [OVN]: fix ovn-db-sync to include gateway chassis When we sync the SegmentHostMappings with the OVN southbound on start up, the chassis that are a gateway are being skipped from updating. The rest of the code base includes those in writing to the SegmentHostMappings so we should keep those in sync on ovn-db-sync as well. Closes-Bug: #2116960 Change-Id: Ie1b375f5c23864d7fa17c9dd05f0453b439835f1 Signed-off-by: Doug Goldstein --- .../ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py | 2 +- .../ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py | 2 +- .../notes/ovn-db-sync-gw-agent-cd049668511ac730.yaml | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/ovn-db-sync-gw-agent-cd049668511ac730.yaml diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py index c3cc5cf4cff..ce381891904 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py @@ -1448,7 +1448,7 @@ class OvnSbSynchronizer(OvnDbSynchronizer): host_phynets_map = self.ovn_api.get_chassis_hostname_and_physnets() current_hosts = set(host_phynets_map) previous_hosts = segments_db.get_hosts_mapped_with_segments( - ctx, include_agent_types={ovn_const.OVN_CONTROLLER_AGENT}) + ctx, include_agent_types=set(ovn_const.OVN_CONTROLLER_TYPES)) stale_hosts = previous_hosts - current_hosts for host in stale_hosts: diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py index 39d1d1e7de3..370bfd06d85 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_db_sync.py @@ -1241,7 +1241,7 @@ class TestOvnSbSyncML2(test_mech_driver.OVNMechanismDriverTestCase): return_value=hosts_in_neutron) as mock_ghmws: ovn_sb_synchronizer.sync_hostname_and_physical_networks(mock.ANY) mock_ghmws.assert_called_once_with( - mock.ANY, include_agent_types={ovn_const.OVN_CONTROLLER_AGENT}) + mock.ANY, include_agent_types=set(ovn_const.OVN_CONTROLLER_TYPES)) all_hosts = set(hostname_with_physnets.keys()) | hosts_in_neutron self.assertEqual( len(all_hosts), diff --git a/releasenotes/notes/ovn-db-sync-gw-agent-cd049668511ac730.yaml b/releasenotes/notes/ovn-db-sync-gw-agent-cd049668511ac730.yaml new file mode 100644 index 00000000000..babb0015d6d --- /dev/null +++ b/releasenotes/notes/ovn-db-sync-gw-agent-cd049668511ac730.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + ``ovn-db-sync`` skipped chassis that were also gateways for syncing the + segment host mappings but all other operations included them so add syncing + them to ``ovn-db-sync``. For more information see bug + `2116960 `_.