[install-guide] convert glance chapter to RST

Change-Id: I35648b300534ab82355014df34ffa2e3095d3254
Implements: blueprint installguide-liberty
This commit is contained in:
KATO Tomoyuki
2015-07-09 17:33:53 +09:00
parent c173c62806
commit 7cbab1e800
3 changed files with 493 additions and 0 deletions

View File

@@ -0,0 +1,353 @@
=====================
Install and configure
=====================
This section describes how to install and configure the Image service,
code-named glance, on the controller node. For simplicity, this
configuration stores images on the local file system.
.. note::
This section assumes proper installation, configuration, and
operation of the Identity service as described in
keystone-install and keystone-verify as well as setup of the
:file:`admin-openrc.sh` script as described in
keystone-client-environment-scripts.
.. TODO(katomo): add links to keystone after creation.
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:
a. Use the database access client to connect to the database
server as the ``root`` user:
.. code-block:: console
$ mysql -u root -p
b. Create the ``glance`` database:
.. code-block:: console
CREATE DATABASE glance;
c. Grant proper access to the ``glance`` database:
.. code-block:: console
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'GLANCE_DBPASS';
Replace ``GLANCE_DBPASS`` with a suitable password.
d. Exit the database access client.
#. Source the ``admin`` credentials to gain access to
admin-only CLI commands:
.. code-block:: console
$ source admin-openrc.sh
#. To create the service credentials, complete these steps:
a. Create the ``glance`` user:
.. code-block:: console
$ openstack user create --password-prompt glance
User Password:
Repeat User Password:
+----------+----------------------------------+
| Field | Value |
+----------+----------------------------------+
| email | None |
| enabled | True |
| id | 1dc206e084334db2bee88363745da014 |
| name | glance |
| username | glance |
+----------+----------------------------------+
b. Add the ``admin`` role to the ``glance`` user and
``service`` project:
.. code-block:: console
$ openstack role add --project service --user glance admin
+-------+----------------------------------+
| Field | Value |
+-------+----------------------------------+
| id | cd2cb9a39e874ea69e5d4b896eb16128 |
| name | admin |
+-------+----------------------------------+
c. Create the ``glance`` service entity:
.. code-block:: console
$ 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 Image service API endpoint:
.. code-block:: console
$ 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.
.. only:: obs
1. Install the packages:
.. code-block:: console
# zypper install openstack-glance python-glanceclient
.. only:: rdo
1. Install the packages:
.. code-block:: console
# yum install openstack-glance python-glance python-glanceclient
.. The installation of python-glance is a workaround
for bug: https://bugzilla.redhat.com/show_bug.cgi?id=1213545
.. only:: ubuntu
1. Install the packages:
.. code-block:: console
# apt-get install glance python-glanceclient
2. Edit the :file:`/etc/glance/glance-api.conf` file and complete
the following actions:
a. In the ``[database]`` section, configure database access:
.. code-block:: ini
:linenos:
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
Replace ``GLANCE_DBPASS`` with the password you chose for the
Image service database.
b. In the ``[keystone_authtoken]`` and ``[paste_deploy]`` sections,
configure Identity service access:
.. code-block:: ini
:linenos:
[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
Replace ``GLANCE_PASS`` with the password you chose for the
``glance`` user in the Identity service.
.. note::
Comment out or remove any other options in the
``[keystone_authtoken]`` section.
c. In the ``[glance_store]`` section, configure the local file
system store and location of image files:
.. code-block:: ini
:linenos:
[glance_store]
...
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
d. In the ``[DEFAULT]`` section, configure the ``noop``
notification driver to disable notifications because
they only pertain to the optional Telemetry service:
.. code-block:: ini
:linenos:
[DEFAULT]
...
notification_driver = noop
The Telemetry chapter provides an Image service configuration
that enables notifications.
e. (Optional) To assist with troubleshooting,
enable verbose logging in the ``[DEFAULT]`` section:
.. code-block:: ini
:linenos:
[DEFAULT]
...
verbose = True
3. Edit the :file:`/etc/glance/glance-registry.conf` file and
complete the following actions:
a. In the ``[database]`` section, configure database access:
.. code-block:: ini
:linenos:
[database]
...
connection = mysql://glance:GLANCE_DBPASS@controller/glance
Replace ``GLANCE_DBPASS`` with the password you chose for the
Image service database.
b. In the ``[keystone_authtoken]`` and ``[paste_deploy]`` sections,
configure Identity service access:
.. code-block:: ini
:linenos:
[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
Replace ``GLANCE_PASS`` with the password you chose for the
``glance`` user in the Identity service.
.. note::
Comment out or remove any other options in the
``[keystone_authtoken]`` section.
c. In the ``[DEFAULT]`` section, configure the ``noop`` notification
driver to disable notifications because they only pertain to the
optional Telemetry service:
.. code-block:: ini
:linenos:
[DEFAULT]
...
notification_driver = noop
The Telemetry chapter provides an Image service configuration
that enables notifications.
d. (Optional) To assist with troubleshooting,
enable verbose logging in the ``[DEFAULT]`` section:
.. code-block:: ini
:linenos:
[DEFAULT]
...
verbose = True
.. only:: rdo or ubuntu
4. Populate the Image service database:
.. code-block:: console
# su -s /bin/sh -c "glance-manage db_sync" glance
To finalize installation
------------------------
.. only:: obs or rdo
#. Start the Image service services and configure them to start when
the system boots:
.. code-block:: console
# systemctl enable openstack-glance-api.service openstack-glance-registry.service
# systemctl start openstack-glance-api.service openstack-glance-registry.service
.. only:: ubuntu
#. Restart the Image service services:
.. code-block:: console
# service glance-registry restart
# service glance-api restart
#. By default, the Ubuntu packages create an SQLite database.
Because this configuration uses a SQL database server, you can
remove the SQLite database file:
.. code-block:: console
# rm -f /var/lib/glance/glance.sqlite

View File

@@ -0,0 +1,108 @@
================
Verify operation
================
Verify operation of the Image service using
`CirrOS <http://launchpad.net/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
<http://docs.openstack.org/image-guide/content/index.html>`__.
For information about how to manage images, see the
`OpenStack User Guide
<http://docs.openstack.org/user-guide/index.html>`__.
#. In each client environment script, configure the Image service
client to use API version 2.0:
.. code-block:: console
$ 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:
.. code-block:: console
$ source admin-openrc.sh
#. Create a temporary local directory:
.. code-block:: console
$ mkdir /tmp/images
#. Download the source image into it:
.. code-block:: console
$ 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:
.. TODO(katomo): add link to glossterm QCOW2
.. code-block:: console
$ 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 | 133eae9fb1c98f45894a4e60d8736619 |
| container_format | bare |
| created_at | 2015-03-26T16:52:10Z |
| disk_format | qcow2 |
| id | 38047887-61a7-41ea-9b49-27987d5e8bb9 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros-0.3.4-x86_64 |
| owner | ae7a98326b9c455588edd2656d723b9d |
| protected | False |
| size | 13200896 |
| status | active |
| tags | [] |
| updated_at | 2015-03-26T16:52:10Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
For information about the :command:`glance image-create` parameters,
see `Image service command-line client
<http://docs.openstack.org/cli-reference/content/
glanceclient_commands.html#glanceclient_subcommand_image-create>`__
in the ``OpenStack Command-Line Interface Reference``.
For information about disk and container formats for images, see
`Disk and container formats for images
<http://docs.openstack.org/image-guide/content/image-formats.html>`__
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:
.. code-block:: console
$ glance image-list
+--------------------------------------+---------------------+
| ID | Name |
+--------------------------------------+---------------------+
| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros-0.3.4-x86_64 |
+--------------------------------------+---------------------+
#. Remove the temporary local directory and source image:
.. code-block:: console
$ rm -r /tmp/images

View File

@@ -1,3 +1,35 @@
=====================
Add the Image service
=====================
.. toctree::
glance-install.rst
glance-verify.rst
.. TODO(katomo): add getstart_image to toctree after creation
The OpenStack Image service (glance) enables users to discover,
register, and retrieve virtual machine images. It offers a REST
API that enables you to query virtual machine image metadata and
retrieve an actual image. You can store virtual machine images
made available through the Image service in a variety of locations,
from simple file systems to object-storage systems like OpenStack
Object Storage.
.. TODO(katomo): add link to glossterm REST.
.. important::
For simplicity, this guide describes configuring the Image service to
use the ``file`` back end, which uploads and stores in a
directory on the controller node hosting the Image service. By
default, this directory is :file:`/var/lib/glance/images/`.
Before you proceed, ensure that the controller node has at least
several gigabytes of space available in this directory.
For information on requirements for other back ends, see
`Configuration Reference <http://docs.openstack.org/trunk/
config-reference/content/
ch_configuring-openstack-image-service.html>`__.