[ceph] Show snapshot real disk usage

asked 2017-04-19 09:11:06 -0500

Damian Dąbrowski gravatar image


I have a trouble with qcow2 instance snapshots size.

For example: when I create snapshot of 5GB instance using openstack server image create and I have set 'snapshot_image_format=qcow2' in my nova.conf in [libvirt] section I can see:

# openstack image show snap1 | grep 'disk_format\|size\|id '
| disk_format      | qcow2          |
| id               | 264d9671-7e4a-47c9-b56e-fc0939ded4a3
| size             | 5368709120     |
| virtual_size     | None           |

disk_format is qcow2 and its ok, but size doesn't decreased even if this instance using 1GB of 5GB.

now lets check rbd info and qemu-img info

# rbd info images/264d9671-7e4a-47c9-b56e-fc0939ded4a3
rbd image '264d9671-7e4a-47c9-b56e-fc0939ded4a3':
        size 5120 MB in 640 objects
        order 23 (8192 kB objects)
        block_name_prefix: rbd_data.1dd23556ea4bf
        format: 2
        features: layering, striping
        stripe unit: 8192 kB
        stripe count: 1

# qemu-img info rbd:images/264d9671-7e4a-47c9-b56e-fc0939ded4a3
image: rbd:images/264d9671-7e4a-47c9-b56e-fc0939ded4a3
file format: raw
virtual size: 5.0G (5368709120 bytes)
disk size: unavailable
cluster_size: 8388608
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
snap      snap                   5.0G 1970-01-01 00:00:00   00:00:00.000

qemu says that its not qcow2 but raw its image. Additionally real disk usage for this snapshot is:

# rbd diff images/264d9671-7e4a-47c9-b56e-fc0939ded4a3 | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }'
1848 MB

so my main question is - have You found any easy way to show snapshot real disk usage in openstack? I've looked in OVH cloud and they're counting it as I want to, so there must be some way.

Thank You in advance

edit retag flag offensive close merge delete