Jump to: navigation, search

CommonServiceInfrastructure

A Common Service Infrastructure API

Nova has some core infrastructure code for all its services which is broadly applicable to most OpenStack projects. This blueprint aims to move that code into openstack-common and rework it to be generally useful.

The main abstractions we're implementing are ...

Launcher

The Launcher class has the following methods:


launch_service(service)
stop()
wait()


A launcher can be responsible for multiple services.

There are two subclasses of Launcher. The first - ServiceLauncher - handles a TERM/INT signal by stopping the services. The second - ProcessLauncher - will start a number of child processes, each child process running the service.

Service

A Service class with the following methods:


start()
stop()
wait()


A service has a thread group whose members are stopped when the service is stopped.

Service objects have an init() method which sub-classes can override.

Service should also have support for running periodic tasks on the RPC manager or WSGI application associated which the service exposes. A timer thread is spawned from the service's thread group which runs the @periodic_task decorated methods on the manager or application object.

RPC Service

The rpc.Service sub-class of Service is associated with a Manager object.

It creates an RPC dispatcher which exposes all of the Manager's public methods over RPC via a given topic.

All RPC calls should be handled in a thread spawned from the service's thread group.

WSGI Service

The wsgi.Service sub-class of Service is associated with a WSGI application.

It exposes the application a given port and spawns threads from the service's thread group to handle requests.