openstack-manuals/doc/common/section_cli_nova_images.xml
Christian Berendt 179e89b8e5 Fix broken links
Change-Id: Id13c9f0741e567a1b421e29d1fb1b0f304a3ddfe
2014-07-25 22:17:16 +02:00

149 lines
9.4 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="nova_manage_images">
<title>Manage images with the nova client</title>
<para>You can 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.</para>
<para>The safest approach is to shut down the instance before you
take a snapshot.</para>
<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>
<procedure>
<title>To create an image</title>
<step>
<para>Write any buffered data to disk.</para>
<para>For more information, see the <link
xlink:href="http://docs.openstack.org/openstack-ops/content/snapshots.html"
>Taking Snapshots</link> in the
<citetitle>OpenStack Operations Guide</citetitle>.
</para>
</step>
<step>
<para>To create the image, list instances to get the
server ID:</para>
<screen><prompt>$</prompt> <userinput>nova list</userinput></screen>
<screen><computeroutput>+--------------------------------------+----------------------+--------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
| 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 | myCirrosServer | ACTIVE | None | Running | private=10.0.0.3 |
+--------------------------------------+----------------------+--------+------------+-------------+------------------+</computeroutput></screen>
<para>In this example, the server is named
<literal>myCirrosServer</literal>. Use this server
to create a snapshot, as follows:
<screen><prompt>$</prompt> <userinput>nova image-create myCirrosServer myCirrosImage</userinput></screen>The
command creates a qemu snapshot and automatically
uploads the image to your repository. Only the tenant
that creates the image has access to it.</para>
</step>
<step>
<para>Get details for your image to check its
status:</para>
<screen><prompt>$</prompt> <userinput>nova image-show <replaceable>IMAGE</replaceable></userinput></screen>
<screen><computeroutput>+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| metadata owner_id | 66265572db174a7aa66eba661f58eb9e |
| minDisk | 0 |
| metadata instance_type_name | m1.small |
| metadata instance_type_id | 5 |
| metadata instance_type_memory_mb | 2048 |
| id | 7e5142af-1253-4634-bcc6-89482c5f2e8a |
| metadata instance_type_root_gb | 20 |
| metadata instance_type_rxtx_factor | 1 |
| metadata ramdisk_id | 3cf852bd-2332-48f4-9ae4-7d926d50945e |
| metadata image_state | available |
| metadata image_location | snapshot |
| minRam | 0 |
| metadata instance_type_vcpus | 1 |
| status | ACTIVE |
| updated | 2013-07-22T19:46:42Z |
| metadata instance_type_swap | 0 |
| metadata instance_type_vcpu_weight | None |
| metadata base_image_ref | 397e713c-b95b-4186-ad46-6126863ea0a9 |
| progress | 100 |
| metadata instance_type_flavorid | 2 |
| OS-EXT-IMG-SIZE:size | 14221312 |
| metadata image_type | snapshot |
| metadata user_id | 376744b5910b4b4da7d8e6cb483b06a8 |
| name | myCirrosImage |
| created | 2013-07-22T19:45:58Z |
| metadata instance_uuid | 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 |
| server | 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 |
| metadata kernel_id | df430cc2-3406-4061-b635-a51c16e488ac |
| metadata instance_type_ephemeral_gb | 0 |
+-------------------------------------+--------------------------------------+</computeroutput></screen>
<para>The image status changes from
<literal>SAVING</literal> to
<literal>ACTIVE</literal>. Only the tenant who
creates the image has access to it.</para>
</step>
</procedure>
<procedure>
<title>To launch an instance from your image</title>
<step>
<para>To launch an instance from your image, include the
image ID and flavor ID, as follows:</para>
<screen><prompt>$</prompt> <userinput>nova boot newServer --image 7e5142af-1253-4634-bcc6-89482c5f2e8a --flavor 3</userinput></screen>
<screen><computeroutput>+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| OS-EXT-STS:task_state | scheduling |
| image | myCirrosImage |
| OS-EXT-STS:vm_state | building |
| OS-EXT-SRV-ATTR:instance_name | instance-00000007 |
| flavor | m1.medium |
| id | d7efd3e4-d375-46d1-9d57-372b6e4bdb7f |
| security_groups | [{u'name': u'default'}] |
| user_id | 376744b5910b4b4da7d8e6cb483b06a8 |
| OS-DCF:diskConfig | MANUAL |
| accessIPv4 | |
| accessIPv6 | |
| progress | 0 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-AZ:availability_zone | nova |
| config_drive | |
| status | BUILD |
| updated | 2013-07-22T19:58:33Z |
| hostId | |
| OS-EXT-SRV-ATTR:host | None |
| key_name | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| name | newServer |
| adminPass | jis88nN46RGP |
| tenant_id | 66265572db174a7aa66eba661f58eb9e |
| created | 2013-07-22T19:58:33Z |
| metadata | {} |
+-------------------------------------+--------------------------------------+</computeroutput></screen>
</step>
</procedure>
<simplesect 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>
</simplesect>
</section>