Configure root_helper and root_helper_daemon in fullstack tests
Fullstack tests are similar to non-test environments, so rootwrap and rootwrap-daemon should be used instead of plain sudo. L3 agents and DHCP agents used in fullstack tests should be guaranteed to be eventlet monkey patched to avoid race conditions when two threads are trying to issue commands via rootwrap daemon at the same time. Closes-Bug: #1557168 Change-Id: Ida5a45420a8f58c1f5a36eb3fc546a7ea053a661 Signed-off-by: Hunt Xu <mhuntxu@gmail.com>
This commit is contained in:
parent
3326292c33
commit
927646e03a
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright 2017 Eayun, 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.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from neutron.common import eventlet_utils
|
||||||
|
from neutron.tests.common.agents import l3_agent
|
||||||
|
|
||||||
|
eventlet_utils.monkey_patch()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(l3_agent.main())
|
|
@ -91,6 +91,13 @@ class NeutronConfigFixture(ConfigFixture):
|
||||||
'report_interval': env_desc.agent_down_time / 2.0
|
'report_interval': env_desc.agent_down_time / 2.0
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
# Set root_helper/root_helper_daemon only when env var is set
|
||||||
|
root_helper = os.environ.get('OS_ROOTWRAP_CMD')
|
||||||
|
if root_helper:
|
||||||
|
self.config['agent']['root_helper'] = root_helper
|
||||||
|
root_helper_daemon = os.environ.get('OS_ROOTWRAP_DAEMON_CMD')
|
||||||
|
if root_helper_daemon:
|
||||||
|
self.config['agent']['root_helper_daemon'] = root_helper_daemon
|
||||||
|
|
||||||
def _setUp(self):
|
def _setUp(self):
|
||||||
self.config['DEFAULT'].update({
|
self.config['DEFAULT'].update({
|
||||||
|
|
|
@ -267,7 +267,7 @@ class L3AgentFixture(ServiceFixture):
|
||||||
process_name=self.NEUTRON_L3_AGENT,
|
process_name=self.NEUTRON_L3_AGENT,
|
||||||
exec_name=spawn.find_executable(
|
exec_name=spawn.find_executable(
|
||||||
'l3_agent.py',
|
'l3_agent.py',
|
||||||
path=os.path.join(base.ROOTDIR, 'common', 'agents')),
|
path=os.path.join(fullstack_base.ROOTDIR, 'cmd')),
|
||||||
config_filenames=config_filenames,
|
config_filenames=config_filenames,
|
||||||
namespace=self.namespace
|
namespace=self.namespace
|
||||||
)
|
)
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -78,6 +78,7 @@ deps =
|
||||||
{[testenv:functional]deps}
|
{[testenv:functional]deps}
|
||||||
commands =
|
commands =
|
||||||
{toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir}
|
{toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir}
|
||||||
|
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
|
||||||
{[testenv]commands}
|
{[testenv]commands}
|
||||||
|
|
||||||
[testenv:releasenotes]
|
[testenv:releasenotes]
|
||||||
|
|
Loading…
Reference in New Issue