Merge "Fix the way qemu-img is called with prlimits"

This commit is contained in:
Zuul
2025-03-05 12:31:50 +00:00
committed by Gerrit Code Review
2 changed files with 5 additions and 5 deletions

View File

@@ -89,7 +89,7 @@ def image_info(path, source_format=None):
if 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')

View File

@@ -44,8 +44,8 @@ class ImageInfoTestCase(base.IronicAgentTest):
qemu_img.image_info('img')
path_exists_mock.assert_called_once_with('img')
execute_mock.assert_called_once_with(
['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
'--output=json'], prlimit=mock.ANY)
'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
'--output=json', prlimit=mock.ANY)
image_info_mock.assert_called_once_with('out', format='json')
@mock.patch.object(utils, 'execute', return_value=('out', 'err'),
@@ -57,8 +57,8 @@ class ImageInfoTestCase(base.IronicAgentTest):
qemu_img.image_info('img', source_format='qcow2')
path_exists_mock.assert_called_once_with('img')
execute_mock.assert_called_once_with(
['env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
'--output=json', '-f', 'qcow2'],
'env', 'LC_ALL=C', 'LANG=C', 'qemu-img', 'info', 'img',
'--output=json', '-f', 'qcow2',
prlimit=mock.ANY
)
image_info_mock.assert_called_once_with('out', format='json')