[ Previous: Keystone (2 / 9) ] [ 3 / 9 : Glance ] [ Next: Placement (4 / 9) ]
Create a project named “service”
openstack project create --domain default --description "Service Project" service
Create DB for image services – execute the following in MySQL prompt
create database glance;
grant all privileges on glance.* to glance@'localhost' identified by 'password';
grant all privileges on glance.* to glance@'%' identified by 'password';
flush privileges;
exit
Create a user ‘glance’ in the ‘service’ project with a password of choice – my preference keep it as ‘password’ for learning purpose
openstack user create --domain default --project service --password password glance
Add a role ‘admin’ in the ‘service’ project for the ‘glance’ user
openstack role add --project service --user glance admin
Create ‘glance’ service for image services
openstack service create --name glance --description "OpenStack Image Service" image
Create public, internal, and admin endpoints for image service
openstack endpoint create --region RegionOne image public http://10.0.3.1:9292
openstack endpoint create --region RegionOne image internal http://10.0.3.1:9292
openstack endpoint create --region RegionOne image admin http://10.0.3.1:9292
Install packages
apt -y install glance
Update configuration file /etc/glance/glance-api.conf as shown below.
[DEFAULT]
bind_host = 0.0.0.0
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[database]
# MariaDB connection info
connection = mysql+pymysql://glance:password@10.0.3.1/glance
# keystone auth info
[keystone_authtoken]
www_authenticate_uri = http://10.0.3.1:5000
auth_url = http://10.0.3.1:5000
memcached_servers = 10.0.3.1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = password
[paste_deploy]
flavor = keystone
In case, you had created a new configuration file ensure the access rights are updated
chmod 640 /etc/glance/glance-api.conf
chown root:glance /etc/glance/glance-api.conf
Populate the glance DB
su -s /bin/bash glance -c "glance-manage db_sync"
Enable glance service, should start on server reboot, and restart glance services.
systemctl enable glance-api.service
systemctl restart glance-api
Download an image for verifying glance service – Download the ‘cirros’ image
wget http://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img
Add/upload the image to glance repository
openstack image create "Cirros" --file cirros-0.5.2-x86_64-disk.img --disk-format qcow2 --container-format bare --public
Verify the upload
openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 5f192727-4c97-4c05-9ac9-6f0071d4bb05 | Cirros | active |
+--------------------------------------+--------+--------+
[ Previous: Keystone (2 / 9) ] [ 3 / 9 : Glance ] [ Next: Placement (4 / 9) ]