bbec5aa4d2
The XML root element of Docbook XML files should match the following format: <ELEMENT 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="THE_XML_ID_OF_THE_ELEMENT"> Change-Id: If8d27898af12af2edc2d2d13557ec2365a241656
76 lines
3.1 KiB
XML
76 lines
3.1 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_cli_migrate_single">
|
|
<title>Migrate single instance to another compute host</title>
|
|
<para>When you want to move an instance from one compute host to another,
|
|
you can use the <command>nova migrate</command> command. The scheduler
|
|
chooses the destination compute host based on its settings. This process
|
|
does not assume that the instance has shared storage available on the
|
|
target host.</para>
|
|
<procedure xml:id="migrate_single">
|
|
<step>
|
|
<para>To list the VMs you want to migrate, run:</para>
|
|
<screen><prompt>$</prompt> <userinput>nova list</userinput></screen>
|
|
</step>
|
|
<step>
|
|
<para>After selecting a VM from the list, run this command where
|
|
<replaceable>VM_ID</replaceable> is set to the ID in the list
|
|
returned in the previous step:</para>
|
|
<screen><prompt>$</prompt> <userinput>nova show <replaceable>VM_ID</replaceable></userinput></screen>
|
|
</step>
|
|
<step>
|
|
<para>Now, use the <command>nova migrate</command> command:</para>
|
|
<screen><prompt>$</prompt> <userinput>nova migrate <replaceable>VM_ID</replaceable></userinput></screen>
|
|
</step>
|
|
<step performance="optional">
|
|
<para>To migrate of an instance and watch the status, use this
|
|
example script:</para>
|
|
<programlisting language="bash">#!/bin/bash
|
|
|
|
# Provide usage
|
|
usage() {
|
|
echo "Usage: $0 VM_ID"
|
|
exit 1
|
|
}
|
|
|
|
[[ $# -eq 0 ]] && usage
|
|
|
|
# Migrate the VM to an alternate hypervisor
|
|
echo -n "Migrating instance to alternate host"
|
|
$VM_ID=$1
|
|
nova migrate $VM_ID
|
|
VM_OUTPUT=`nova show $VM_ID`
|
|
VM_STATUS=`echo "$VM_OUTPUT" | grep status | awk '{print $4}'`
|
|
while [[ "$VM_STATUS" != "VERIFY_RESIZE" ]]; do
|
|
echo -n "."
|
|
sleep 2
|
|
VM_OUTPUT=`nova show $VM_ID`
|
|
VM_STATUS=`echo "$VM_OUTPUT" | grep status | awk '{print $4}'`
|
|
done
|
|
nova resize-confirm $VM_ID
|
|
echo " instance migrated and resized."
|
|
echo;
|
|
|
|
# Show the details for the VM
|
|
echo "Updated instance details:"
|
|
nova show $VM_ID
|
|
|
|
# Pause to allow users to examine VM details
|
|
read -p "Pausing, press <enter> to exit."</programlisting>
|
|
<note>
|
|
<para>If you see this error, it means you are either trying the
|
|
command with the wrong credentials, such as a non-admin
|
|
user, or the <filename>policy.json</filename> file prevents
|
|
migration for your user.
|
|
<screen><computeroutput>ERROR (Forbidden): Policy doesn't allow compute_extension:admin_actions:migrate to be performed. (HTTP 403)</computeroutput></screen></para>
|
|
</note>
|
|
<para>The instance is booted from a new host, but preserves its
|
|
configuration including its ID, name, any metadata, IP address,
|
|
and other properties.</para>
|
|
</step>
|
|
</procedure>
|
|
</section>
|