neutron/neutron/tests/functional/test_service.py
Elena Ezhova bb16a2ef6c Use SIGUSR1 to notify l3 agent of changing prefix file
It is common for all OpenStack services to use SIGHUP signal to
reload configuration and restart. This functionality, including
defining signal handler, is defined by oslo.service.

Meanwhile, this is currently not so for l3 agent. PrefixDelegation
class that is instantiated in L3NATAgent overrides handler for SIGHUP,
thus removing handler that was set in oslo.service.

The proposed solution is to use another signal, such as SIGUSR1,
instead of SIGHUP to notify l3 agent that a prefix file was
somehow changed.

Added a functional test for restarting L3 agent using SIGHUP.

Change-Id: I48eb4697a5fad97bcf08cfe1f80921a46d94029d
Closes-Bug: #1511401
2015-11-13 17:53:47 +03:00

43 lines
1.5 KiB
Python

# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_service import service
from neutron import service as neutron_service
from neutron.tests import base
from neutron.tests.functional import test_server
class TestService(base.BaseTestCase):
def test_api_workers_default(self):
self.assertEqual(processutils.get_worker_count(),
neutron_service._get_api_workers())
def test_api_workers_from_config(self):
cfg.CONF.set_override('api_workers', 1234)
self.assertEqual(1234,
neutron_service._get_api_workers())
class TestServiceRestart(test_server.TestNeutronServer):
def _start_service(self, host, binary, topic, manager, workers,
*args, **kwargs):
server = neutron_service.Service(host, binary, topic, manager,
*args, **kwargs)
service.launch(cfg.CONF, server, workers).wait()