Merge "Included instance migration using snapshots"

This commit is contained in:
Jenkins 2014-02-21 19:32:12 +00:00 committed by Gerrit Code Review
commit 73f8c46015
2 changed files with 141 additions and 0 deletions

View File

@ -27,6 +27,8 @@
<?hard-pagebreak?> <?hard-pagebreak?>
<xi:include href="../common/section_cli_nova_userdata.xml"/> <xi:include href="../common/section_cli_nova_userdata.xml"/>
<?hard-pagebreak?> <?hard-pagebreak?>
<xi:include href="section_cli_nova_migrate_instances.xml"/>
<?hard-pagebreak?>
<xi:include href="section_cli_nova_config-drive.xml"/> <xi:include href="section_cli_nova_config-drive.xml"/>
<?hard-pagebreak?> <?hard-pagebreak?>
<xi:include <xi:include

View File

@ -0,0 +1,139 @@
<?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_migrate_instances">
<?dbhtml stop-chunking?>
<title>Use snapshots to migrate instance</title>
<note>
<para>Some cloud providers allow only administrators to
perform these steps.</para>
</note>
<para>To use snapshots to migrate instances from OpenStack
projects to clouds, complete these steps:</para>
<orderedlist>
<listitem>
<para>Create a snapshot of the instance.</para>
</listitem>
<listitem>
<para>Download the snapshot as an image.</para>
</listitem>
<listitem>
<para>Import the snapshot to the new environment.</para>
</listitem>
<listitem>
<para>Boot a new instance from the snapshot.</para>
</listitem>
</orderedlist>
<note>
<para>Perform the <xref linkend="create_snapshot"/> and <xref
linkend="download_snapshot"/> procedures in the source
project.</para>
<para>Perform the <xref linkend="import_snapshot"/> and <xref
linkend="boot_from_snapshot"/> in the destination
project.</para>
</note>
<section xml:id="create_snapshot">
<title>Create a snapshot of the instance</title>
<procedure>
<step>
<para>Always shut down the source VM before you take the
snapshot to make sure that all data is flushed to
disk.</para>
<screen><prompt>$</prompt> <userinput>nova list</userinput>
<computeroutput>+--------------------------------------+------------+--------+------------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+------------+--------+------------------------------+
| c41f3074-c82a-4837-8673-fa7e9fea7e11 | example | ACTIVE | private=10.0.0.3 |
+--------------------------------------+------------+--------+------------------------------+</computeroutput></screen>
<screen><prompt>$</prompt> <userinput>nova stop example</userinput></screen>
</step>
<step>
<para>Confirm that the instance shows a <literal>SHUTOFF</literal>
status.</para>
<screen><prompt>$</prompt> <userinput>nova list</userinput>
<computeroutput>+--------------------------------------+------------+---------+------------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+------------+---------+------------------------------+
| c41f3074-c82a-4837-8673-fa7e9fea7e11 | example | SHUTOFF | private=10.0.0.3 |
+--------------------------------------+------------+---------+------------------------------+</computeroutput></screen>
<para/>
</step>
<step>
<para>Use the <command>nova
image-create</command> command to take a snapshot. Use the <command>nova
image-list</command> command to check the status until the status
is <literal>ACTIVE</literal>:</para>
<screen><prompt>$</prompt> <userinput>nova list</userinput>
<computeroutput>+--------------------------------------+------------+---------+------------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+------------+---------+------------------------------+
| c41f3074-c82a-4837-8673-fa7e9fea7e11 | example | SHUTOFF | private=10.0.0.3 |
+--------------------------------------+------------+---------+------------------------------+</computeroutput></screen>
<screen><prompt>$</prompt> <userinput>nova image-create --poll <replaceable>example</replaceable> <replaceable>examplesnapshot</replaceable></userinput>
<computeroutput>Instance snapshotting... 50% complete</computeroutput></screen>
<screen><prompt>$</prompt> <userinput>nova image-list</userinput>
<computeroutput>+--------------------------------------+---------------------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| 657ebb01-6fae-47dc-986a-e49c4dd8c433 | cirros-0.3.1-x86_64-uec | ACTIVE | |
| 72074c6d-bf52-4a56-a61c-02a17bf3819b | cirros-0.3.1-x86_64-uec-kernel | ACTIVE | |
| 3c5e5f06-637b-413e-90f6-ca7ed015ec9e | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE | |
| f30b204e-1ce6-40e7-b8d9-b353d4d84e7d | examplesnapshot | ACTIVE | |
+--------------------------------------+---------------------------------+--------+--------+</computeroutput></screen>
</step>
</procedure>
</section>
<section xml:id="download_snapshot">
<title>Download the snapshot as an image</title>
<procedure>
<step>
<para>Get the image ID:</para>
<screen><prompt>$</prompt> <userinput>nova image-list</userinput>
<computeroutput>+--------------------------------------+------------------+--------+--------------------------------------+
| ID | Name | Status | Server |
+--------------------------------------+------------------+--------+--------------------------------------+
| f30b204e-1ce6-40e7-b8d9-b353d4d84e7d | examplesnapshot | ACTIVE | c41f3074-c82a-4837-8673-fa7e9fea7e11 |
+--------------------------------------+------------------+--------+--------------------------------------+</computeroutput></screen>
</step>
<step>
<para>Download the snapshot by using the image ID that
was returned in the previous step:</para>
<screen><prompt>$</prompt> <userinput>glance image-download --file <replaceable>snapshot.raw</replaceable> <replaceable>f30b204e-1ce6-40e7-b8d9-b353d4d84e7d</replaceable></userinput> </screen>
<note>
<para>The <command>glance image-download</command>
command requires the image ID and cannot use
the image name.</para>
<para>Ensure there is sufficient space on the
destination file system for the image
file.</para>
</note>
</step>
<step>
<para>Make the image available to the new environment,
either through http or with direct upload to a
machine (<command>scp</command>).</para>
</step>
</procedure>
</section>
<section xml:id="import_snapshot">
<title>Import the snapshot to new environment</title>
<procedure>
<step>
<para>In the new project or cloud environment, import
the snapshot:</para>
<screen><prompt>$</prompt> <userinput>glance image-create --copy-from <replaceable>IMAGE_URL</replaceable></userinput> </screen>
</step>
</procedure>
</section>
<section xml:id="boot_from_snapshot">
<title>Boot a new instance from the snapshot</title>
<procedure>
<step>
<para>In the new project or cloud environment, use the
snapshot to create the new instance:</para>
<screen><prompt>$</prompt> <userinput>nova boot --flavor m1.tiny --image <replaceable>EXAMPLE_SNAPSHOT</replaceable> <replaceable>NEW_INSTANCE</replaceable></userinput></screen>
</step>
</procedure>
</section>
</section>