2015-11-15 10:22:53 |
zhangsong |
description |
When I use image_utils.qemu_img_info method to get the virtual_size info of my image:
source = 'sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9'
image_size = qemu_img_info(source, run_as_root=True).virtual_size
an error occured:
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher raise ValueError(_('Invalid input value "%s".') % details)
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher ValueError: Invalid input value "unavailable".
But if I manually run the qemu_img info command, the virtual_size can be successfully acquired:
#qemu-img info sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
image: sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: unavailable
# qemu-img info -f rbd rbd:data/foo
image: rbd:data/foo
file format: rbd
virtual size: 10G (10737418240 bytes)
disk size: unavailable
cluster_size: 4194304
This occured both in ceph and sheepdog. We can see that disk size info is unavailable, but the virtual size really exists. So something is wrong. |
I try to use imageutils.QemuImgInfo class to get the virtual_size info of my image in cinder, The following is my usage scenarios:
source = 'sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9'
image_size = qemu_img_info(source, run_as_root=True).virtual_size
The qemu_img_info() method is defined in cinder.image.image_utils module like this:
def qemu_img_info(path, run_as_root=True):
"""Return a object containing the parsed output from qemu-img info."""
cmd = ('env', 'LC_ALL=C', 'qemu-img', 'info', path)
if os.name == 'nt':
cmd = cmd[2:]
out, _err = utils.execute(*cmd, run_as_root=run_as_root)
return imageutils.QemuImgInfo(out)
an error occured:
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher raise ValueError(_('Invalid input value "%s".') % details)
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher ValueError: Invalid input value "unavailable".
But if I manually run the qemu_img info command, the virtual_size can be successfully acquired:
#qemu-img info sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
image: sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: unavailable
# qemu-img info -f rbd rbd:data/foo
image: rbd:data/foo
file format: rbd
virtual size: 10G (10737418240 bytes)
disk size: unavailable
cluster_size: 4194304
This occured both in ceph and sheepdog. We can see that disk size info is unavailable, but the virtual size really exists. Why I can't get the 'virtual size' info which is really exist?
The reason is imageutils.QemuImgInfo class parse all the image info at first, it find that the disk size info doesn't matched with the setting regular expression(SIZE_RE), then it raise a ValueError, this means the image info is parsed unsuccessfully, so I can't obtain any of the info.
I think there is an mistake in imageutils.QemuImgInfo class: only the 'disk size' info is unavailable, it shouldn't raise an error when I want to get the another info.
I have tested both in sheepdog and ceph, they all show the disk_size info like 'disk size: unavailable', so I think we need to consider this as a normal scenario. |
|
2015-11-20 07:25:25 |
zhangsong |
description |
I try to use imageutils.QemuImgInfo class to get the virtual_size info of my image in cinder, The following is my usage scenarios:
source = 'sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9'
image_size = qemu_img_info(source, run_as_root=True).virtual_size
The qemu_img_info() method is defined in cinder.image.image_utils module like this:
def qemu_img_info(path, run_as_root=True):
"""Return a object containing the parsed output from qemu-img info."""
cmd = ('env', 'LC_ALL=C', 'qemu-img', 'info', path)
if os.name == 'nt':
cmd = cmd[2:]
out, _err = utils.execute(*cmd, run_as_root=run_as_root)
return imageutils.QemuImgInfo(out)
an error occured:
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher raise ValueError(_('Invalid input value "%s".') % details)
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher ValueError: Invalid input value "unavailable".
But if I manually run the qemu_img info command, the virtual_size can be successfully acquired:
#qemu-img info sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
image: sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: unavailable
# qemu-img info -f rbd rbd:data/foo
image: rbd:data/foo
file format: rbd
virtual size: 10G (10737418240 bytes)
disk size: unavailable
cluster_size: 4194304
This occured both in ceph and sheepdog. We can see that disk size info is unavailable, but the virtual size really exists. Why I can't get the 'virtual size' info which is really exist?
The reason is imageutils.QemuImgInfo class parse all the image info at first, it find that the disk size info doesn't matched with the setting regular expression(SIZE_RE), then it raise a ValueError, this means the image info is parsed unsuccessfully, so I can't obtain any of the info.
I think there is an mistake in imageutils.QemuImgInfo class: only the 'disk size' info is unavailable, it shouldn't raise an error when I want to get the another info.
I have tested both in sheepdog and ceph, they all show the disk_size info like 'disk size: unavailable', so I think we need to consider this as a normal scenario. |
I try to use imageutils.QemuImgInfo class to get the virtual_size info of my image in cinder, but an error occured:
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher raise ValueError(_('Invalid input value "%s".') % details)
2015-11-12 12:46:49.123 32474 ERROR oslo_messaging.rpc.dispatcher ValueError: Invalid input value "unavailable".
If I manually run the qemu_img info command, the virtual_size can be successfully acquired:
#qemu-img info sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
image: sheepdog:volume-1af1afa0-7820-4063-9b90-4fa6161a74a9
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: unavailable
# qemu-img info -f rbd rbd:data/foo
image: rbd:data/foo
file format: rbd
virtual size: 10G (10737418240 bytes)
disk size: unavailable
cluster_size: 4194304
This occured both in ceph and sheepdog. We can see that disk size info is unavailable, but the virtual size really exists. Why I can't get the 'virtual size' info which is really exist? |
|