Skip to content

Commit

Permalink
qa/ceph-volume: allow executing python pyloads using python3
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Dave <ridave@redhat.com>
  • Loading branch information
rishabh-d-dave authored and batrick committed Jul 30, 2018
1 parent 5106582 commit 2f35ade
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
15 changes: 8 additions & 7 deletions qa/tasks/cephfs/mount.py
Expand Up @@ -144,13 +144,14 @@ def create_destroy(self):
'sudo', 'rm', '-f', os.path.join(self.mountpoint, filename)
])

def _run_python(self, pyscript):
return self.client_remote.run(args=[
'sudo', 'adjust-ulimits', 'daemon-helper', 'kill', 'python', '-c', pyscript
], wait=False, stdin=run.PIPE, stdout=StringIO())

def run_python(self, pyscript):
p = self._run_python(pyscript)
def _run_python(self, pyscript, py_version='python'):
return self.client_remote.run(
args=['sudo', 'adjust-ulimits', 'daemon-helper', 'kill',
py_version, '-c', pyscript], wait=False, stdin=run.PIPE,
stdout=StringIO())

def run_python(self, pyscript, py_version='python'):
p = self._run_python(pyscript, py_version)
p.wait()
return p.stdout.getvalue().strip()

Expand Down
5 changes: 4 additions & 1 deletion qa/tasks/cephfs/test_volume_client.py
Expand Up @@ -14,6 +14,7 @@ class TestVolumeClient(CephFSTestCase):
# One for looking at the global filesystem, one for being
# the VolumeClient, two for mounting the created shares
CLIENTS_REQUIRED = 4
py_version = 'python'

def _volume_client_python(self, client, script, vol_prefix=None, ns_prefix=None):
# Can't dedent this *and* the script we pass in, because they might have different
Expand All @@ -32,7 +33,9 @@ def _volume_client_python(self, client, script, vol_prefix=None, ns_prefix=None)
vc.connect()
{payload}
vc.disconnect()
""".format(payload=script, conf_path=client.config_path, vol_prefix=vol_prefix, ns_prefix=ns_prefix))
""".format(payload=script, conf_path=client.config_path,
vol_prefix=vol_prefix, ns_prefix=ns_prefix),
self.py_version)

def _sudo_write_file(self, remote, path, data):
"""
Expand Down
8 changes: 3 additions & 5 deletions qa/tasks/vstart_runner.py
Expand Up @@ -540,15 +540,13 @@ def list_connections():

self.gather_mount_info()

def _run_python(self, pyscript):
def _run_python(self, pyscript, py_version='python'):
"""
Override this to remove the daemon-helper prefix that is used otherwise
to make the process killable.
"""
return self.client_remote.run(args=[
'python', '-c', pyscript
], wait=False)

return self.client_remote.run(args=[py_version, '-c', pyscript],
wait=False)

class LocalCephManager(CephManager):
def __init__(self):
Expand Down

0 comments on commit 2f35ade

Please sign in to comment.