openstack-manuals/doc/common/section_cli_nova_boot_from_volume.xml
Stephen Gordon 5ae35e9cd7 Remove image requirement for boot from volume
Section previously implied an image had to be specified
when booting from volume. This was true previously but
has since been corrected and thus it is not necessary
to specify an image to successfully boot from a volume.

Change-Id: I85d61726f00ece33e453ad739c4955b5f8082353
Closes-Bug: #1269767
2014-01-19 17:38:51 -05:00

198 lines
11 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="boot_from_volume">
<title>Launch an instance from a volume</title>
<para>After you create a bootable volume, you can launch an instance
from that volume.</para>
<para>Optionally, to configure your volume, see the <link
xlink:href="http://docs.openstack.org/trunk/config-reference/content/config_overview.html"
><citetitle>OpenStack Configuration
Reference</citetitle></link>.</para>
<procedure xml:id="create_volume_from_image">
<step>
<para>For a list of images to choose from to create a bootable
volume, run this command:</para>
<screen><prompt>$</prompt> <userinput>nova image-list</userinput>
<computeroutput>+--------------------------------------+---------------------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| e0b7734d-2331-42a3-b19e-067adc0da17d | cirros-0.3.1-x86_64-uec | ACTIVE | |
| 75bf193b-237b-435e-8712-896c51484de9 | cirros-0.3.1-x86_64-uec-kernel | ACTIVE | |
| 19eee81c-f972-44e1-a952-1dceee148c47 | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE | |
+--------------------------------------+---------------------------------+--------+--------+</computeroutput></screen>
</step>
<step>
<para>To create a bootable volume from an image, include the
image ID in the command:</para>
<screen><prompt>#</prompt> <userinput>cinder create --image-id e0b7734d-2331-42a3-b19e-067adc0da17d --display-name my-boot-vol 8</userinput>
<computeroutput>+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2013-10-16T01:27:48.645390 |
| display_description | None |
| display_name | my-boot-vol |
| id | 3195a5a7-fd0d-4ac3-b919-7ba6cbe11d46 |
| image_id | e0b7734d-2331-42a3-b19e-067adc0da17d |
| metadata | {} |
| size | 8 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | None |
+---------------------+--------------------------------------+</computeroutput></screen>
<para>Before the volume builds, its <literal>bootable</literal>
state is <literal>false</literal>.</para>
</step>
<step>
<para>To list volumes, run the following command:</para>
<screen><prompt>$</prompt> <userinput>cinder list</userinput>
<computeroutput>+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
| 3195a5a7-fd0d-4ac3-b919-7ba6cbe11d46 | available | my-boot-vol | 8 | None | true | |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+</computeroutput></screen>
<para>Note that the <literal>bootable</literal> state is now
<literal>true</literal>. Copy the value in the
<literal>ID</literal> field for your volume.</para>
</step>
<step xml:id="launch_image_from_volume">
<para>To launch an instance, include the
<parameter>--block_device_mapping</parameter>
parameter:</para>
<screen><prompt>$</prompt> <userinput>nova boot --flavor <replaceable>FLAVOR</replaceable> --block_device_mapping <replaceable>DEVNAME</replaceable>=<replaceable>ID</replaceable>:<replaceable>TYPE</replaceable>:<replaceable>SIZE</replaceable>:<replaceable>DELETE_ON_TERMINATE</replaceable> <replaceable>NAME</replaceable></userinput></screen>
<para>The command arguments are:</para>
<informaltable>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<para><parameter>--flavor</parameter>
<replaceable>FLAVOR</replaceable></para>
</td>
<td>
<para>The flavor ID.</para>
</td>
</tr>
<tr>
<td>
<para><parameter>--block_device_mapping</parameter>
<replaceable>DEVNAME</replaceable>=<replaceable>ID</replaceable>:<replaceable>type</replaceable>:<replaceable>size</replaceable>:<replaceable>delete-on-terminate</replaceable></para>
</td>
<td>
<itemizedlist>
<listitem>
<para><replaceable>DEVNAME</replaceable>. A device
name where the volume is attached in the system at
<filename>/dev/<replaceable>dev_name</replaceable></filename>.
This value is typically
<literal>vda</literal>.</para>
</listitem>
<listitem>
<para><replaceable>ID</replaceable>. The ID of the
volume to boot from, as shown in the output of
<command>nova volume-list</command>.</para>
</listitem>
<listitem>
<para><replaceable>type</replaceable>. Either
<literal>snap</literal> or any other value,
including a blank string. <literal>snap</literal>
means that the volume was created from a
snapshot.</para>
</listitem>
<listitem>
<para><replaceable>size</replaceable>. The size of
the volume, in GBs. It is safe to leave this blank
and have the Compute service infer the
size.</para>
</listitem>
<listitem>
<para><replaceable>delete-on-terminate</replaceable>.
Boolean. Indicates whether the volume is deleted
when the instance is deleted. You can
specify:</para>
<itemizedlist>
<listitem>
<para><literal>True</literal> or
<literal>1</literal>
</para>
</listitem>
<listitem>
<para><literal>False</literal> or
<literal>0</literal></para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</td>
</tr>
<tr>
<td>
<para><replaceable>NAME</replaceable></para>
</td>
<td>
<para>The name for the server.</para>
</td>
</tr>
</tbody>
</informaltable>
<para>You can also attach a swap disk on boot with the
<parameter>--swap</parameter> flag, or you can attach an
ephemeral disk on boot with the
<parameter>--ephemeral</parameter> flag.</para>
<para>For example, you might enter the following command to boot
from a volume. The volume is not deleted when the instance is
terminated:</para>
<screen><prompt>$</prompt> <userinput>nova boot --flavor 2 \
--block_device_mapping vda=3195a5a7-fd0d-4ac3-b919-7ba6cbe11d46:::0 myInstanceFromVolume</userinput>
<computeroutput>+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| OS-EXT-STS:task_state | scheduling |
| image | |
| OS-EXT-STS:vm_state | building |
| OS-EXT-SRV-ATTR:instance_name | instance-00000003 |
| flavor | m1.small |
| id | 8ed8b0f9-70de-4662-a16c-0b51ce7b17b4 |
| security_groups | [{u'name': u'default'}] |
| user_id | 352b37f5c89144d4ad0534139266d51f |
| 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-10-16T01:43:26Z |
| hostId | |
| OS-EXT-SRV-ATTR:host | None |
| key_name | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| name | myInstanceFromVolume |
| adminPass | BULD33uzYwhq |
| tenant_id | f7ac731cc11f40efbc03a9f9e1d1d21f |
| created | 2013-10-16T01:43:25Z |
| metadata | {} |
+-------------------------------------+--------------------------------------+</computeroutput></screen>
<para>Now when you list volumes, the volume is attached to a
server:</para>
<screen><prompt>$</prompt> <userinput>nova volume-list</userinput>
<computeroutput>+--------------------------------------+-----------+-----------------+------+-------------+--------------------------------------+
| ID | Status | Display Name | Size | Volume Type | Attached to |
+--------------------------------------+-----------+-----------------+------+-------------+--------------------------------------+
| 3195a5a7-fd0d-4ac3-b919-7ba6cbe11d46 | in-use | my-boot-vol | 8 | None | 8ed8b0f9-70de-4662-a16c-0b51ce7b17b4 |
+--------------------------------------+-----------+-----------------+------+-------------+--------------------------------------+</computeroutput></screen>
</step>
</procedure>
</section>