f78b852826
I'd commented this section out earlier (config worked without it), however reentering on Shaun's advice. Change-Id: Ifdecd5f5b142a1d5e18453dfac6bbf2bac5c0f88
158 lines
9.7 KiB
XML
158 lines
9.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<section xml:id="glance-install"
|
|
xmlns="http://docbook.org/ns/docbook"
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
xmlns:svg="http://www.w3.org/2000/svg"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
version="5.0">
|
|
<title>Installing the Image Service</title>
|
|
<para>The Image service acts as a registry for virtual disk images. Users can add new images
|
|
or take a snapshot (copy) of an existing server for immediate storage. Snapshots can be
|
|
used as back up or as templates for new servers. Registered images can be stored in the
|
|
Object Storage service, as well as in other locations (for example, in simple file
|
|
systems or external web servers).</para>
|
|
<note>
|
|
<para>Steps in this procedure assume you have the appropriate environment
|
|
variables set to specify your credentials, as described in
|
|
<xref linkend="keystone-verify"/>.</para>
|
|
</note>
|
|
<procedure>
|
|
<title>Install the Image Service</title>
|
|
<step><para>Install the Image Service on the controller node.</para>
|
|
<screen os="ubuntu;debian"><prompt>#</prompt> <userinput>apt-get install glance</userinput></screen>
|
|
<screen os="rhel;centos;fedora"><prompt>#</prompt> <userinput>yum install openstack-glance</userinput></screen>
|
|
<screen os="opensuse;sles"><prompt>#</prompt> <userinput>zypper install openstack-glance python-glanceclient</userinput></screen></step>
|
|
|
|
<step os="rhel;centos;fedora;opensuse;sles"><para>The Image Service stores information about images in a database.
|
|
This guide uses the MySQL database used by other OpenStack services.</para>
|
|
<para>Use the <command>openstack-db</command> command to create the
|
|
database and tables for the Image Service, as well as a database user
|
|
called <literal>glance</literal> to connect to the database. Replace
|
|
<literal><replaceable>GLANCE_DBPASS</replaceable></literal> with a
|
|
password of your choosing.</para>
|
|
<screen><prompt>#</prompt> <userinput>openstack-db --init --service glance --password <replaceable>GLANCE_DBPASS</replaceable></userinput></screen></step>
|
|
|
|
<step os="ubuntu;debian">
|
|
<para>The Image Service stores information about images in a database.
|
|
This guide uses the MySQL database used by other OpenStack services.
|
|
The Ubuntu packages create an sqlite database by
|
|
default. Delete the <filename>glance.sqlite</filename> file created in
|
|
the <filename>/var/lib/glance/</filename> directory so it is not used by mistake.</para>
|
|
<para>First, we need to create a database user called <literal>glance</literal>, by logging in
|
|
as root using the password we set earlier.</para>
|
|
<screen><prompt>#</prompt> <userinput>mysql -u root -p</userinput>
|
|
<prompt>mysql></prompt> <userinput>CREATE DATABASE glance;</userinput>
|
|
<prompt>mysql></prompt> <userinput>GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
|
|
IDENTIFIED BY '<replaceable>GLANCE_DBPASS</replaceable>';</userinput>
|
|
<prompt>mysql></prompt> <userinput>GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
|
|
IDENTIFIED BY '<replaceable>GLANCE_DBPASS</replaceable>';</userinput></screen>
|
|
</step>
|
|
|
|
|
|
<step><para>Tell the Image Service to use the created database. The Image Service provides two OpenStack
|
|
services: <literal>glance-api</literal> and <literal>glance-registry</literal>. They each
|
|
have separate configuration files, so you must configure both files throughout this
|
|
section.</para>
|
|
<screen os="rhel;centos;fedora;opensuse;sles"><prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-api.conf \
|
|
DEFAULT sql_connection mysql://glance:<replaceable>GLANCE_DBPASS</replaceable>@<replaceable>controller</replaceable>/glance</userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-registry.conf \
|
|
DEFAULT sql_connection mysql://glance:<replaceable>GLANCE_DBPASS</replaceable>@<replaceable>controller</replaceable>/glance</userinput></screen>
|
|
<para os="ubuntu;debian">Edit <filename>/etc/glance/glance-api.conf</filename> and <filename>/etc/glance/glance-registry.conf</filename>
|
|
and change the <literal>[DEFAULT]</literal> section.</para>
|
|
<programlisting os="ubuntu;debian" language="ini">
|
|
...
|
|
[DEFAULT]
|
|
...
|
|
# SQLAlchemy connection string for the reference implementation
|
|
# registry server. Any valid SQLAlchemy connection string is fine.
|
|
# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
|
|
sql_connection = mysql://glance:GLANCE_DBPASS@localhost/glance
|
|
...
|
|
</programlisting>
|
|
|
|
</step>
|
|
|
|
<step os="ubuntu;debian">
|
|
<para>We now create the database tables for the Image service.</para>
|
|
<screen><prompt>#</prompt> <userinput>glance-manage db_sync</userinput></screen>
|
|
</step>
|
|
|
|
|
|
<step><para>Create a user called <literal>glance</literal> that the Image
|
|
Service can use to authenticate with the Identity Service. Use the
|
|
<literal>service</literal> tenant and give the user the
|
|
<literal>admin</literal> role.</para>
|
|
<screen><prompt>#</prompt> <userinput>keystone user-create --name=glance --pass=<replaceable>GLANCE_DBPASS</replaceable> --email=<replaceable>glance@example.com</replaceable></userinput>
|
|
<prompt>#</prompt> <userinput>keystone user-role-add --user=glance --tenant=service --role=admin</userinput></screen></step>
|
|
<step><para>Add the credentials to the Image Service's configuration files.</para>
|
|
|
|
<screen os="centos;rhel;fedora;opensuse;sles"><prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host <replaceable>controller</replaceable></userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance</userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service</userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password <replaceable>GLANCE_DBPASS</replaceable></userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host <replaceable>controller</replaceable></userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance</userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service</userinput>
|
|
<prompt>#</prompt> <userinput>openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password <replaceable>GLANCE_DBPASS</replaceable></userinput></screen>
|
|
<para os="ubuntu;debian">Edit <filename>/etc/glance/glance-api.conf</filename> and <filename>/etc/glance/glance-registry.conf</filename>
|
|
and change the <literal>[keystone_authtoken]</literal> section.</para>
|
|
<programlisting os="ubuntu;debian" language="ini">
|
|
...
|
|
[keystone_authtoken]
|
|
auth_host = controller
|
|
auth_port = 35357
|
|
auth_protocol = http
|
|
admin_tenant_name = service
|
|
admin_user = glance
|
|
admin_password = GLANCE_DBPASS
|
|
...
|
|
</programlisting>
|
|
<para>You also have to add the credentials to the files
|
|
<filename>/etc/glance/glance-api-paste.ini</filename> and
|
|
<filename>/etc/glance/glance-registry-paste.ini</filename>. Open each file
|
|
in a text editor and locate the section <literal>[filter:authtoken]</literal>.
|
|
Make sure the following options are set:</para>
|
|
<programlisting language="ini">[filter:authtoken]
|
|
paste.filter_factory=keystoneclient.middleware.auth_token:filter_factory
|
|
auth_host=controller
|
|
admin_user=glance
|
|
admin_tenant_name=service
|
|
admin_password=<replaceable>GLANCE_DBPASS</replaceable></programlisting>
|
|
<para>
|
|
<note><para>If you have troubles connecting to the database, try using the IP address instead of the
|
|
host name in the credentials.</para></note>
|
|
</para></step>
|
|
|
|
<step><para>Register the Image Service with the Identity Service
|
|
so that other OpenStack services can locate it. Register the service and
|
|
specify the endpoint using the <command>keystone</command> command.</para>
|
|
<screen><prompt>#</prompt> <userinput>keystone service-create --name=glance --type=image \
|
|
--description="Glance Image Service"</userinput></screen></step>
|
|
<step><para>Note the service's <literal>id</literal> property returned in the previous step and use it when
|
|
creating the endpoint.</para>
|
|
<screen><prompt>#</prompt> <userinput>keystone endpoint-create \
|
|
--service-id=<replaceable>the_service_id_above</replaceable> \
|
|
--publicurl=http://<replaceable>controller</replaceable>:9292 \
|
|
--internalurl=http://<replaceable>controller</replaceable>:9292 \
|
|
--adminurl=http://<replaceable>controller</replaceable>:9292</userinput></screen></step>
|
|
|
|
<step os="ubuntu;debian">
|
|
<para>We now restart the glance service with its new settings.</para>
|
|
<screen><prompt>#</prompt> <userinput>service glance-registry restart</userinput>
|
|
<prompt>#</prompt> <userinput>service glance-api restart</userinput></screen>
|
|
</step>
|
|
|
|
|
|
|
|
<step os="rhel;fedora;centos;opensuse;sles"><para>Start the <literal>glance-api</literal> and
|
|
<literal>glance-registry</literal> services and configure them to
|
|
start when the system boots.</para>
|
|
<screen os="rhel;fedora;centos;opensuse;sles"><prompt>#</prompt> <userinput>service openstack-glance-api start</userinput>
|
|
<prompt>#</prompt> <userinput>service openstack-glance-registry start</userinput>
|
|
<prompt>#</prompt> <userinput>chkconfig openstack-glance-api on</userinput>
|
|
<prompt>#</prompt> <userinput>chkconfig openstack-glance-registry on</userinput></screen>
|
|
</step>
|
|
</procedure>
|
|
</section>
|