summaryrefslogtreecommitdiff
path: root/nova/virt/images.py
diff options
context:
space:
mode:
authorLee Yarwood <lyarwood@redhat.com>2020-03-06 17:02:35 +0000
committerLee Yarwood <lyarwood@redhat.com>2020-04-16 16:38:24 +0100
commit3e06135bec88c1c308124f2f0a55d448434ae8ae (patch)
treeaa2ebf45eb1160824bae35a833ae74dfb35c5e5f /nova/virt/images.py
parente1359567e4985e9a671359d4c0d53404a8ba64ab (diff)
downloadnova-3e06135bec88c1c308124f2f0a55d448434ae8ae.tar.gz
images: Make JSON the default output format of calls to qemu-img info
oslo.utils is planning to make JSON the default output format parsed when creating QemuImgInfo objects. As such this change makes JSON the default output_format requested when calling qemu-img info. The majority of this change is actually test removal from nova.tests.unit.virt.libvirt.test_utils as these human readable qemu-img based tests now duplicate tests found in oslo.utils itself. Change-Id: I56676713571e79f05ee3f0bffc5da8386e02c5d4
Diffstat (limited to 'nova/virt/images.py')
-rw-r--r--nova/virt/images.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/nova/virt/images.py b/nova/virt/images.py
index 800ebca3c7..5358f3766a 100644
--- a/nova/virt/images.py
+++ b/nova/virt/images.py
@@ -39,30 +39,22 @@ CONF = nova.conf.CONF
IMAGE_API = glance.API()
-def qemu_img_info(path, format=None, output_format=None):
+def qemu_img_info(path, format=None):
"""Return an object containing the parsed output from qemu-img info."""
if not os.path.exists(path) and not path.startswith('rbd:'):
raise exception.DiskNotFound(location=path)
- info = nova.privsep.qemu.unprivileged_qemu_img_info(
- path, format=format, output_format=output_format)
- if output_format:
- return imageutils.QemuImgInfo(info, format=output_format)
- else:
- return imageutils.QemuImgInfo(info)
+ info = nova.privsep.qemu.unprivileged_qemu_img_info(path, format=format)
+ return imageutils.QemuImgInfo(info, format='json')
-def privileged_qemu_img_info(path, format=None, output_format=None):
+def privileged_qemu_img_info(path, format=None, output_format='json'):
"""Return an object containing the parsed output from qemu-img info."""
if not os.path.exists(path) and not path.startswith('rbd:'):
raise exception.DiskNotFound(location=path)
- info = nova.privsep.qemu.privileged_qemu_img_info(
- path, format=format, output_format=output_format)
- if output_format:
- return imageutils.QemuImgInfo(info, format=output_format)
- else:
- return imageutils.QemuImgInfo(info)
+ info = nova.privsep.qemu.privileged_qemu_img_info(path, format=format)
+ return imageutils.QemuImgInfo(info, format='json')
def convert_image(source, dest, in_format, out_format, run_as_root=False,