Este conteúdo não está disponível no idioma selecionado.
5.4. Configure the Image Service
- Configure the Identity service for Image service authentication (create database entries, set connection strings, and update configuration files).
- Configure the disk-image storage back end (this guide uses the Object Storage service).
- Configure the firewall for Image service access.
- Configure TLS/SSL.
- Populate the Image service database.
5.4.1. Configure the Image Service Database Connection Copiar o linkLink copiado para a área de transferência!
/etc/glance/glance-api.conf and /etc/glance/glance-registry.conf files. It must be updated to point to a valid database server before starting the service.
root user.
Procedure 5.2. Configuring the Image Service SQL Database Connection
- Set the value of the
sql_connectionconfiguration key in theglance-api.conffile:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT sql_connection mysql://USER:PASS@IP/DB
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT sql_connection mysql://USER:PASS@IP/DBCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the following values:- Replace USER with the Image service database user name, usually
glance. - Replace PASS with the password of the database user.
- Replace IP with the IP address or host name of the server hosting the database service.
- Replace DB with the name of the Image service database, usually
glance.
- Set the value of the
sql_connectionconfiguration key in theglance-registry.conffile:openstack-config --set /etc/glance/glance-registry.conf \ DEFAULT sql_connection mysql://USER:PASS@IP/DB
# openstack-config --set /etc/glance/glance-registry.conf \ DEFAULT sql_connection mysql://USER:PASS@IP/DBCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace USER, PASS, IP, and DB with the same values used in the previous step.
Important
5.4.2. Create the Image Service Identity Records Copiar o linkLink copiado para a área de transferência!
services tenant. For more information, see:
keystonerc_admin file and on which the keystone command-line utility is installed.
Procedure 5.3. Creating Identity Records for the Image Service
- Set up the shell to access Keystone as the admin user:
source ~/keystonerc_admin
# source ~/keystonerc_adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
glanceuser:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace PASSWORD with a secure password that will be used by the Image Service when authenticating with the Identity service. - Link the
glanceuser and theadminrole together within the context of theservicestenant:[(keystone_admin)]# openstack role add --project services --user glance admin
[(keystone_admin)]# openstack role add --project services --user glance adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
glanceImage service entry:[(keystone_admin)]# openstack service create --name glance \ --description "Glance Image Service" \ image[(keystone_admin)]# openstack service create --name glance \ --description "Glance Image Service" \ imageCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
glanceendpoint entry:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace IP with the IP address or host name of the server hosting the Image service.
5.4.3. Configure Image Service Authentication Copiar o linkLink copiado para a área de transferência!
root user.
Procedure 5.4. Configuring the Image Service to Authenticate through the Identity Service
- Configure the
glance-apiservice:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the
glance-registryservice:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Replace IP with the IP address or host name of the Identity server.
- Replace services with the name of the tenant that was created for the use of the Image service (previous examples set this to
services). - Replace glance with the name of the service user that was created for the Image service (previous examples set this to
glance). - Replace PASSWORD with the password associated with the service user.
5.4.4. Use the Object Storage Service for Image Storage Copiar o linkLink copiado para a área de transferência!
file) for its storage back end; however, either of the following storage back ends can be used to store uploaded disk images:
file- Local file system of the Image server (/var/lib/glance/images/directory)swift- OpenStack Object Storage service
Note
openstack-config command; however, you can also manually update the /etc/glance/glance-api.conf file. If manually updating the file, ensure that the default_store parameter is set to the correct back end (for example, 'default_store=rbd'), and update the parameters in that back end's section (for example, under 'RBD Store Options').
Procedure 5.5. Configuring the Image Service to use the Object Storage Service
- Set the
default_storeconfiguration key toswift:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT default_store swift
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT default_store swiftCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the
swift_store_auth_addressconfiguration key to the public endpoint for the Identity service:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_auth_address http://IP:5000/v2.0/
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_auth_address http://IP:5000/v2.0/Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the container for storing images in the Object Storage service:
openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_create_container_on_put True
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_create_container_on_put TrueCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the
swift_store_userconfiguration key, in the format TENANT:USER, to contain the tenant and user to use for authentication:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_user services:swift
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_user services:swiftCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you followed the instructions in this guide to deploy Object Storage, replace these values with the
servicestenant and theswiftuser respectively (as shown in the command example above). - If you did not follow the instructions in this guide to deploy Object Storage, replace these values with the appropriate Object Storage tenant and user for your environment.
- Set the
swift_store_keyconfiguration key to the password that was set for theswiftuser when deploying the Object Storage service:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_key PASSWORD
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT swift_store_key PASSWORDCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4.5. Configure the Firewall to Allow Image Service Traffic Copiar o linkLink copiado para a área de transferência!
9292. All steps in this procedure must be performed on the server hosting the Image service, while logged in as the root user.
Procedure 5.6. Configuring the Firewall to Allow Image Service Traffic
- Open the
/etc/glance/glance-api.conffile in a text editor, and remove any comment characters preceding the following parameters:bind_host = 0.0.0.0 bind_port = 9292
bind_host = 0.0.0.0 bind_port = 9292Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Open the
/etc/sysconfig/iptablesfile in a text editor. - Add an INPUT rule allowing TCP traffic on port
9292. The new rule must appear before any INPUT rules that REJECT traffic:-A INPUT -p tcp -m multiport --dports 9292 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 9292 -j ACCEPTCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Save the changes to the
/etc/sysconfig/iptablesfile. - Restart the
iptablesservice to ensure that the change takes effect:systemctl restart iptables.service
# systemctl restart iptables.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4.6. Configure RabbitMQ Message Broker Settings for the Image Service Copiar o linkLink copiado para a área de transferência!
root user.
Procedure 5.7. Configuring the Image Service (glance) to Use the RabbitMQ Message Broker
- Set RabbitMQ as the notifier:
openstack-config --set /etc/glance/glance-api.conf \ DEFAULT notification_driver messaging
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT notification_driver messagingCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the name of the RabbitMQ host:
openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_host RABBITMQ_HOST
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_host RABBITMQ_HOSTCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace RABBITMQ_HOST with the IP address or host name of the message broker. - Set the message broker port to
5672:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_port 5672
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_port 5672Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the RabbitMQ user name and password created for the Image service when RabbitMQ was configured:
openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_userid glance openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_password GLANCE_PASS
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_userid glance # openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_password GLANCE_PASSCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replaceglanceand GLANCE_PASS with the RabbitMQ user name and password created for the Image service. - When RabbitMQ was launched, the
glanceuser was granted read and write permissions to all resources: specifically, through the virtual host/. Configure the Image service to connect to this virtual host:openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_virtual_host /
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT rabbit_virtual_host /Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4.7. Configure the Image Service to Use SSL Copiar o linkLink copiado para a área de transferência!
glance-api.conf file to configure SSL.
| Configuration Option | Description |
|---|---|
cert_file
|
The path to the certificate file to use when starting the API server securely.
|
key_file
|
The path to the private key file to use when starting the API server securely.
|
ca_file
|
The path to the CA certificate file to use to verify connecting clients.
|
5.4.8. Populate the Image Service Database Copiar o linkLink copiado para a área de transferência!
Procedure 5.8. Populating the Image Service Database
- Log in to the system hosting the Image service.
- Switch to the
glanceuser:su glance -s /bin/sh
# su glance -s /bin/shCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Initialize and populate the database identified in
/etc/glance/glance-api.confand/etc/glance/glance-registry.conf:glance-manage db_sync
$ glance-manage db_syncCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4.9. Enable Image Loading Through the Local File System Copiar o linkLink copiado para a área de transferência!
Note
Procedure 5.9. Configuring Image and Compute Services to Send and Receive Images through the Local File System
- Create a JSON document that exposes the Image file system metadata required by
openstack-nova-compute. - Configure the Image service to use the JSON document.
- Configure
openstack-nova-computeto use the file system metadata provided by the Image service.
5.4.9.1. Configure the Image Service to Provide Images Through the Local File System Copiar o linkLink copiado para a área de transferência!
openstack-nova-compute service.
Procedure 5.10. Configuring the Image Service to Expose Local File System Metadata to the Compute Service
- Determine the mount point of the file system used by the Image service:
df
# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 51475068 10905752 37947876 23% / devtmpfs 2005504 0 2005504 0% /dev tmpfs 2013248 668 2012580 1% /dev/shmCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example, if the Image service uses the/dev/sda3file system, its corresponding mount point is/. - Create a unique ID for the mount point:
uuidgen
# uuidgen ad5517ae-533b-409f-b472-d82f91f41773Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the output of theuuidgen, as this will be used in the next step. - Create a file with the
.jsonextension. - Open the file in a text editor, and add the following information:
{ "id": "UID", "mountpoint": "MOUNTPT" }{ "id": "UID", "mountpoint": "MOUNTPT" }Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the following values:- Replace UID with the unique ID created in the previous step.
- Replace MOUNTPT with the mount point of the Image service's file system, as determined in the first step.
- Configure the Image service to use this JSON file:
openstack-config --set /etc/glance/glance-api.conf \ DEFAULT show_multiple_locations True openstack-config --set /etc/glance/glance-api.conf \ DEFAULT filesystem_store_metadata_file JSON_PATH
# openstack-config --set /etc/glance/glance-api.conf \ DEFAULT show_multiple_locations True # openstack-config --set /etc/glance/glance-api.conf \ DEFAULT filesystem_store_metadata_file JSON_PATHCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace JSON_PATH with the full path to the JSON file.Important
If configured without the proper policy settings, a non-admin user of the Image Service can replace active image data (that is, switch out a current image without other users knowing). See the OSSN announcement (recommended actions) for configuration information: https://wiki.openstack.org/wiki/OSSN/OSSN-0065 - Restart the Image service (if it is already running):
systemctl restart openstack-glance-registry.service systemctl restart openstack-glance-api.service
# systemctl restart openstack-glance-registry.service # systemctl restart openstack-glance-api.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4.9.2. Configure the Compute Service to Use Local File System Metadata Copiar o linkLink copiado para a área de transferência!
openstack-nova-compute to load images from the local file system.
Procedure 5.11. Configuring the Compute Service to use File System Metadata Provided by the Image Service
- Configure
openstack-nova-computeto enable the use of direct URLs that have thefile://scheme:openstack-config --set /etc/nova/nova.conf \ DEFAULT allowed_direct_url_schemes file
# openstack-config --set /etc/nova/nova.conf \ DEFAULT allowed_direct_url_schemes fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create an entry for the Image service's file system:
openstack-config --set /etc/nova/nova.conf \ image_file_url filesystems FSENTRY
# openstack-config --set /etc/nova/nova.conf \ image_file_url filesystems FSENTRYCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace FSENTRY with a name to assign to the Image service's file system. - Open the
.jsonfile used by the Image service to expose its local file-system metadata. The information in this file will be used in the next step. - Associate the entry for Image service's file system to the file system metadata exposed by the Image service:
openstack-config --set /etc/nova/nova.conf \ image_file_url:FSENTRY id UID openstack-config --set /etc/nova/nova.conf \ image_file_url:FSENTRY mountpoint MOUNTPT
# openstack-config --set /etc/nova/nova.conf \ image_file_url:FSENTRY id UID # openstack-config --set /etc/nova/nova.conf \ image_file_url:FSENTRY mountpoint MOUNTPTCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the following values:- Replace UID with the unique ID used by the Image service. In the
.jsonfile used by the Image service, the UID is the"id"value. - Replace MOUNTPT with the mount point used by the Image service's file system. In the
.jsonfile used by the Image service, the MOUNTPT is the"mountpoint"value.