def main():
    """Main method for syncing neutron networks and ports with ovn nb db.

    The utility syncs neutron db with ovn nb db.
    """
    conf = setup_conf()

    # if no config file is passed or no configuration options are passed
    # then load configuration from /etc/neutron/neutron.conf
    try:
        conf(project='neutron')
    except TypeError:
        LOG.error(_LE('Error parsing the configuration values. '
                      'Please verify.'))
        return

    logging.setup(conf, 'neutron_ovn_db_sync_util')
    LOG.info(_LI('Started Neutron OVN db sync'))
    mode = ovn_config.get_ovn_neutron_sync_mode()
    if mode not in [ovn_nb_sync.SYNC_MODE_LOG, ovn_nb_sync.SYNC_MODE_REPAIR]:
        LOG.error(_LE('Invalid sync mode : ["%s"]. Should be "log" or '
                      '"repair"'), mode)
        return

    # we dont want the service plugins to be loaded.
    conf.service_plugins = []
    ovn_plugin = manager.NeutronManager.get_plugin()
    try:
        ovn_plugin._ovn = impl_idl_ovn.OvsdbOvnIdl(ovn_plugin)
    except RuntimeError:
        LOG.error(_LE('Invalid --ovn-ovsdb_connection parameter provided.'))
        return

    synchronizer = ovn_nb_sync.OvnNbSynchronizer(
        ovn_plugin, ovn_plugin._ovn, mode)

    ctx = context.get_admin_context()

    LOG.info(_LI('Syncing the networks and ports with mode : %s'), mode)
    try:
        synchronizer.sync_networks_and_ports(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  the networks and ports. Check the "
                          "--database-connection value again"))
        return
    try:
        synchronizer.sync_acls(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  ACLs for unknown reason "
                          "please try again"))
        return
    try:
        synchronizer.sync_routers_and_rports(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  Routers and Router ports "
                          "please try again"))
        return
    LOG.info(_LI('Sync completed'))
Example #2
0
 def __init__(self):
     LOG.info(_LI("Starting OVNL3RouterPlugin"))
     super(OVNL3RouterPlugin, self).__init__()
     self._nb_ovn_idl = None
     self._sb_ovn_idl = None
     self._plugin_property = None
     self.scheduler = l3_ovn_scheduler.get_scheduler()
Example #3
0
 def set_port_status_up(self, port_id):
     # Port provisioning is complete now that OVN has reported
     # that the port is up.
     LOG.info(_LI("OVN reports status up for port: %s"), port_id)
     provisioning_blocks.provisioning_complete(
         n_context.get_admin_context(), port_id, resources.PORT, provisioning_blocks.L2_AGENT_ENTITY
     )
Example #4
0
 def set_port_status_up(self, port_id):
     # Port provisioning is complete now that OVN has reported
     # that the port is up.
     LOG.info(_LI("OVN reports status up for port: %s"), port_id)
     provisioning_blocks.provisioning_complete(
         n_context.get_admin_context(), port_id, resources.PORT,
         provisioning_blocks.L2_AGENT_ENTITY)
Example #5
0
 def __init__(self):
     LOG.info(_LI("Starting OVNL3RouterPlugin"))
     super(OVNL3RouterPlugin, self).__init__()
     self._nb_ovn_idl = None
     self._sb_ovn_idl = None
     self._plugin_property = None
     self.scheduler = l3_ovn_scheduler.get_scheduler()
Example #6
0
 def set_port_status_up(self, port_id):
     # Port provisioning is complete now that OVN has reported that the
     # port is up. Any provisioning block (possibly added during port
     # creation or when OVN reports that the port is down) must be removed.
     LOG.info(_LI("OVN reports status up for port: %s"), port_id)
     provisioning_blocks.provisioning_complete(
         n_context.get_admin_context(), port_id, resources.PORT,
         provisioning_blocks.L2_AGENT_ENTITY)
Example #7
0
 def set_port_status_up(self, port_id):
     # Port provisioning is complete now that OVN has reported that the
     # port is up. Any provisioning block (possibly added during port
     # creation or when OVN reports that the port is down) must be removed.
     LOG.info(_LI("OVN reports status up for port: %s"), port_id)
     provisioning_blocks.provisioning_complete(
         n_context.get_admin_context(),
         port_id,
         resources.PORT,
         provisioning_blocks.L2_AGENT_ENTITY)
Example #8
0
    def initialize(self):
        """Perform driver initialization.

        Called after all drivers have been loaded and the database has
        been initialized. No abstract methods defined below will be
        called prior to this method being called.
        """
        LOG.info(_LI("Starting OVNMechanismDriver"))
        self._plugin_property = None
        self._setup_vif_port_bindings()
        self.subscribe()
    def initialize(self):
        """Perform driver initialization.

        Called after all drivers have been loaded and the database has
        been initialized. No abstract methods defined below will be
        called prior to this method being called.
        """
        LOG.info(_LI("Starting OVNMechanismDriver"))
        self._plugin_property = None
        self._setup_vif_port_bindings()
        self.subscribe()
Example #10
0
    def initialize(self):
        """Perform driver initialization.

        Called after all drivers have been loaded and the database has
        been initialized. No abstract methods defined below will be
        called prior to this method being called.
        """
        LOG.info(_LI("Starting OVNMechanismDriver"))
        self._nb_ovn = None
        self._sb_ovn = None
        self._plugin_property = None
        self.sg_enabled = ovn_acl.is_sg_enabled()
        if cfg.CONF.SECURITYGROUP.firewall_driver:
            LOG.warning(_LW('Firewall driver configuration is ignored'))
        self._setup_vif_port_bindings()
        self.subscribe()
        self.qos_driver = qos_driver.OVNQosDriver(self)
Example #11
0
 def set_port_status_down(self, port_id):
     # Port provisioning is required now that OVN has reported that the
     # port is down. Insert a provisioning block and mark the port down
     # in neutron. The block is inserted before the port status update
     # to prevent another entity from bypassing the block with its own
     # port status update.
     LOG.info(_LI("OVN reports status down for port: %s"), port_id)
     admin_context = n_context.get_admin_context()
     try:
         port = self._plugin.get_port(admin_context, port_id)
         port['status'] = const.PORT_STATUS_DOWN
         self._insert_port_provisioning_block(admin_context, port)
         self._plugin.update_port_status(admin_context, port['id'],
                                         const.PORT_STATUS_DOWN)
     except (os_db_exc.DBReferenceError, n_exc.PortNotFound):
         LOG.debug("Port not found during OVN status down report: %s",
                   port_id)
Example #12
0
    def initialize(self):
        """Perform driver initialization.

        Called after all drivers have been loaded and the database has
        been initialized. No abstract methods defined below will be
        called prior to this method being called.
        """
        LOG.info(_LI("Starting OVNMechanismDriver"))
        self._nb_ovn = None
        self._sb_ovn = None
        self._plugin_property = None
        self.sg_enabled = ovn_acl.is_sg_enabled()
        if cfg.CONF.SECURITYGROUP.firewall_driver:
            LOG.warning(_LW('Firewall driver configuration is ignored'))
        self._setup_vif_port_bindings()
        self.subscribe()
        self.qos_driver = qos_driver.OVNQosDriver(self)
Example #13
0
    def __init__(self):
        super(OVNPlugin, self).__init__()
        LOG.info(_LI("Starting OVNPlugin"))
        self.vif_type = portbindings.VIF_TYPE_OVS
        self.base_binding_dict = {
            portbindings.VIF_TYPE: portbindings.VIF_TYPE_OVS,
            portbindings.VIF_DETAILS: {
                # TODO(rkukura): Replace with new VIF security details
                portbindings.CAP_PORT_FILTER:
                'security-group' in self.supported_extension_aliases}}

        # When set to True, Nova plugs the VIF directly into the ovs bridge
        # instead of using the hybrid mode.
        self.vif_details = {portbindings.CAP_PORT_FILTER: True}
        registry.subscribe(self.post_fork_initialize, resources.PROCESS,
                           events.AFTER_CREATE)
        self._setup_dhcp()
        self._start_rpc_notifiers()
Example #14
0
 def set_port_status_down(self, port_id):
     # Port provisioning is required now that OVN has reported that the
     # port is down. Insert a provisioning block and mark the port down
     # in neutron. The block is inserted before the port status update
     # to prevent another entity from bypassing the block with its own
     # port status update.
     LOG.info(_LI("OVN reports status down for port: %s"), port_id)
     admin_context = n_context.get_admin_context()
     try:
         port = self._plugin.get_port(admin_context, port_id)
         port['status'] = const.PORT_STATUS_DOWN
         self._insert_port_provisioning_block(admin_context, port)
         self._plugin.update_port_status(admin_context,
                                         port['id'],
                                         const.PORT_STATUS_DOWN)
     except (os_db_exc.DBReferenceError, n_exc.PortNotFound):
         LOG.debug("Port not found during OVN status down report: %s",
                   port_id)
Example #15
0
def main():
    """Main method for syncing neutron networks and ports with ovn nb db.

    The utility syncs neutron db with ovn nb db.
    """
    conf = setup_conf()

    # if no config file is passed or no configuration options are passed
    # then load configuration from /etc/neutron/neutron.conf
    try:
        conf(project='neutron')
    except TypeError:
        LOG.error(
            _LE('Error parsing the configuration values. '
                'Please verify.'))
        return

    logging.setup(conf, 'neutron_ovn_db_sync_util')
    LOG.info(_LI('Started Neutron OVN db sync'))
    mode = ovn_config.get_ovn_neutron_sync_mode()
    if mode not in [ovn_nb_sync.SYNC_MODE_LOG, ovn_nb_sync.SYNC_MODE_REPAIR]:
        LOG.error(
            _LE('Invalid sync mode : ["%s"]. Should be "log" or '
                '"repair"'), mode)
        return

    # we dont want the service plugins to be loaded.
    conf.service_plugins = []
    ovn_plugin = manager.NeutronManager.get_plugin()
    try:
        ovn_plugin._ovn = impl_idl_ovn.OvsdbOvnIdl(ovn_plugin)
    except RuntimeError:
        LOG.error(_LE('Invalid --ovn-ovsdb_connection parameter provided.'))
        return

    synchronizer = ovn_nb_sync.OvnNbSynchronizer(ovn_plugin, ovn_plugin._ovn,
                                                 mode)

    ctx = context.get_admin_context()

    LOG.info(_LI('Syncing the networks and ports with mode : %s'), mode)
    try:
        synchronizer.sync_networks_and_ports(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  the networks and ports. Check the "
                "--database-connection value again"))
        return
    try:
        synchronizer.sync_acls(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  ACLs for unknown reason "
                "please try again"))
        return
    try:
        synchronizer.sync_routers_and_rports(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  Routers and Router ports "
                "please try again"))
        return
    LOG.info(_LI('Sync completed'))
def main():
    """Main method for syncing neutron networks and ports with ovn nb db.

    The utility syncs neutron db with ovn nb db.
    """
    conf = setup_conf()

    # if no config file is passed or no configuration options are passed
    # then load configuration from /etc/neutron/neutron.conf
    try:
        conf(project='neutron')
    except TypeError:
        LOG.error(_LE('Error parsing the configuration values. '
                      'Please verify.'))
        return

    logging.setup(conf, 'neutron_ovn_db_sync_util')
    LOG.info(_LI('Started Neutron OVN db sync'))
    mode = ovn_config.get_ovn_neutron_sync_mode()
    if mode not in [ovn_db_sync.SYNC_MODE_LOG, ovn_db_sync.SYNC_MODE_REPAIR]:
        LOG.error(_LE('Invalid sync mode : ["%s"]. Should be "log" or '
                      '"repair"'), mode)
        return

    # Validate and modify core plugin and ML2 mechanism drivers for syncing.
    if cfg.CONF.core_plugin.endswith('.Ml2Plugin'):
        cfg.CONF.core_plugin = (
            'networking_ovn.cmd.neutron_ovn_db_sync_util.Ml2Plugin')
        if 'ovn' not in cfg.CONF.ml2.mechanism_drivers:
            LOG.error(_LE('No "ovn" mechanism driver found : "%s".'),
                      cfg.CONF.ml2.mechanism_drivers)
            return
        cfg.CONF.set_override('mechanism_drivers', ['ovn-sync'], 'ml2')
        conf.service_plugins = ['networking_ovn.l3.l3_ovn.OVNL3RouterPlugin']
    else:
        LOG.error(_LE('Invalid core plugin : ["%s"].'), cfg.CONF.core_plugin)
        return

    try:
        ovn_api = impl_idl_ovn.OvsdbNbOvnIdl(None)
    except RuntimeError:
        LOG.error(_LE('Invalid --ovn-ovn_nb_connection parameter provided.'))
        return

    core_plugin = manager.NeutronManager.get_plugin()
    ovn_driver = core_plugin.mechanism_manager.mech_drivers['ovn-sync'].obj
    ovn_driver._nb_ovn = ovn_api

    synchronizer = ovn_db_sync.OvnNbSynchronizer(
        core_plugin, ovn_api, mode, ovn_driver)

    ctx = context.get_admin_context()

    LOG.info(_LI('Syncing the networks and ports with mode : %s'), mode)
    try:
        synchronizer.sync_address_sets(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  the Address Sets. Check the "
                          "--database-connection value again"))
        return
    try:
        synchronizer.sync_networks_ports_and_dhcp_opts(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  Networks, Ports and DHCP options "
                          "for unknown reason please try again"))
        return
    try:
        synchronizer.sync_acls(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  ACLs for unknown "
                          "reason please try again"))
        return
    try:
        synchronizer.sync_routers_and_rports(ctx)
    except Exception:
        LOG.exception(_LE("Error syncing  Routers and Router ports "
                          "please try again"))
        return
    LOG.info(_LI('Sync completed'))
Example #17
0
 def _sb_ovn(self):
     if self._sb_ovn_idl is None:
         LOG.info(_LI("Getting OvsdbSbOvnIdl"))
         self._sb_ovn_idl = impl_idl_ovn.OvsdbSbOvnIdl(self)
     return self._sb_ovn_idl
Example #18
0
    def bind_port(self, context):
        """Attempt to bind a port.

        :param context: PortContext instance describing the port

        This method is called outside any transaction to attempt to
        establish a port binding using this mechanism driver. Bindings
        may be created at each of multiple levels of a hierarchical
        network, and are established from the top level downward. At
        each level, the mechanism driver determines whether it can
        bind to any of the network segments in the
        context.segments_to_bind property, based on the value of the
        context.host property, any relevant port or network
        attributes, and its own knowledge of the network topology. At
        the top level, context.segments_to_bind contains the static
        segments of the port's network. At each lower level of
        binding, it contains static or dynamic segments supplied by
        the driver that bound at the level above. If the driver is
        able to complete the binding of the port to any segment in
        context.segments_to_bind, it must call context.set_binding
        with the binding details. If it can partially bind the port,
        it must call context.continue_binding with the network
        segments to be used to bind at the next lower level.

        If the binding results are committed after bind_port returns,
        they will be seen by all mechanism drivers as
        update_port_precommit and update_port_postcommit calls. But if
        some other thread or process concurrently binds or updates the
        port, these binding results will not be committed, and
        update_port_precommit and update_port_postcommit will not be
        called on the mechanism drivers with these results. Because
        binding results can be discarded rather than committed,
        drivers should avoid making persistent state changes in
        bind_port, or else must ensure that such state changes are
        eventually cleaned up.

        Implementing this method explicitly declares the mechanism
        driver as having the intention to bind ports. This is inspected
        by the QoS service to identify the available QoS rules you
        can use with ports.
        """
        port = context.current
        vnic_type = port.get(portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL)
        if vnic_type not in self.supported_vnic_types:
            LOG.debug('Refusing to bind port %(port_id)s due to unsupported '
                      'vnic_type: %(vnic_type)s' % {
                          'port_id': port['id'],
                          'vnic_type': vnic_type
                      })
            return

        for segment_to_bind in context.segments_to_bind:
            network_type = segment_to_bind['network_type']
            segmentation_id = segment_to_bind['segmentation_id']
            physical_network = segment_to_bind['physical_network']
            LOG.debug(
                'Attempting to bind port %(port_id)s for network '
                'segment with type %(network_type)s, '
                'segmentation ID %(segmentation_id)s, '
                'physical network %(physical_network)s' % {
                    'port_id': port['id'],
                    'network_type': network_type,
                    'segmentation_id': segmentation_id,
                    'physical_network': physical_network
                })
            # TODO(rtheis): This scenario is only valid on an upgrade from
            # neutron ML2 OVS since invalid network types are prevented during
            # network creation and update. The upgrade should convert invalid
            # network types. Once bug/1621879 is fixed, refuse to bind
            # ports with unsupported network types.
            if not self._is_network_type_supported(network_type):
                LOG.info(
                    _LI('Upgrade allowing bind port %(port_id)s with '
                        'unsupported network type: %(network_type)s'), {
                            'port_id': port['id'],
                            'network_type': network_type
                        })
            if self.vif_type == portbindings.VIF_TYPE_VHOST_USER:
                port[portbindings.VIF_DETAILS].update({
                    portbindings.VHOST_USER_SOCKET:
                    utils.ovn_vhu_sockpath(cfg.CONF.ovn.vhost_sock_dir,
                                           port['id'])
                })
            context.set_binding(segment_to_bind[driver_api.ID], self.vif_type,
                                self.vif_details)
Example #19
0
 def set_port_status_down(self, port_id):
     LOG.info(_LI("OVN reports status down for port: %s"), port_id)
     self._plugin.update_port_status(n_context.get_admin_context(), port_id,
                                     const.PORT_STATUS_DOWN)
Example #20
0
 def _ovn(self):
     if self._nb_ovn is None:
         LOG.info(_LI("Getting OvsdbNbOvnIdl"))
         self._nb_ovn = impl_idl_ovn.OvsdbNbOvnIdl(self)
     return self._nb_ovn
Example #21
0
 def set_port_status_down(self, port_id):
     LOG.info(_LI("OVN reports status down for port: %s"), port_id)
     self._plugin.update_port_status(n_context.get_admin_context(), port_id, const.PORT_STATUS_DOWN)
 def get_ovn_idl_retry(cls, driver, trigger):
     LOG.info(_LI('Getting %(cls)s for %(trigger)s with retry'),
              {'cls': cls.__name__, 'trigger': trigger.im_class.__name__})
     return cls(driver, trigger)
Example #23
0
    def bind_port(self, context):
        """Attempt to bind a port.

        :param context: PortContext instance describing the port

        This method is called outside any transaction to attempt to
        establish a port binding using this mechanism driver. Bindings
        may be created at each of multiple levels of a hierarchical
        network, and are established from the top level downward. At
        each level, the mechanism driver determines whether it can
        bind to any of the network segments in the
        context.segments_to_bind property, based on the value of the
        context.host property, any relevant port or network
        attributes, and its own knowledge of the network topology. At
        the top level, context.segments_to_bind contains the static
        segments of the port's network. At each lower level of
        binding, it contains static or dynamic segments supplied by
        the driver that bound at the level above. If the driver is
        able to complete the binding of the port to any segment in
        context.segments_to_bind, it must call context.set_binding
        with the binding details. If it can partially bind the port,
        it must call context.continue_binding with the network
        segments to be used to bind at the next lower level.

        If the binding results are committed after bind_port returns,
        they will be seen by all mechanism drivers as
        update_port_precommit and update_port_postcommit calls. But if
        some other thread or process concurrently binds or updates the
        port, these binding results will not be committed, and
        update_port_precommit and update_port_postcommit will not be
        called on the mechanism drivers with these results. Because
        binding results can be discarded rather than committed,
        drivers should avoid making persistent state changes in
        bind_port, or else must ensure that such state changes are
        eventually cleaned up.

        Implementing this method explicitly declares the mechanism
        driver as having the intention to bind ports. This is inspected
        by the QoS service to identify the available QoS rules you
        can use with ports.
        """
        port = context.current
        vnic_type = port.get(portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL)
        if vnic_type not in self.supported_vnic_types:
            LOG.debug('Refusing to bind port %(port_id)s due to unsupported '
                      'vnic_type: %(vnic_type)s' %
                      {'port_id': port['id'], 'vnic_type': vnic_type})
            return

        for segment_to_bind in context.segments_to_bind:
            network_type = segment_to_bind['network_type']
            segmentation_id = segment_to_bind['segmentation_id']
            physical_network = segment_to_bind['physical_network']
            LOG.debug('Attempting to bind port %(port_id)s for network '
                      'segment with type %(network_type)s, '
                      'segmentation ID %(segmentation_id)s, '
                      'physical network %(physical_network)s' %
                      {'port_id': port['id'],
                       'network_type': network_type,
                       'segmentation_id': segmentation_id,
                       'physical_network': physical_network})
            # TODO(rtheis): This scenario is only valid on an upgrade from
            # neutron ML2 OVS since invalid network types are prevented during
            # network creation and update. The upgrade should convert invalid
            # network types. Once bug/1621879 is fixed, refuse to bind
            # ports with unsupported network types.
            if not self._is_network_type_supported(network_type):
                LOG.info(_LI('Upgrade allowing bind port %(port_id)s with '
                             'unsupported network type: %(network_type)s'),
                         {'port_id': port['id'],
                          'network_type': network_type})
            if self.vif_type == portbindings.VIF_TYPE_VHOST_USER:
                port[portbindings.VIF_DETAILS].update({
                    portbindings.VHOST_USER_SOCKET: utils.ovn_vhu_sockpath(
                        cfg.CONF.ovn.vhost_sock_dir, port['id'])
                    })
            context.set_binding(segment_to_bind[driver_api.ID],
                                self.vif_type,
                                self.vif_details)
Example #24
0
 def __init__(self):
     LOG.info(_LI("Starting OVNL3RouterPlugin"))
     super(OVNL3RouterPlugin, self).__init__()
     self._ovn_property = None
     self._plugin_property = None
Example #25
0
 def __init__(self, driver):
     LOG.info(_LI("Starting OVNQosDriver"))
     super(OVNQosDriver, self).__init__()
     self._driver = driver
     self._plugin_property = None
Example #26
0
 def _ovn(self):
     if self._ovn_property is None:
         LOG.info(_LI("Getting OvsdbOvnIdl"))
         self._ovn_property = impl_idl_ovn.OvsdbOvnIdl(self)
     return self._ovn_property
Example #27
0
 def _ovn(self):
     if self._nb_ovn is None:
         LOG.info(_LI("Getting OvsdbNbOvnIdl"))
         self._nb_ovn = impl_idl_ovn.OvsdbNbOvnIdl(self)
     return self._nb_ovn
Example #28
0
def main():
    """Main method for syncing neutron networks and ports with ovn nb db.

    The utility syncs neutron db with ovn nb db.
    """
    conf = setup_conf()

    # if no config file is passed or no configuration options are passed
    # then load configuration from /etc/neutron/neutron.conf
    try:
        conf(project='neutron')
    except TypeError:
        LOG.error(
            _LE('Error parsing the configuration values. '
                'Please verify.'))
        return

    logging.setup(conf, 'neutron_ovn_db_sync_util')
    LOG.info(_LI('Started Neutron OVN db sync'))
    mode = ovn_config.get_ovn_neutron_sync_mode()
    if mode not in [ovn_db_sync.SYNC_MODE_LOG, ovn_db_sync.SYNC_MODE_REPAIR]:
        LOG.error(
            _LE('Invalid sync mode : ["%s"]. Should be "log" or '
                '"repair"'), mode)
        return

    # Validate and modify core plugin and ML2 mechanism drivers for syncing.
    if cfg.CONF.core_plugin.endswith('.Ml2Plugin'):
        cfg.CONF.core_plugin = (
            'networking_ovn.cmd.neutron_ovn_db_sync_util.Ml2Plugin')
        if 'ovn' not in cfg.CONF.ml2.mechanism_drivers:
            LOG.error(_LE('No "ovn" mechanism driver found : "%s".'),
                      cfg.CONF.ml2.mechanism_drivers)
            return
        cfg.CONF.set_override('mechanism_drivers', ['ovn-sync'], 'ml2')
        conf.service_plugins = ['networking_ovn.l3.l3_ovn.OVNL3RouterPlugin']
    else:
        LOG.error(_LE('Invalid core plugin : ["%s"].'), cfg.CONF.core_plugin)
        return

    try:
        ovn_api = impl_idl_ovn.OvsdbNbOvnIdl(None)
    except RuntimeError:
        LOG.error(_LE('Invalid --ovn-ovn_nb_connection parameter provided.'))
        return

    core_plugin = manager.NeutronManager.get_plugin()
    ovn_driver = core_plugin.mechanism_manager.mech_drivers['ovn-sync'].obj
    ovn_driver._nb_ovn = ovn_api

    synchronizer = ovn_db_sync.OvnNbSynchronizer(core_plugin, ovn_api, mode,
                                                 ovn_driver)

    ctx = context.get_admin_context()

    LOG.info(_LI('Syncing the networks and ports with mode : %s'), mode)
    try:
        synchronizer.sync_address_sets(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  the Address Sets. Check the "
                "--database-connection value again"))
        return
    try:
        synchronizer.sync_networks_ports_and_dhcp_opts(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  Networks, Ports and DHCP options "
                "for unknown reason please try again"))
        return
    try:
        synchronizer.sync_acls(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  ACLs for unknown "
                "reason please try again"))
        return
    try:
        synchronizer.sync_routers_and_rports(ctx)
    except Exception:
        LOG.exception(
            _LE("Error syncing  Routers and Router ports "
                "please try again"))
        return
    LOG.info(_LI('Sync completed'))
Example #29
0
 def __init__(self, driver):
     LOG.info(_LI("Starting OVNQosDriver"))
     super(OVNQosDriver, self).__init__()
     self._driver = driver
     self._plugin_property = None
Example #30
0
 def _sb_ovn(self):
     if self._sb_ovn_idl is None:
         LOG.info(_LI("Getting OvsdbSbOvnIdl"))
         self._sb_ovn_idl = impl_idl_ovn.OvsdbSbOvnIdl(self)
     return self._sb_ovn_idl
Example #31
0
 def get_ovn_idl_retry(cls, driver, trigger):
     LOG.info(_LI('Getting %(cls)s for %(trigger)s with retry'), {
         'cls': cls.__name__,
         'trigger': trigger.__name__
     })
     return cls(driver, trigger)