Friday 13 June 2014

Glance As a Separate Node

In my previous post "OpenStack Multi-node Installation : Havana" I have given steps for configuring multi-node set up with Controller, Compute and Network nodes. In this post I will show how to separate glance node from Controller.

1.1. Preparing Ubuntu
After you install Ubuntu 12.04 or 13.04 Server 64bits, Go in sudo mode and don't leave it until the end of this guide:
sudo su
Add Havana repositories [Only for Ubuntu 12.04]:
apt-get install -y ubuntu-cloud-keyring
echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main >> /etc/apt/sources.list.d/havana.list
Update your system:
apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y

MySQL
apt-get install python-mysqldb 

1.2. Networking
Only one NIC should have an internet access, hence configure /etc/network/interfaces as follows:
#For Exposing OpenStack API over the internet
auto eth1
iface eth1 inet static
address 172.24.1.4
netmask 255.255.0.0
gateway 172.24.0.1
dns-nameservers 148.147.161.2
#Not internet connected(used for OpenStack management)
auto eth0
iface eth0 inet static
address 172.21.1.4
netmask 255.255.0.0
Restart the networking service:
service networking restart (# /etc/init.d/networking restart)
Preferrably reboot the machine J
1.3. Glance
We Move now to Glance installation:
apt-get install -y glance
Update /etc/glance/glance-api-paste.ini with:
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
delay_auth_decision = true
auth_host = 172.21.1.11
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = root123
Update the /etc/glance/glance-registry-paste.ini with:
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_host = 172.21.1.11
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = root123
Update /etc/glance/glance-api.conf with:
sql_connection = mysql://glanceUser:glancePass@172.21.1.11/glance
notifier_strategy = rabbit
rabbit_host = 172.21.1.11
rabbit_userid = guest
rabbit_password = root123

[keystone_authtoken]
auth_host = 172.21.1.11
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = root123
And:
[paste_deploy]
flavor = keystone
Update the /etc/glance/glance-registry.conf with:
sql_connection = mysql://glanceUser:glancePass@172.21.1.11/glance
notifier_strategy = rabbit
rabbit_host = 172.21.1.11
rabbit_userid = guest
rabbit_password = root123

[keystone_authtoken]
auth_host = 172.21.1.11
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = root123
And:
[paste_deploy]
flavor = keystone
Remember you had run keystone-basic.sh and keystone-endpoints.sh script or some kind of script while installing keystone and filling the tables with some values on controller node. In the keystone-endpoints.sh script, we enter the address of glance endpoint which by-default we have pointed to controller node. You can see that by logging onto mysql database as root user, using database keystone, and then checking the contents of table endpoint in keystone database there will be entries for glance service endpoint as a controller node. You can check this running following command in mysql :
mysql> select url from endpoint;
 But actual glance service endpoint is your glance node which we separated from controller i.e. 172.21.1.4. In normal case, URL for glance in endpoint table contains the ip-address of controller node and you need to modify this address to point to your glance host. This can be edited by entering the below mentioned sql command:-
update endpoint set url='http://172.21.1.4:9292/v2' where service_id='<service-id>';
Once this command is entered, you will see that three rows are affected in the table and now they point to the glance host.
Next you need to update the address of glance-host in nova.conf file present on controller node, as well as on all the compute nodes. Do the change mentioned below in all hosts(controller + compute hosts).
Open /etc/nova/nova.conf and modify the flag:-

# Imaging service
glance_api_servers=172.21.1.4:9292
image_service=nova.image.glance.GlanceImageService
  
Now, Restart the glance-api and glance-registry services:
service glance-api restart; service glance-registry restart
Synchronize the glance database:
glance-manage db_sync

To test Glance, upload the cirros cloud image directly from the internet:
glance image-create --name myFirstImage --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
Now list the image to see what you have just uploaded:
glance image-list

And you are Done !!

Cheers,
Shalmali :)

No comments:

Post a Comment