Glance in OpenStack

GLANCE
glance

Images and instances

# source keystone_admin

# openstack user create — domain default — project PROJECTNAME — password-prompt glance

# openstack role add — project PROJECTNAME — user glance admin

# openstack role assignment list — names

# openstack service create — name glance — description “OpenStack Image” image

# openstack service list

# openstack endpoint create — region Tehran image admin http://controller:9292
# openstack endpoint create — region Tehran image public http://controller:9292
# openstack endpoint create — region Tehran image internal http://controller:9292

# mysql -u root -p

MariaDB [(none)]> CREATE DATABASE glance;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'GLANCE_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'GLANCE_DBPASS';

# yum — enablerepo=centos-openstack-train -y install openstack-glance

# grep -ve “^#” -ve “^$” /etc/glance/glance-api.conf

[database]
# ...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
bind_host = 0.0.0.0
[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = GLANCE_PASS

[paste_deploy]
# ...
flavor = keystone
config_file = /etc/glance/glance-api-paste.ini

# cp /usr/share/glance/glance-api-dist-paste.ini /etc/glance/glance-api-dist-paste.ini

[glance_store]
# ...
stores = file
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

# sudo -u glance glance-manage db_sync

# systemctl start openstack-glance-api.service

# systemctl enable openstack-glance-api.service

# ss -tulpen | grep 9292

Get images

# openstack image create DOWNLOADED_DISK_IMAGE— public \
— disk-format qcow2 — container-format bare \
— file DOWNLOADED_DISK_IMAGE.qcow2

cirros

# openstack image list

# openstack image show IMAGE_ID

# openstack image set — min-disk <disk-gb> IMAGE_ID

# openstack image set — min-ram <ram-mb> IMAGE_ID

# openstack image set — protected

Useful image properties

# openstack image set — property hw_scsi_model=virtio-scsi IMAGE_ID

# openstack image set — property os_type=linux IMAGE_ID

If you enjoyed this article, please click the 👏 button and share to help others find it! Feel free to leave a comment below.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store