Merge "images: Remove Libvirt specific configurable use from qemu_img_info"
This commit is contained in:
commit
b9843e80da
|
@ -49,6 +49,15 @@ class QemuTestCase(test.NoDBTestCase):
|
|||
self.assertTrue(image_info)
|
||||
self.assertTrue(str(image_info))
|
||||
|
||||
@mock.patch('oslo_concurrency.processutils.execute',
|
||||
return_value=('stdout', None))
|
||||
def test_qemu_info_with_rbd_path(self, utils_execute):
|
||||
# Assert that the use of a RBD URI as the path doesn't raise
|
||||
# exception.DiskNotFound
|
||||
image_info = images.qemu_img_info('rbd:volume/pool')
|
||||
self.assertTrue(image_info)
|
||||
self.assertTrue(str(image_info))
|
||||
|
||||
@mock.patch.object(compute_utils, 'disk_ops_semaphore')
|
||||
@mock.patch('nova.privsep.utils.supports_direct_io', return_value=True)
|
||||
@mock.patch.object(processutils, 'execute',
|
||||
|
|
|
@ -45,9 +45,7 @@ IMAGE_API = glance.API()
|
|||
|
||||
def qemu_img_info(path, format=None, output_format=None):
|
||||
"""Return an object containing the parsed output from qemu-img info."""
|
||||
# TODO(mikal): this code should not be referring to a libvirt specific
|
||||
# flag.
|
||||
if not os.path.exists(path) and CONF.libvirt.images_type != 'rbd':
|
||||
if not os.path.exists(path) and not path.startswith('rbd:'):
|
||||
raise exception.DiskNotFound(location=path)
|
||||
|
||||
info = nova.privsep.qemu.unprivileged_qemu_img_info(
|
||||
|
@ -61,9 +59,7 @@ def qemu_img_info(path, format=None, output_format=None):
|
|||
|
||||
def privileged_qemu_img_info(path, format=None, output_format=None):
|
||||
"""Return an object containing the parsed output from qemu-img info."""
|
||||
# TODO(mikal): this code should not be referring to a libvirt specific
|
||||
# flag.
|
||||
if not os.path.exists(path) and CONF.libvirt.images_type != 'rbd':
|
||||
if not os.path.exists(path) and not path.startswith('rbd:'):
|
||||
raise exception.DiskNotFound(location=path)
|
||||
|
||||
info = nova.privsep.qemu.privileged_qemu_img_info(
|
||||
|
|
Loading…
Reference in New Issue