Browse Source

Merge "Migrate "ovs-ofctl" to oslo.privsep"

changes/03/785103/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
de21afde05
4 changed files with 8 additions and 6 deletions
  1. +2
    -1
      neutron/agent/common/ovs_lib.py
  2. +2
    -1
      neutron/cmd/sanity/checks.py
  3. +3
    -3
      neutron/tests/unit/agent/common/test_ovs_lib.py
  4. +1
    -1
      neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py

+ 2
- 1
neutron/agent/common/ovs_lib.py View File

@ -373,7 +373,8 @@ class OVSBridge(BaseOVS):
for i in range(1, 11):
try:
return utils.execute(full_args, run_as_root=True,
process_input=process_input)
process_input=process_input,
privsep_exec=True)
except Exception as e:
if "failed to connect to socket" in str(e):
LOG.debug("Failed to connect to OVS. Retrying "


+ 2
- 1
neutron/cmd/sanity/checks.py View File

@ -113,7 +113,8 @@ def ofctl_arg_supported(cmd, **kwargs):
ovs_lib._build_flow_expr_str(kwargs, cmd.split('-')[0],
False)]
try:
agent_utils.execute(full_args, run_as_root=True)
agent_utils.execute(full_args, run_as_root=True,
privsep_exec=True)
except RuntimeError as e:
LOG.debug("Exception while checking supported feature via "
"command %s. Exception: %s", full_args, e)


+ 3
- 3
neutron/tests/unit/agent/common/test_ovs_lib.py View File

@ -200,12 +200,12 @@ class OVS_Lib_Test(base.BaseTestCase):
def _ofctl_mock(self, cmd, *args, **kwargs):
cmd = self._ofctl_args(cmd, *args)
return mock.call(cmd, run_as_root=True, **kwargs)
return mock.call(cmd, run_as_root=True, privsep_exec=True, **kwargs)
def _verify_ofctl_mock(self, cmd, *args, **kwargs):
cmd = self._ofctl_args(cmd, *args)
return self.execute.assert_called_once_with(cmd, run_as_root=True,
**kwargs)
return self.execute.assert_called_once_with(
cmd, run_as_root=True, privsep_exec=True, **kwargs)
def test_add_flow_timeout_set(self):
flow_dict = collections.OrderedDict([


+ 1
- 1
neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py View File

@ -1168,7 +1168,7 @@ class TestCookieContext(base.BaseTestCase):
mock.ANY,
process_input='hard_timeout=0,idle_timeout=0,priority=1,'
'cookie=%d,actions=drop' % cookie,
run_as_root=mock.ANY,
run_as_root=True, privsep_exec=True
) for cookie in (update_cookie, default_cookie)
]


Loading…
Cancel
Save