To configure prerequisites
Before you install and configure the Image service, you must
create a database, service credentials, and API endpoint.- To create the database, complete these steps:
- Use the database access client to connect to the database
server as the
root
user:
$ mysql -u root -p
- Create the
glance
database:
CREATE DATABASE glance;
- Grant proper access to the
glance
database:
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \ IDENTIFIED BY '
ReplaceGLANCE_DBPASS
'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \ IDENTIFIED BY 'GLANCE_DBPASS
';GLANCE_DBPASS
with a suitable password. - Exit the database access client.
- Use the database access client to connect to the database
server as the
- Source the
admin
credentials to gain access to admin-only CLI commands:
$ source admin-openrc.sh
- To create the service credentials, complete these steps:
- Create the
glance
user:
$ openstack user create --password-prompt glance User Password: Repeat User Password: +----------+----------------------------------+ | Field | Value | +----------+----------------------------------+ | email | None | | enabled | True | | id | 1dc206e084334db2bee88363745da014 | | name | glance | | username | glance | +----------+----------------------------------+
- Add the
admin
role to theglance
user andservice
project:
$ openstack role add --project service --user glance admin +-------+----------------------------------+ | Field | Value | +-------+----------------------------------+ | id | cd2cb9a39e874ea69e5d4b896eb16128 | | name | admin | +-------+----------------------------------+
- Create the
glance
service entity:
$ openstack service create --name glance \ --description "OpenStack Image service" image
+-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image service | | enabled | True | | id | 178124d6081c441b80d79972614149c6 | | name | glance | | type | image | +-------------+----------------------------------+
- Create the
- Create the Image service API endpoint:
$ openstack endpoint create \ --publicurl http://
controller
:9292 \ --internalurl http://controller
:9292 \ --adminurl http://controller
:9292 \ --region RegionOne \ image +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | adminurl | http://controller:9292 | | id | 805b1dbc90ab47479111102bc6423313 | | internalurl | http://controller:9292 | | publicurl | http://controller:9292 | | region | RegionOne | | service_id | 178124d6081c441b80d79972614149c6 | | service_name | glance | | service_type | image | +--------------+----------------------------------+
To install and configure the Image service components
Note | |
---|---|
Default configuration files vary by distribution. You might need to add these sections and options rather than modifying existing sections and options. Also, an ellipsis (...) in the configuration snippets indicates potential default configuration options that you should retain. |
- Install the packages:
# yum install openstack-glance python-glance python-glanceclient
- Edit the
/etc/glance/glance-api.conf
file and complete the following actions:
- In the
[database]
section, configure database access:
123[database]
...
connection = mysql:
//glance
:GLANCE_DBPASS@controller
/glance
GLANCE_DBPASS
with the password you chose for the Image service database. - In the
[keystone_authtoken]
and[paste_deploy]
sections, configure Identity service access:
1234567891011121314[keystone_authtoken]
...
auth_uri = http:
//
controller:5000
auth_url = http:
//
controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
...
flavor = keystone
GLANCE_PASS
with the password you chose for theglance
user in the Identity service.
Note Comment out or remove any other options in the [keystone_authtoken]
section. - In the
[glance_store]
section, configure the local file system store and location of image files:
1234[glance_store]
...
default_store =
file
filesystem_store_datadir =
/var/lib/glance/images/
- In the
[DEFAULT]
section, configure thenoop
notification driver to disable notifications because they only pertain to the optional Telemetry service:
123[DEFAULT]
...
notification_driver = noop
- (Optional) To assist with troubleshooting,
enable verbose logging in the
[DEFAULT]
section:
123[DEFAULT]
...
verbose = True
- In the
- Edit the
/etc/glance/glance-registry.conf
file and complete the following actions:
- In the
[database]
section, configure database access:
123[database]
...
connection = mysql:
//glance
:GLANCE_DBPASS@controller
/glance
GLANCE_DBPASS
with the password you chose for the Image service database. - In the
[keystone_authtoken]
and[paste_deploy]
sections, configure Identity service access:
1234567891011121314[keystone_authtoken]
...
auth_uri = http:
//
controller:5000
auth_url = http:
//
controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
...
flavor = keystone
GLANCE_PASS
with the password you chose for theglance
user in the Identity service.
Note Comment out or remove any other options in the [keystone_authtoken]
section. - In the
[DEFAULT]
section, configure thenoop
notification driver to disable notifications because they only pertain to the optional Telemetry service:
123[DEFAULT]
...
notification_driver = noop
- (Optional) To assist with troubleshooting,
enable verbose logging in the
[DEFAULT]
section:
123[DEFAULT]
...
verbose = True
- In the
- Populate the Image service database:
# su -s /bin/sh -c "glance-manage db_sync" glance
To finalize installation
- Start the Image service services and configure them to start when
the system boots:
# systemctl enable openstack-glance-api.service openstack-glance-registry.service # systemctl start openstack-glance-api.service openstack-glance-registry.service
Verify operation
Verify operation of the Image service using CirrOS, a small Linux image that helps you test your OpenStack deployment.
For more information about how to download and build images, see OpenStack Virtual Machine Image Guide. For information about how to manage images, see the OpenStack User Guide.
- In each client environment script, configure the Image service
client to use API version 2.0:
$ echo "export OS_IMAGE_API_VERSION=2" | tee -a admin-openrc.sh demo-openrc.sh
- Source the
admin
credentials to gain access to admin-only CLI commands:
$ source admin-openrc.sh
- Create a temporary local directory:
$ mkdir /tmp/images
- Download the source image into it:
$ wget -P /tmp/images http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
- Upload the image to the Image service using the
QCOW2
disk format, bare container format, and
public visibility so all projects can access it:
$ glance image-create --name "cirros-0.3.4-x86_64" --file /tmp/images/cirros-0.3.4-x86_64-disk.img \ --disk-format qcow2 --container-format bare --visibility public --progress [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | ee1eca47dc88f4879d8a229cc70a07c6 | | container_format | bare | | created_at | 2015-10-08T19:11:12Z | | disk_format | qcow2 | | id | 3f65b449-a945-4247-bcc2-e33d94a07cb6 | | min_disk | 0 | | min_ram | 0 | | name | cirros-0.3.4-x86_64 | | owner | 9c1cc7fa7fc24c17812ec662555ba519 | | protected | False | | size | 13287936 | | status | active | | tags | [] | | updated_at | 2015-10-08T19:11:13Z | | virtual_size | None | | visibility | public | +------------------+--------------------------------------+
For information about the glance image-create parameters, see Image service command-line client in the OpenStack Command-Line Interface Reference.
For information about disk and container formats for images, see Disk and container formats for images in the OpenStack Virtual Machine Image Guide.
Note OpenStack generates IDs dynamically, so you will see different values in the example command output. - Confirm upload of the image and validate
attributes:
$ glance image-list +--------------------------------------+---------------------+ | ID | Name | +--------------------------------------+---------------------+ | 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros-0.3.4-x86_64 | +--------------------------------------+---------------------+
- Remove the temporary local directory and source image:
$ rm -r /tmp/images
- In each client environment script, configure the Image service
client to use API version 2.0:
No comments:
Post a Comment