Setting up HA of Glance

This document outlines configuration details of setting up HA of Glance.

On both nodes of Neutron (rdo-glance1 rdo-glance2), install the relevant RPMs:
$ yum install -y openstack-glance openstack-utils openstack-selinux

Setup glance-api.conf:

openstack-config --set /etc/glance/glance-api.conf DEFAULT sql_connection mysql://glance:glancetest@vip-mysql/glance

openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host vip-keystone
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name services
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password glancetest
openstack-config --set /etc/glance/glance-api.conf DEFAULT qpid_hostname vip-qpid
openstack-config --set /etc/glance/glance-api.conf DEFAULT qpid_heartbeat 2
openstack-config --set /etc/glance/glance-api.conf DEFAULT registry_host vip-glance

Setup glance-registry.conf:

openstack-config --set /etc/glance/glance-registry.conf DEFAULT sql_connection mysql://glance:glancetest@vip-mysql/glance
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host vip-keystone
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_port 35357
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_protocol http
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name services
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password glancetest

Enable Glance's notifications (Needed for Ceilometer):

openstack-config --set /etc/glance/glance-api.conf DEFAULT notifier_strategy qpid

On the first node of Glance (rdo-glance1), source the Keystone credentials and create a Keystone user, associate a role, and create Glance service and a Keystone endpoint for it.

. /srv/rhos/configs/keystonerc_admin

keystone user-create --name glance --pass glancetest
keystone  user-role-add --user glance --role admin --tenant services
keystone service-create --name glance --type image --description "Glance Image Service"

keystone endpoint-create --service glance --publicurl "http://vip-glance:9292" --adminurl "http://vip-glance:9292" --internalurl "http://vip-glance:9292"

Configure mysql:

mysql --user=root --password=mysqltest --host=vip-mysql

CREATE DATABASE glance;
GRANT ALL ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glancetest';
quit

Perform Glance db_sync:

su glance -s /bin/sh -c "glance-manage db_sync"
On both nodes of Glance (rdo-glance1 rdo-glance2), configure pacemaker:
chkconfig pacemaker on
pcs cluster setup --name rdo-glance rdo-glance1 rdo-glance2
pcs cluster start

sleep 30

pcs stonith create glance1-fence fence_xvm multicast_address=225.0.0.7 pcmk_host_list=rdo-glance1

pcs stonith create glance2-fence fence_xvm multicast_address=225.0.0.8 pcmk_host_list=rdo-glance2

mkdir -p /srv/rhos/glance

pcs  resource create glance-fs Filesystem device="mrg-01:/srv/rhos/glance"  directory="/var/lib/glance" fstype="nfs" options="v3" --clone

chown glance:nobody /var/lib/glance
pcs resource create glance-registry lsb:openstack-glance-registry --clone
pcs resource create glance-api lsb:openstack-glance-api --clone

pcs constraint order start glance-fs-clone then glance-registry-clone
pcs constraint colocation add glance-registry with glance-fs
pcs constraint order start glance-registry-clone then glance-api-clone
pcs constraint colocation add glance-api with glance-registry

Do a test by importing an image into Glance:

wget -c \
http://cloud.fedoraproject.org/fedora-latest.x86_64.qcow2

. /srv/rhos/configs/keystonerc_admin

glance image-create --name fedora20 --is-public true \
--disk-format qcow2 --container-format bare \
< Fedora-20.qcow2