Convert fping API to processutils.execute()

Now that we don't have any calls to execute things as root,
it makes sense to move to just calling processutils.execute()
directly instead of going through our own redirection layer
which doesn't really do much.

Convert fping to call processutils directly.

Change-Id: I70a2646f2aa700ac796e0db3f79c41ca518162ea
blueprint: execs-ive-had-a-few
This commit is contained in:
Michael Still 2018-04-25 09:03:15 +10:00
parent 5d4ac436fa
commit ea2d459d09
3 changed files with 7 additions and 5 deletions

View File

@ -20,6 +20,8 @@ import os
from webob import exc
from oslo_concurrency import processutils
from nova.api.openstack.api_version_request \
import MAX_PROXY_API_SUPPORT_VERSION
from nova.api.openstack import common
@ -30,7 +32,6 @@ from nova import compute
import nova.conf
from nova.i18n import _
from nova.policies import fping as fping_policies
from nova import utils
CONF = nova.conf.CONF
@ -48,8 +49,8 @@ class FpingController(wsgi.Controller):
@staticmethod
def fping(ips):
fping_ret = utils.execute(CONF.api.fping_path, *ips,
check_exit_code=False)
fping_ret = processutils.execute(CONF.api.fping_path, *ips,
check_exit_code=False)
if not fping_ret:
return set()
alive_ips = set()

View File

@ -25,7 +25,8 @@ class FpingSampleJsonTests(test_servers.ServersSampleBase):
def fake_check_fping(self):
pass
self.stub_out("nova.utils.execute", test_fping.execute)
self.stub_out("oslo_concurrency.processutils.execute",
test_fping.execute)
self.stub_out("nova.api.openstack.compute.fping."
"FpingController.check_fping",
fake_check_fping)

View File

@ -42,7 +42,7 @@ class FpingTestV21(test.TestCase):
return_servers)
self.stub_out("nova.db.instance_get_by_uuid",
return_server)
self.stub_out('nova.utils.execute',
self.stub_out('oslo_concurrency.processutils.execute',
execute)
self.stub_out("nova.api.openstack.compute.fping.FpingController."
"check_fping",