]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Add rootwrap daemon mode support
authorTerry Wilson <twilson@redhat.com>
Mon, 23 Feb 2015 20:56:44 +0000 (14:56 -0600)
committerTerry Wilson <twilson@redhat.com>
Fri, 13 Mar 2015 02:12:07 +0000 (21:12 -0500)
commit0df884ac931c99f50ce020b18fd42a1b94d96481
treeb18005e41d5cff9cc626c8b11b9c98a94c696e64
parent48637c8933a0753b316eaf472a4a26ac41a4e009
Add rootwrap daemon mode support

This patch introduces support for rootwrap daemon mode. It adds
a new config option, AGENT.root_helper_daemon with no default. To
enable, set to something like:

root_helper_daemon = sudo neutron-rootwrap-daemon /etc/neutron/rootwrap.conf

The patch currently assumes that the root_helper_daemon value, and specifically
the rootwrap config, will not change once calls to execute() happen. While it
would not be hard to generate a rootwrap daemon client for each new config, I
couldn't think of a legitimate reason to support it and left it out as YAGNI.

This patch does change the behavior of the addl_env argument to create_process
and execute. Previously, an environment dict would be passed to Popen. If
a root helper was used, this environemnt would actually be passed to 'sudo'
which would filter it before passing it to the underlying command. In the case
of daemon mode, this would cause a problem as the enviornment is filtered by
sudo only once, at daemon startup. Any environment variables added at execute
time would then just be passed directly to the underyling command unfiltered.

oslo.rootwrap 1.6.0 fixes this issue by denying the passing of environment
variables to the daemon altogether. Instead, anything using rootwrap and needing
to pass additional environment variables should define an EnvFilter and run the
command with env var=val cmd. utils.execute/create_process have been modified to
run code in this way (which netns.execute already did).

No code in neutron currently uses both run_as_root=True and addl_env, so this
change does not require any change in code or filters.

DocImpact
Implements: blueprint rootwrap-daemon-mode
Change-Id: I567334bb611253c7b9d830d50c5be308a5153baf
neutron/agent/common/config.py
neutron/agent/linux/utils.py
neutron/tests/functional/agent/test_l3_agent.py
neutron/tests/functional/base.py
neutron/tests/unit/test_agent_config.py
setup.cfg
tools/configure_for_func_testing.sh
tox.ini