Skip to content

Commit d11fa50

Browse files
committed
Fix the way qemu-img is called with prlimits
Using prlimits is incompatible with passing arguments as a list: oslo.concurrency ends up executing something like: /opt/ironic-python-agent/bin/python3 -m oslo_concurrency.prlimit \ --as=2147483648 -- ['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', \ '/tmp/cirros-0.6.2-x86_64-disk.img', '--output=json'] Which obviously fails. I don't understand how our CI has worked so far, but the Metal3 BMO suite fails on this. Change-Id: I46dbcb0f73bcbe09bb89b5c7195259570412698e (cherry picked from commit fd8032b)
1 parent 42add4b commit d11fa50

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ironic_python_agent/qemu_img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def image_info(path, source_format=None):
8989
if source_format:
9090
cmd += ['-f', source_format]
9191

92-
out, err = utils.execute(cmd, prlimit=_qemu_img_limits())
92+
out, err = utils.execute(*cmd, prlimit=_qemu_img_limits())
9393
return imageutils.QemuImgInfo(out, format='json')
9494

9595

ironic_python_agent/tests/unit/test_qemu_img.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def test_image_info_path_exists_disabled(self, path_exists_mock,
4444
qemu_img.image_info('img')
4545
path_exists_mock.assert_called_once_with('img')
4646
execute_mock.assert_called_once_with(
47-
['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
48-
'--output=json'], prlimit=mock.ANY)
47+
'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
48+
'--output=json', prlimit=mock.ANY)
4949
image_info_mock.assert_called_once_with('out', format='json')
5050

5151
@mock.patch.object(utils, 'execute', return_value=('out', 'err'),
@@ -57,8 +57,8 @@ def test_image_info_path_exists_safe(
5757
qemu_img.image_info('img', source_format='qcow2')
5858
path_exists_mock.assert_called_once_with('img')
5959
execute_mock.assert_called_once_with(
60-
['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
61-
'--output=json', '-f', 'qcow2'],
60+
'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
61+
'--output=json', '-f', 'qcow2',
6262
prlimit=mock.ANY
6363
)
6464
image_info_mock.assert_called_once_with('out', format='json')

0 commit comments

Comments
 (0)