From eaf681ed5ac2098932ac0a39935b2cd5486dd71e Mon Sep 17 00:00:00 2001 From: Summer Long Date: Thu, 10 Oct 2013 11:55:23 +1000 Subject: [PATCH] Updated/edited Image chapter. Install: Added short intro. Turned steps into procedures. Fixed the credentials. Added note about using IP address. Commented out redundant config. Verify: Added link to Virtual Machine Image Guide. Turned steps into procedure. Added info about -is-public value. Change-Id: I27b8397957ac352b25e868d821e9c921d6ec80c9 --- doc/install-guide/section_glance-install.xml | 148 ++++++++-------- doc/install-guide/section_glance-verify.xml | 175 +++++++++++-------- 2 files changed, 168 insertions(+), 155 deletions(-) diff --git a/doc/install-guide/section_glance-install.xml b/doc/install-guide/section_glance-install.xml index 878c184d88..19ba0093c1 100644 --- a/doc/install-guide/section_glance-install.xml +++ b/doc/install-guide/section_glance-install.xml @@ -7,107 +7,97 @@ xmlns:html="http://www.w3.org/1999/xhtml" version="5.0"> Installing the Image Service - - Install the Image Service on the controller node. - # sudo apt-get install glance - # yum install openstack-glance - # zypper install openstack-glance - - 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 glance.sqlite file created in - the /var/lib/glance/ directory. - - Use the openstack-db command to create the - database and tables for the Image Service, as well as a database user - called glance to connect to the database. Replace - GLANCE_DBPASS with a - password of your choosing. - - # openstack-db --init --service glance --password GLANCE_DBPASS - - You now have to tell the Image Service to use that database. The Image - Service provides two OpenStack services: glance-api and - glance-registry. They each have separate configuration - files, so you will have to configure both throughout this section. - - # openstack-config --set /etc/glance/glance-api.conf \ - DEFAULT sql_connection mysql://glance:GLANCE_PASS@controller/glance -# openstack-config --set /etc/glance/glance-registry.conf \ - DEFAULT sql_connection mysql://glance:GLANCE_PASS@controller/glance - - Create a user called glance that the Image - Service can use to authenticate with the Identity Service. Use the - service tenant and give the user the - admin role. - + 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). - These examples assume you have the appropriate environment - variables set to specify your credentials, as described in - . + Steps in this procedure assume you have the appropriate environment + variables set to specify your credentials, as described in + . - - # keystone user-create --name=glance --pass=GLANCE_PASS --email=glance@example.com -# keystone user-role-add --user=glance --tenant=service --role=admin - - For the Image Service to use these credentials, you have to add - them to the configuration files. - - # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller -# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user keystone + + Install the Image Service + Install the Image Service on the controller node. + # sudo apt-get install glance + # yum install openstack-glance + # zypper install openstack-glance + 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 glance.sqlite file created in + the /var/lib/glance/ directory. + Use the openstack-db command to create the + database and tables for the Image Service, as well as a database user + called glance to connect to the database. Replace + GLANCE_DBPASS with a + password of your choosing. + # openstack-db --init --service glance --password GLANCE_DBPASS + Tell the Image Service to use the created database. The Image Service provides two OpenStack + services: glance-api and glance-registry. They each + have separate configuration files, so you must configure both files throughout this + section. + # openstack-config --set /etc/glance/glance-api.conf \ + DEFAULT sql_connection mysql://glance:GLANCE_PASS@controller/glance +# openstack-config --set /etc/glance/glance-registry.conf \ + DEFAULT sql_connection mysql://glance:GLANCE_PASS@controller/glance + Create a user called glance that the Image + Service can use to authenticate with the Identity Service. Use the + service tenant and give the user the + admin role. + # keystone user-create --name=glance --pass=GLANCE_PASS --email=glance@example.com +# keystone user-role-add --user=glance --tenant=service --role=admin + Add the credentials to the Image Service's configuration files. + # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller +# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service # openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password GLANCE_PASS -# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller -# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user keystone +# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller +# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance # openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service # openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password GLANCE_PASS - - You also have to add the credentials to the files + + + If you have troubles connecting to the database, try using the IP address instead of the + host name in the credentials. + + 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 keystone command. + # keystone service-create --name=glance --type=image \ + --description="Glance Image Service" + Note the service's id property returned in the previous step and use it when + creating the endpoint. + # keystone endpoint-create \ --service-id=the_service_id_above \ - --publicurl=http://controller:9292 \ - --internalurl=http://controller:9292 \ - --adminurl=http://controller:9292 - - Finally, start the glance-api and - glance-registry services and configure them to - start when the system boots. - - # service glance-api start + --publicurl=http://controller:9292 \ + --internalurl=http://controller:9292 \ + --adminurl=http://controller:9292 + Start the glance-api and + glance-registry services and configure them to + start when the system boots. + # service glance-api start # service glance-registry start # chkconfig glance-api on # chkconfig glance-registry on - # service openstack-glance-api start + # service openstack-glance-api start # service openstack-glance-registry start # chkconfig openstack-glance-api on # chkconfig openstack-glance-registry on - # systemctl start openstack-glance-api.service + # systemctl start openstack-glance-api.service # systemctl start openstack-glance-registry.service # systemctl enable openstack-glance-api.service -# systemctl enable openstack-glance-registry.service - +# systemctl enable openstack-glance-registry.service + diff --git a/doc/install-guide/section_glance-verify.xml b/doc/install-guide/section_glance-verify.xml index cf0ea9cfc1..69ee9605d1 100644 --- a/doc/install-guide/section_glance-verify.xml +++ b/doc/install-guide/section_glance-verify.xml @@ -4,29 +4,96 @@ xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> Verifying the Image Service Installation - To test the Image Service installation, download some virtual machine - images that are known to work with OpenStack. CirrOS is a small test image - that is often used for testing OpenStack deployments. You can find the most - recent CirrOS image on their download page. As of - this writing the most recent image is version 0.3.1. A 64-bit version in - QCOW2 format (compatible with KVM or QEMU hypervisors) can be downloaded - from there. - The 64-bit CirrOS QCOW2 image is the image we'll use for this - walkthrough. More detailed information about how to obtain and create - images can be found in the OpenStack Compute Administration - Guide in the "Image Management" chapter. - - The download is done in a dedicated directory: - $ mkdir images + To test the Image Service installation, download at least one virtual machine image that + is known to work with OpenStack. For example, CirrOS is a small test image that is often + used for testing OpenStack deployments (CirrOS downloads). The 64-bit CirrOS QCOW2 image is the image we'll use for this + walkthrough. + For more information about: + + + + Downloading and building images, refer to the OpenStack Virtual Machine Image Guide. + + + + How to manage images, refer to the "Image Management" chapter in the OpenStack User + Guide. + + + + + Upload and View an Image in the Image Service + Download the image into a dedicated directory: + $ mkdir images $ cd images/ -$ curl -O http://cdn.download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img - You can now use the glance image-create command to - upload the image to the Image Service, passing the image file through - standard input: - - # glance image-create --name="CirrOS 0.3.1" --disk-format=qcow2 \ +$ curl -O http://cdn.download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img + Use the glance image-create command to upload the image to the Image + Service, as follows: + # glance image-create --name=imageLabel --disk-format=fileFormat \ + --container-format=containerFormat --is-public=accessValue < imageFile + Where: + + imageLabel + + Arbitrary label. This is the name by which users will refer to the image. + + + + fileFormat + + Specifies the format of the image file. Valid formats include + qcow2, raw, + vhd, vmdk, + vdi, iso, + aki, ari, and + ami. + You can verify the format using the file + command: + $ file cirros-0.3.1-x86_64-disk.img +cirros-0.3.1-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes + + + + containerFormat + + Specifies the container format. Valid formats include: + bare, ovf, + aki, ari and + ami. + Specify bare to indicate that the image file is + not in a file format that contains metadata about the virtual + machine. Although this field is currently required, it is not + actually used by any of the OpenStack services and has no effect on + system behavior. Because the value is not used anywhere, it safe to + always specify bare as the container + format. + + + + accessValue + + Specifies image access: + + true - All users will be able to view + and use the image. + false - Only administrators will be + able to view and use the image. + + + + + imageFile + + Specifies the name of your downloaded image file. + + + + For example: + # glance image-create --name="CirrOS 0.3.1" --disk-format=qcow2 \ --container-format=bare --is-public=true < cirros-0.3.1-x86_64-disk.img +------------------+--------------------------------------+ | Property | Value | @@ -48,62 +115,18 @@ | status | active | | updated_at | 2013-05-08T18:59:18 | +------------------+--------------------------------------+ - - - - The returned image ID is generated dynamically, and therefore - will be different on your deployment than in this example. - - - The rationale for the arguments is: - - - name="CirrOS 0.3.1" - - The name field is an arbitrary label. In this example - the name encodes the distribution and version: - CirrOS 0.3.1. - - - - disk-format=qcow2 - - The disk-format field specifies the format of the image - file. In this case, the image file format is QCOW2, which can be verified - using the file command: - $ file cirros-0.3.1-x86_64-disk.img -cirros-0.3.1-x86_64-disk.img: QEMU QCOW Image (v2), 41126400 bytes - - Other valid formats are raw, vhd, - vmdk, vdi, iso, - aki, ari and - ami. - - - - container-format=bare - - The container-format field is required by the - glance image-create command but isn't actually used by any of - the OpenStack services, so the value specified here has no effect on system - behavior. We specify bare to indicate that the image file - is not in a file format that contains metadata about the virtual - machine. - Because the value is not used anywhere, it safe to always specify - bare as the container format, although the command - will accept other formats: ovf, aki, - ari and ami. - - - - - - Now a glance image-list should show the image attributes: - # glance image-list + + The returned image ID is generated dynamically, and therefore + will be different on your deployment than in this example. + + + Use the glance image-list command to confirm + that the image has been uploaded and to display its attributes: + # glance image-list +--------------------------------------+-----------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+-----------------+-------------+------------------+----------+--------+ | acafc7c0-40aa-4026-9673-b879898e1fc2 | CirrOS 0.3.1 | qcow2 | bare | 13147648 | active | -+--------------------------------------+-----------------+-------------+------------------+----------+--------+ - ++--------------------------------------+-----------------+-------------+------------------+----------+--------+ +