Currently uploading glance images upload takes long time, if the images are big in size (like > 2GB or so). Here ceph provides a way to upload the images using “rbd import” command and then map the same image name to glance. This process will be faster and easier.
First upload an image to ceph, Here will explain using the Window-OS image with raw format.
rbd import /home/swami/windows-r2.raw $imae_id -p images --image-format 2
rbd info imabes/$image-id => Will show the image details.
Now, create a snapshot and make it protected to be compatible with glance images.
rbd -p images snap create --snap snap $snap_id
rbd -p images smap protect --image $snap_id --snap snap
Now, add the above image to glance.
Note: source the openrc for a tenant, where you want to add this image.
glance image-create $snap_id --name windows-r2.raw --store rbd --disk-formte raw --container=foramte bare --location rbd://$(ceph fsid)/images/$snap_id/snap
Check if the glance image list shows the above image:
glance image-list | grep $snap_id
glance image-show $snap_id
Currently Ceph RBD backed disks are created by downloading an image file from Glance to a local file, then uploading that file into Ceph RBD. Here, uploading may take a long time, because “rbd import” is synchronous and slow.
If the glance images are already stored in Ceph RBD, then there is no need download to a local directory and local copies – it can be cloned to a new image for a new disk without copying the data at all.
Glance and Cinder use the Ceph rbd as back-end, use the below steps to do the quick upload and download the image files.
- Use the ceph rbd as glance storage.
- Use Cinder back-end as ceph rdb
- Use only RAW format of the images.
Now, follow the below configurations for cinder and glance for quicker images download:
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_pool = volumes
rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot = false
glance_api_version = 2
Note: Make sure that, cinder uses the glance API V2 version ‘glance_api_version = 2"
show_image_direct_url = True
show_multiple_locations = Ture
With above settings, glance images not download to local directory and no copy. It uses the ceph clone functionality and bootable volume creation takes quickly.