Example #1
0
    def post_fork_initialize(self, resource, event, trigger, payload=None):
        # NOTE(rtheis): This will initialize all workers (API, RPC,
        # plugin service and OVN) with OVN IDL connections.
        self._post_fork_event.clear()
        self._ovn_client_inst = None
        self._nb_ovn, self._sb_ovn = impl_idl_ovn.get_ovn_idls(self, trigger)
        # Now IDL connections can be safely used.
        self._post_fork_event.set()

        if trigger.im_class == ovsdb_monitor.OvnWorker:
            # Call the synchronization task if its ovn worker
            # This sync neutron DB to OVN-NB DB only in inconsistent states
            self.nb_synchronizer = ovn_db_sync.OvnNbSynchronizer(
                self._plugin, self._nb_ovn, config.get_ovn_neutron_sync_mode(),
                self)
            self.nb_synchronizer.sync()

            # This sync neutron DB to OVN-SB DB only in inconsistent states
            self.sb_synchronizer = ovn_db_sync.OvnSbSynchronizer(
                self._plugin, self._sb_ovn, self)
            self.sb_synchronizer.sync()

        if trigger.im_class == maintenance.MaintenanceWorker:
            self._maintenance_thread = maintenance.MaintenanceThread()
            self._maintenance_thread.add_periodics(
                maintenance.DBInconsistenciesPeriodics(self._ovn_client))
            self._maintenance_thread.start()
Example #2
0
 def setUp(self):
     super(TestDBInconsistenciesPeriodics, self).setUp()
     self.net = self._make_network(
         self.fmt, name='net1', admin_state_up=True)['network']
     self.port = self._make_port(
         self.fmt, self.net['id'], name='port1')['port']
     self.fake_ovn_client = mock.Mock()
     self.periodic = maintenance.DBInconsistenciesPeriodics(
         self.fake_ovn_client)
     self.session = db_api.get_writer_session()
Example #3
0
 def setUp(self):
     super(_TestMaintenanceHelper, self).setUp()
     self._ovn_client = self.mech_driver._ovn_client
     self._l3_ovn_client = self.l3_plugin._ovn_client
     ext_mgr = test_extraroute.ExtraRouteTestExtensionManager()
     self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
     sg_mgr = test_securitygroup.SecurityGroupTestExtensionManager()
     self._sg_api = test_extensions.setup_extensions_middleware(sg_mgr)
     self.maint = maintenance.DBInconsistenciesPeriodics(self._ovn_client)
     self.context = n_context.get_admin_context()
Example #4
0
    def post_fork_initialize(self, resource, event, trigger, payload=None):
        # NOTE(rtheis): This will initialize all workers (API, RPC,
        # plugin service and OVN) with OVN IDL connections.
        self._post_fork_event.clear()
        self._ovn_client_inst = None

        is_maintenance = (
            utils.get_method_class(trigger) == worker.MaintenanceWorker)
        if not is_maintenance:
            self.node_uuid = db_hash_ring.add_node(self.hash_ring_group)

        self._nb_ovn, self._sb_ovn = impl_idl_ovn.get_ovn_idls(
            self, trigger, binding_events=not is_maintenance)

        # Override agents API methods
        self.patch_plugin_merge("get_agents", get_agents)
        self.patch_plugin_choose("get_agent", get_agent)
        self.patch_plugin_choose("update_agent", update_agent)
        self.patch_plugin_choose("delete_agent", delete_agent)

        # Now IDL connections can be safely used.
        self._post_fork_event.set()

        if is_maintenance:
            # Call the synchronization task if its maintenance worker
            # This sync neutron DB to OVN-NB DB only in inconsistent states
            self.nb_synchronizer = ovn_db_sync.OvnNbSynchronizer(
                self._plugin, self._nb_ovn, self._sb_ovn,
                config.get_ovn_neutron_sync_mode(), self)
            self.nb_synchronizer.sync()

            # This sync neutron DB to OVN-SB DB only in inconsistent states
            self.sb_synchronizer = ovn_db_sync.OvnSbSynchronizer(
                self._plugin, self._sb_ovn, self)
            self.sb_synchronizer.sync()

            self._maintenance_thread = maintenance.MaintenanceThread()
            self._maintenance_thread.add_periodics(
                maintenance.DBInconsistenciesPeriodics(self._ovn_client))
            self._maintenance_thread.add_periodics(
                maintenance.HashRingHealthCheckPeriodics(self.hash_ring_group))
            self._maintenance_thread.start()