openstack-manuals/doc/common/section_glance_cli_manage_images.xml
Summer Long ccc11916b6 Flattened chapter structure.
Added basic Manage Services chapter, and placed Identity and Compute sections inside. Redid Compute section header to match. Removed installation instructions (user should already have installed).

Change-Id: Iffb15804ea7c3b6e6ebed526fdd17c4e125184a8
2013-10-16 14:30:56 -05:00

358 lines
20 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="cli_manage_images">
<?dbhtml stop-chunking?>
<title>Manage images</title>
<para>The cloud operator assigns roles to users. Roles determine
who can upload and manage images. The operator might restrict
image upload and management to only cloud administrators or
operators.</para>
<para>You can upload images through the glance client or the Image
Service API. You can also use the nova client to list images,
set and delete image metadata, delete images, and take a
snapshot of a running instance to create an image. After you
upload an image, you cannot change it.</para>
<para>For details about image creation, see the <link
xlink:href="http://docs.openstack.org/image-guide/content/"
><citetitle>Virtual Machine Image
Guide</citetitle></link>.</para>
<section xml:id="glance-image-list">
<title>List or get details for images (glance)</title>
<procedure>
<step>
<para>To list the available images:</para>
<screen><prompt>$</prompt> <userinput>glance image-list</userinput>
<computeroutput>+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| 397e713c-b95b-4186-ad46-6126863ea0a9 | cirros-0.3.1-x86_64-uec | ami | ami | 25165824 | active |
| df430cc2-3406-4061-b635-a51c16e488ac | cirros-0.3.1-x86_64-uec-kernel | aki | aki | 4955792 | active |
| 3cf852bd-2332-48f4-9ae4-7d926d50945e | cirros-0.3.1-x86_64-uec-ramdisk | ari | ari | 3714968 | active |
| 7e5142af-1253-4634-bcc6-89482c5f2e8a | myCirrosImage | ami | ami | 14221312 | active |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+</computeroutput></screen>
<para>You can use grep to filter the list, as
follows:</para>
<screen><prompt>$</prompt> <userinput>glance image-list | grep 'cirros'</userinput>
<computeroutput>| 397e713c-b95b-4186-ad46-6126863ea0a9 | cirros-0.3.1-x86_64-uec | ami | ami | 25165824 | active |
| df430cc2-3406-4061-b635-a51c16e488ac | cirros-0.3.1-x86_64-uec-kernel | aki | aki | 4955792 | active |
| 3cf852bd-2332-48f4-9ae4-7d926d50945e | cirros-0.3.1-x86_64-uec-ramdisk | ari | ari | 3714968 | active |</computeroutput></screen>
</step>
<step>
<para>To get image details, by name or ID:</para>
<screen><prompt>$</prompt> <userinput>glance image-show myCirrosImage</userinput>
<?db-font-size 45%?><computeroutput>+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| Property 'base_image_ref' | 397e713c-b95b-4186-ad46-6126863ea0a9 |
| Property 'image_location' | snapshot |
| Property 'image_state' | available |
| Property 'image_type' | snapshot |
| Property 'instance_type_ephemeral_gb' | 0 |
| Property 'instance_type_flavorid' | 2 |
| Property 'instance_type_id' | 5 |
| Property 'instance_type_memory_mb' | 2048 |
| Property 'instance_type_name' | m1.small |
| Property 'instance_type_root_gb' | 20 |
| Property 'instance_type_rxtx_factor' | 1 |
| Property 'instance_type_swap' | 0 |
| Property 'instance_type_vcpu_weight' | None |
| Property 'instance_type_vcpus' | 1 |
| Property 'instance_uuid' | 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 |
| Property 'kernel_id' | df430cc2-3406-4061-b635-a51c16e488ac |
| Property 'owner_id' | 66265572db174a7aa66eba661f58eb9e |
| Property 'ramdisk_id' | 3cf852bd-2332-48f4-9ae4-7d926d50945e |
| Property 'user_id' | 376744b5910b4b4da7d8e6cb483b06a8 |
| checksum | 8e4838effa1969ad591655d6485c7ba8 |
| container_format | ami |
| created_at | 2013-07-22T19:45:58 |
| deleted | False |
| disk_format | ami |
| id | 7e5142af-1253-4634-bcc6-89482c5f2e8a |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | myCirrosImage |
| owner | 66265572db174a7aa66eba661f58eb9e |
| protected | False |
| size | 14221312 |
| status | active |
| updated_at | 2013-07-22T19:46:42 |
+---------------------------------------+--------------------------------------+</computeroutput></screen>
<note><para>To store location metadata for images, which enables direct file
access for a client, update the
<filename>/etc/glance/glance.conf</filename>
file with the following statements:</para>
<para>
<itemizedlist>
<listitem>
<para><code>show_multiple_locations = True</code></para>
</listitem>
<listitem>
<para><code>filesystem_store_metadata_file
=
<replaceable>filePath</replaceable></code>,
where
<replaceable>filePath</replaceable>
points to a JSON file that defines
the mount point for OpenStack
images on your system and a unique
ID. For example:
<programlisting language="json">[{
"id": "b9d69795-5951-4cb0-bb5c-29491e1e2daf",
"mountpoint": "/var/lib/glance/images/"
}]</programlisting></para>
</listitem>
</itemizedlist>
</para>
<para>After you restart the Image Service, you can use the following syntax to view the image's location information:</para>
<screen><prompt>$</prompt> <userinput>glance --os-image-api-version=2 image-show <replaceable>imageID</replaceable></userinput></screen>
<para>For example:</para>
<screen><prompt>$</prompt> <userinput>glance --os-image-api-version=2 image-show 2d9bb53f-70ea-4066-a68b-67960eaae673</userinput></screen></note>
</step>
</procedure>
</section>
<section xml:id="glance_add_image">
<title>Create or update an image (glance)</title>
<procedure>
<step>
<para>To upload a CentOS 6.3 image in qcow2 format and
configure it for public access:</para>
<screen><prompt>$</prompt> <userinput>glance image-create --name centos63-image --disk-format=qcow2 \
--container-format=bare --is-public=True --file=./centos63.qcow2</userinput></screen>
</step>
<step>
<para>To update an image by name or ID:</para>
<para><screen><prompt>$</prompt> <userinput>glance image-update <replaceable>IMAGE</replaceable></userinput></screen></para>
<para>To modify image properties, use the following
optional arguments:</para>
<informaltable>
<col width="40%"/>
<col width="60%"/>
<tr>
<td><para><parameter>--name
<replaceable>NAME</replaceable></parameter></para></td>
<td><para>The name of the image.</para>
</td>
</tr>
<tr>
<td><para><parameter>--disk-format
<replaceable>DISK_FORMAT</replaceable></parameter></para></td>
<td><para>The disk format of the image.
Acceptable formats are ami, ari, aki,
vhd, vmdk, raw, qcow2, vdi, and
iso.</para>
</td>
</tr>
<tr>
<td><para><parameter>--container-format
<replaceable>CONTAINER_FORMAT</replaceable></parameter></para></td>
<td><para>The container format of the image.
Acceptable formats are ami, ari, aki,
bare, and ovf.</para>
</td>
</tr>
<tr>
<td><para><parameter>--owner
<replaceable>TENANT_ID</replaceable></parameter></para></td>
<td><para>The tenant who should own the
image.</para>
</td>
</tr>
<tr>
<td><para><parameter>--size
<replaceable>SIZE</replaceable></parameter></para></td>
<td><para>The size of image data, in
bytes.</para>
</td>
</tr>
<tr>
<td><para><parameter>--min-disk
<replaceable>DISK_GB</replaceable></parameter></para></td>
<td><para>The minimum size of disk needed to
boot image, in gigabytes.</para>
</td>
</tr>
<tr>
<td><para><parameter>--min-ram
<replaceable>DISK_RAM</replaceable></parameter></para></td>
<td><para>The minimum amount of ram needed to
boot image, in megabytes.</para>
</td>
</tr>
<tr>
<td><para><parameter>--location
<replaceable>IMAGE_URL</replaceable></parameter></para></td>
<td><para>The URL where the data for this
image resides. For example, if the
image data is stored in swift, you
could specify
<literal>swift://account:key@example.com/container/obj</literal>.</para>
</td>
</tr>
<tr>
<td><para><parameter>--file
<replaceable>FILE</replaceable></parameter></para></td>
<td><para>Local file that contains disk image
to be uploaded during update.
Alternatively, you can pass images to
the client through stdin.</para>
</td>
</tr>
<tr>
<td><para><parameter>--checksum
<replaceable>CHECKSUM</replaceable></parameter></para></td>
<td><para>Hash of image data to use for
verification.</para>
</td>
</tr>
<tr>
<td><para><parameter>--copy-from
<replaceable>IMAGE_URL</replaceable></parameter></para></td>
<td><para>Similar to
<parameter>--location</parameter>
in usage, but indicates that the
Glance server should immediately copy
the data and store it in its
configured image store.</para>
</td>
</tr>
<tr>
<td><para><parameter>--is-public
[True|False]</parameter></para></td>
<td><para>Makes an image accessible to the
public.</para>
</td>
</tr>
<tr>
<td><para><parameter>--is-protected
[True|False]</parameter></para></td>
<td><para>Prevents an image from being
deleted.</para>
</td>
</tr>
<tr>
<td><para><parameter>--property
<replaceable>KEY</replaceable>=<replaceable>VALUE</replaceable></parameter></para></td>
<td><para>Arbitrary property to associate with
image. Can be used multiple
times.</para>
</td>
</tr>
<tr>
<td><para><parameter>--purge-props</parameter></para></td>
<td><para>Deletes all image properties that
are not explicitly set in the update
request. Otherwise, those properties
not referenced are preserved.</para>
</td>
</tr>
<tr>
<td><para><parameter>--human-readable</parameter></para></td>
<td><para>Prints image size in a
human-friendly format.</para>
</td>
</tr>
</informaltable>
</step>
<step>
<para>To annotate an image with a property that
describes the required VIF model:</para>
<screen><prompt>$</prompt> <userinput>glance image-update \
--property hw_vif_model=e1000 f16-x86_64-openstack-sda</userinput></screen>
<para>If you specify a VIF model that is not
supported, the instance fails to launch. See <xref
linkend="vif_models"/>.</para>
</step>
</procedure>
<?hard-pagebreak?>
<para>The valid model values depend on the
<literal>libvirt_type</literal> setting, as shown in
the following table:</para>
<table xml:id="vif_models" rules="all" width="50%">
<caption>VIF model values</caption>
<col width="40%"/>
<col width="60%"/>
<thead>
<tr>
<th>libvirt_type setting</th>
<th>Supported model values</th>
</tr>
</thead>
<tbody>
<tr>
<td>qemu or kvm</td>
<td>
<para>
<itemizedlist>
<listitem>
<para>virtio</para>
</listitem>
<listitem>
<para>ne2k_pci</para>
</listitem>
<listitem>
<para>pcnet</para>
</listitem>
<listitem>
<para>rtl8139</para>
</listitem>
<listitem>
<para>e1000</para>
</listitem>
</itemizedlist>
</para>
</td>
</tr>
<tr>
<td>xen</td>
<td>
<itemizedlist>
<listitem>
<para>netfront</para>
</listitem>
<listitem>
<para>ne2k_pci</para>
</listitem>
<listitem>
<para>pcnet</para>
</listitem>
<listitem>
<para>rtl8139</para>
</listitem>
<listitem>
<para>e1000</para>
</listitem>
</itemizedlist>
</td>
</tr>
</tbody>
</table>
</section>
<xi:include href="section_nova_cli_manage_images.xml"/>
<section xml:id="troubleshoot">
<title>Troubleshoot image creation</title>
<itemizedlist>
<listitem>
<para>You cannot create a snapshot from an instance
that has an attached volume. Detach the volume,
create the image, and re-mount the volume.</para>
</listitem>
<listitem>
<para>Make sure the version of qemu you are using is
version 0.14 or greater. Older versions of qemu
result in an "<literal>unknown option
-s</literal>" error message in the
<filename>nova-compute.log</filename>.</para>
</listitem>
<listitem>
<para>Examine the
<filename>/var/log/nova-api.log</filename> and
<filename>/var/log/nova-compute.log</filename>
log files for error messages.</para>
</listitem>
</itemizedlist>
</section>
</section>