Skip to content

Ceph for Cinder and Glance in OpenStack Juno Part 4 – Building the Ceph Cluster

Part 4 of the post series is going to walk you through how to transform a qcow2 image into raw via rbd. All credits for this post go to Sebastian Han who wrote this OpenStack Glance: Import Images and Convert Them Directly in Ceph.

Make sure you set
rbd default format = 2
in the ceph.conf client section

1. Download the image, transform it, and upload it into glance.

[root@controller ~(keystone_admin)]# wget
[root@controller ~(keystone_admin)]# rbd -p images --image-format 2 import cirros-0.3.4-x86_64-disk.img $(uuidgen)
[root@controller ~(keystone_admin)]# rbd -p images ls
[root@controller ~(keystone_admin)]# rbd -p images info 949f0f10-b889-4185-8ff0-1539667232c4
[root@controller ~(keystone_admin)]# qemu-img convert -O raw rbd:images/949f0f10-b889-4185-8ff0-1539667232c4 rbd:images/$(uuidgen)
[root@controller ~(keystone_admin)]# rbd -p images ls
[root@controller ~(keystone_admin)]# qemu-img info rbd:/images/0f5b8064-4db3-4730-bed5-d5d1ee99df88
[root@controller ~(keystone_admin)]# rbd -p images ls
[root@controller ~(keystone_admin)]# qemu-img info rbd:images/0f5b8064-4db3-4730-bed5-d5d1ee99df88
[root@controller ~(keystone_admin)]# rbd -p images rm 949f0f10-b889-4185-8ff0-1539667232c4
[root@controller ~(keystone_admin)]# rbd --pool images snap create --snap snap 0f5b8064-4db3-4730-bed5-d5d1ee99df88
[root@controller ~(keystone_admin)]# rbd --pool images snap protect --image 0f5b8064-4db3-4730-bed5-d5d1ee99df88 --snap snap
[root@controller ~(keystone_admin)]# rbd -p images snap ls 0f5b8064-4db3-4730-bed5-d5d1ee99df88
[root@controller ~(keystone_admin)]# glance image-create --id 0f5b8064-4db3-4730-bed5-d5d1ee99df88 --name CirrosImport --store rbd --disk-format raw --container-format bare --location rbd://$(ceph fsid)/images/0f5b8064-4db3-4730-bed5-d5d1ee99df88/snap