Multiple store locations for glance images
In this post i will show you how to add multiple store locations for glance images. This will allow you to extend your glance capacity without affect your current stored images. The location can be any device or directory mounted at your glance host as a NFS, a physical hard disk, or an extended partition. Let's start:
First we need to create the directories where hard disks are going to be mounted
sudo mkdir /var/lib/glance/lvm-images
sudo mkdir /var/lib/glance/extended-imagesNext, we mount the devices at the directories created in the previous step
sudo mount /dev/sdc1 /var/lib/glance/lvm-images/
sudo mount /dev/sdd1 /var/lib/glance/extended-images/An important step is making the glance user the owner of that directories
chown glance:glance /var/lib/glance/lvm-images/
chown glance:glance /var/lib/glance/extended-images/Once the previous steps has been made, we need to configure the /etc/glance/glance-api.conf file.
In this file, we're going to configure glance to use multiple directories to store images. We search the section "Filesystem Store Options" and modify/create the following:
We will leave the option "filesystem_store_datadir=" empty, if we comment this option, glance will use it as default store location and will show us an error during image creation.
And we add the option "filesystem_store_datadirs", once for any directory we created in previous steps. We can use priorities on glance, priority 200 has precedence over priority 100, if we don't specify any priority, default will be 0
# ============ Filesystem Store Options ========================
filesystem_store_datadir=
filesystem_store_datadirs=/var/lib/glance/images
filesystem_store_datadirs=/var/lib/glance/lvm-images:200
filesystem_store_datadirs=/var/lib/glance/extended-images:100Once we have configured glance-api.conf, restart glance-api service
The image has been properly created at glance, we're going to check if the image has been properly created in the expected location.
As we have configured a priority of 200 on this directory, the image must be here.
We have to keep the store location that we have been using till now, the images remain available here.
Finally we check if the images are in active status
Regards
Last updated
Was this helpful?