Use the json format output of qemu-img info

Support for the human format by oslo_utils.imageutils.QemuImgInfo was
deprecated since oslo.utils 4.9.1 [1]. This change replaces the human
format with the json format which will be used by default.

[1] 73eb0673f627aad382e08a816191b637af436465

Change-Id: I4c9bdbccb9345e2259ddb0737f37c09d99dd1c4f
This commit is contained in:
Takashi Kajinami 2021-07-06 21:57:18 +09:00
parent f7db05cc9d
commit d33cf3e033
2 changed files with 4 additions and 2 deletions

View File

@ -456,8 +456,9 @@ def qemu_img_info(path):
out, err = utils.execute('env', 'LC_ALL=C', 'LANG=C',
'qemu-img', 'info', path,
'--output=json',
prlimit=_qemu_img_limits())
return imageutils.QemuImgInfo(out)
return imageutils.QemuImgInfo(out, format='json')
def _retry_on_res_temp_unavailable(exc):

View File

@ -617,8 +617,9 @@ class OtherFunctionTestCase(base.IronicLibTestCase):
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)
qemu_img_info_mock.assert_called_once_with('out')
qemu_img_info_mock.assert_called_once_with('out', format='json')
@mock.patch.object(utils, 'execute', autospec=True)
def test_convert_image(self, execute_mock):