Ceph, Glance

Glance: Upload images directly in ceph

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.

Step#1 
First upload an image to ceph, Here will explain using the Window-OS image with raw format.
image_id=$(uuidgen)
rbd  import /home/swami/windows-r2.raw $imae_id -p images --image-format 2
rbd info imabes/$image-id => Will show the image details.
Step#2:

Now, create a snapshot and make it protected to be compatible with glance images.
snap_id=$(uuidgen)
rbd -p images snap create --snap snap $snap_id 
rbd -p images smap protect --image $snap_id --snap snap
Step#3:  
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
Step#4:
Check if the glance image list shows the above image:
glance image-list | grep $snap_id
glance image-show $snap_id

 

 

Advertisements
Glance

Glance images quick download with Ceph

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.

Pre-requisites:

  • Use the ceph rbd as glance storage.
    • defalut_store=rbd
  • Use Cinder back-end as ceph rdb
    • enabled_backends=ceph
  • Use only RAW format of the images.

Now, follow the below configurations for cinder and glance for quicker images download:

/etc/cinder/cinder/cinder.conf:

[ceph]
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"

/etc/glance/glance-api.conf:

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.

Ref:

  1. https://specs.openstack.org/openstack/nova-specs/specs/juno/implemented/rbd-clone-image-handler.html
  2. http://docs.ceph.com/docs/master/dev/rbd-layering/