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 fd8032b3601f79315eb683916fbd4a2a8d5cc74e)
This commit is contained in:
parent
bed14e7fc7
commit
5e79632ec5
ironic_python_agent
@ -89,7 +89,7 @@ def image_info(path, source_format=None):
|
|||||||
if source_format:
|
if source_format:
|
||||||
cmd += ['-f', source_format]
|
cmd += ['-f', source_format]
|
||||||
|
|
||||||
out, err = utils.execute(cmd, prlimit=_qemu_img_limits())
|
out, err = utils.execute(*cmd, prlimit=_qemu_img_limits())
|
||||||
return imageutils.QemuImgInfo(out, format='json')
|
return imageutils.QemuImgInfo(out, format='json')
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ class ImageInfoTestCase(base.IronicLibTestCase):
|
|||||||
qemu_img.image_info('img')
|
qemu_img.image_info('img')
|
||||||
path_exists_mock.assert_called_once_with('img')
|
path_exists_mock.assert_called_once_with('img')
|
||||||
execute_mock.assert_called_once_with(
|
execute_mock.assert_called_once_with(
|
||||||
['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
|
'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
|
||||||
'--output=json'], prlimit=mock.ANY)
|
'--output=json', prlimit=mock.ANY)
|
||||||
image_info_mock.assert_called_once_with('out', format='json')
|
image_info_mock.assert_called_once_with('out', format='json')
|
||||||
|
|
||||||
@mock.patch.object(utils, 'execute', return_value=('out', 'err'),
|
@mock.patch.object(utils, 'execute', return_value=('out', 'err'),
|
||||||
@ -57,8 +57,8 @@ class ImageInfoTestCase(base.IronicLibTestCase):
|
|||||||
qemu_img.image_info('img', source_format='qcow2')
|
qemu_img.image_info('img', source_format='qcow2')
|
||||||
path_exists_mock.assert_called_once_with('img')
|
path_exists_mock.assert_called_once_with('img')
|
||||||
execute_mock.assert_called_once_with(
|
execute_mock.assert_called_once_with(
|
||||||
['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
|
'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
|
||||||
'--output=json', '-f', 'qcow2'],
|
'--output=json', '-f', 'qcow2',
|
||||||
prlimit=mock.ANY
|
prlimit=mock.ANY
|
||||||
)
|
)
|
||||||
image_info_mock.assert_called_once_with('out', format='json')
|
image_info_mock.assert_called_once_with('out', format='json')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user