From 0ae6e598984acf00489ae699f8513e817383b7ae Mon Sep 17 00:00:00 2001 From: Anne Gentle Date: Thu, 22 May 2014 19:33:12 -0500 Subject: [PATCH] Adds script for Admin User Guide migrating a VM to another host Change-Id: I83122fb3e0a1ea1083fe8df0baa7a55f1b432fea --- doc/user-guide-admin/roadmap.rst | 1 + .../section_cli_admin_manage_environment.xml | 3 +- .../section_cli_nova_host_servers_migrate.xml | 31 ++++++++ .../section_cli_nova_migrate.xml | 74 +++++++++++++++++++ 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 doc/user-guide-admin/section_cli_nova_host_servers_migrate.xml create mode 100644 doc/user-guide-admin/section_cli_nova_migrate.xml diff --git a/doc/user-guide-admin/roadmap.rst b/doc/user-guide-admin/roadmap.rst index 305d3dfccd..43859b12e1 100644 --- a/doc/user-guide-admin/roadmap.rst +++ b/doc/user-guide-admin/roadmap.rst @@ -18,5 +18,6 @@ including great descriptions of fields and why you set a setting Wishlist tasks: - Get examples of common tasks from real admins and add to this guide as how-to: migration of VM from one host to another, quota management, targeting launch on a particular compute node - Create flavor example - also refer to from Ops Guide (Anne Gentle todo) +- Migrations examples (Anne Gentle todo) - Create tenant example with CLI - Replace all individual client commands (like keystone, nova) with openstack client commands diff --git a/doc/user-guide-admin/section_cli_admin_manage_environment.xml b/doc/user-guide-admin/section_cli_admin_manage_environment.xml index 4851a1b910..b8a9b4c2d7 100644 --- a/doc/user-guide-admin/section_cli_admin_manage_environment.xml +++ b/doc/user-guide-admin/section_cli_admin_manage_environment.xml @@ -6,8 +6,9 @@ + - \ No newline at end of file + diff --git a/doc/user-guide-admin/section_cli_nova_host_servers_migrate.xml b/doc/user-guide-admin/section_cli_nova_host_servers_migrate.xml new file mode 100644 index 0000000000..1f48e27272 --- /dev/null +++ b/doc/user-guide-admin/section_cli_nova_host_servers_migrate.xml @@ -0,0 +1,31 @@ + +
+ Migrate all instances to another compute host + When you want to move all instances from one compute host to + another, you can use the nova + host-servers-migrate command. The difference + between this command and the nova evacuate + command is that you can specify the host when evacuating. Also + when evacuating, you must configure shared storage on the + target host so that user data is preserved on the server disk. + See Evacuate instances. + + + To list the host you want to migrate, run: + $ nova service-list + + + After selecting a host from the list, run this + command: + $ nova host-servers-migrate HOST_NAME + Where HOST_NAME is the + name of the host you want the servers to go to. + All instances are booted from a new host while preserving + their current configurations, including ID, name, UUID, IP + address, and so on. + + +
diff --git a/doc/user-guide-admin/section_cli_nova_migrate.xml b/doc/user-guide-admin/section_cli_nova_migrate.xml new file mode 100644 index 0000000000..6542c4977f --- /dev/null +++ b/doc/user-guide-admin/section_cli_nova_migrate.xml @@ -0,0 +1,74 @@ + +
+ Migrate single instance to another compute host + When you want to move an instance from one compute host to another, + you can use the nova migrate 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. + + + To list the VMs you want to migrate, run: + $ nova list + + + After selecting a VM from the list, run this command where + VM_ID is set to the ID in the list + returned in the previous step: + $ nova show VM_ID + + + Now, use the nova migrate command: + $ nova migrate VM_ID + + + To migrate of an instance and watch the status, use this + example script: + #!/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." + + 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 policy.json file prevents + migration for your user. + ERROR (Forbidden): Policy doesn't allow compute_extension:admin_actions:migrate to be performed. (HTTP 403) + + The instance is booted from a new host, but preserves its + configuration including its ID, name, any metadata, IP address, + and other properties. + + +