
from oslo_log import log

from neutron._i18n import _LI
from neutron import manager
from neutron import service

LOG = log.getLogger(__name__)


def eventlet_rpc_server():
    LOG.info(_LI("Eventlet based AMQP RPC server starting..."))

    try:
        manager.init()
        workers = service._get_rpc_workers() + service._get_plugins_workers()
        rpc_workers_launcher = service._start_workers(workers)
    except NotImplementedError:
        LOG.info(_LI("RPC was already started in parent process by "
                     "plugin."))
    else:
        rpc_workers_launcher.wait()


from oslo_log import log

from neutron._i18n import _LI
from neutron import manager
from neutron import service

LOG = log.getLogger(__name__)


def eventlet_rpc_server():
    LOG.info(_LI("Eventlet based AMQP RPC server starting..."))

    try:
        manager.init()
        rpc_workers_launcher = service.start_all_workers()
    except NotImplementedError:
        LOG.info(_LI("RPC was already started in parent process by "
                     "plugin."))
    else:
        rpc_workers_launcher.wait()

Switch to start_all_workers in RPC server
Switch to start_all_workers in RPC server

This does the same as the logic present but it emits
the registry callback event for resources.PROCESS AFTER_SPAWN
that some plugins may be expecting.

Change-Id: I6f9aeca753a5d3c0052f553a2ac46786ca113e1e
Related-Bug: #1687896

  
  from oslo_log import log
  
  from neutron._i18n import _LI
  from neutron import manager
  from neutron import service
  
  LOG = log.getLogger(__name__)
  
  
  def eventlet_rpc_server():
      LOG.info(_LI("Eventlet based AMQP RPC server starting..."))
  
      try:
          manager.init()
-         workers = service._get_rpc_workers() + service._get_plugins_workers()
-         rpc_workers_launcher = service._start_workers(workers)
+         rpc_workers_launcher = service.start_all_workers()
      except NotImplementedError:
          LOG.info(_LI("RPC was already started in parent process by "
                       "plugin."))
      else:
          rpc_workers_launcher.wait()
  
Switch to start_all_workers in RPC server
## Code Before:

from oslo_log import log

from neutron._i18n import _LI
from neutron import manager
from neutron import service

LOG = log.getLogger(__name__)


def eventlet_rpc_server():
    LOG.info(_LI("Eventlet based AMQP RPC server starting..."))

    try:
        manager.init()
        workers = service._get_rpc_workers() + service._get_plugins_workers()
        rpc_workers_launcher = service._start_workers(workers)
    except NotImplementedError:
        LOG.info(_LI("RPC was already started in parent process by "
                     "plugin."))
    else:
        rpc_workers_launcher.wait()

## Instruction:
Switch to start_all_workers in RPC server
## Code After:

from oslo_log import log

from neutron._i18n import _LI
from neutron import manager
from neutron import service

LOG = log.getLogger(__name__)


def eventlet_rpc_server():
    LOG.info(_LI("Eventlet based AMQP RPC server starting..."))

    try:
        manager.init()
        rpc_workers_launcher = service.start_all_workers()
    except NotImplementedError:
        LOG.info(_LI("RPC was already started in parent process by "
                     "plugin."))
    else:
        rpc_workers_launcher.wait()
