]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Handle SIGHUP: neutron-server (multiprocess) and metadata agent
authorElena Ezhova <eezhova@mirantis.com>
Tue, 7 Apr 2015 11:58:13 +0000 (14:58 +0300)
committerElena Ezhova <eezhova@mirantis.com>
Tue, 9 Jun 2015 13:15:37 +0000 (16:15 +0300)
commit6d0d72973152bb45587437c80d4ffe0fe7bba761
tree499531ef968582ff2ae847ac32ff89d757956fb5
parentd0bbfc090bb25f1e05b98f0ad70c18209b87ed6b
Handle SIGHUP: neutron-server (multiprocess) and metadata agent

All launchers implemented in common.service require each service to
implement reset method because it is called in case a process
receives a SIGHUP.

This change adds the reset method to neutron.service.RpcWorker and
neutron.wsgi.WorkerService which are used to wrap rpc and api
workers correspondingly.

Now neutron-server running in multiprocess mode (api_workers > 0 and
rpc_workers > 0) and metadata agent don't die on receiving SIGHUP and support
reloading policy_path and logging options in config.

Note that reset is called only in case a service is running in daemon mode.

Other changes made in the scope of this patch that need to be mentioned:

* Don't empty self._servers list in RpcWorker's stop method

  When a service is restarted all services are gracefully shutdowned,
  resetted and started again (see openstack.common.service code).
  As graceful shutdown implies calling service.stop() and then
  service.wait() we don't want to clean self._servers list because
  it would be impossible to wait for them to stop processing
  requests and cleaning up their resources.
  Otherwise, this would lead to problems with rpc after starting
  the rpc server again.

* Create a duplicate socket each time WorkerService starts

  When api worker is stopped it kills the eventlet wsgi server
  which internally closes the wsgi server socket object. This server
  socket object becomes not usable which leads to "Bad file
  descriptor" errors on service restart.

Added functional and unit tests.

DocImpact
Partial-Bug: #1276694
Change-Id: I75b00946b7cae891c6eb192e853118e7d49e4a24
neutron/common/config.py
neutron/service.py
neutron/tests/functional/requirements.txt
neutron/tests/functional/test_server.py [new file with mode: 0644]
neutron/tests/unit/test_service.py [new file with mode: 0644]
neutron/tests/unit/test_wsgi.py
neutron/wsgi.py