Ask Your Question

instance migration to specific compute-node using API

asked 2015-02-16 06:08:03 -0500

AlonFre gravatar image

Hi all,

is it possible to generate an instance migration to a specific host using API request? this is the related APIs that we found, but in none of them you can specify the destination compute node.

/v2/​{tenant_id}​/servers/​{server_id}​/actionLive-migrate server Live-migrates a server to a new host without rebooting.

/v2/​{tenant_id}​/servers/​{server_id}​/actionMigrate server Migrates a server to a host. The scheduler chooses the host.

/v2/​{tenant_id}​/os-migrationsGet migrations Enables an administrative user to fetch in-progress migrations for a region or specified cell in a region

if i do want to migrate an instance to a specific compute node, lets say using some script, how can i do it?

thanks in advance,


edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2015-02-16 08:06:08 -0500

Poonam Agarwal gravatar image

I have used below command on the Controller node to live migrate an instance to a specific hypervisor/compute node

nova live-migration  --block-migrate <Instance Name/ID>  <Hypervisor Name you want to migrate the instance to>

Example: To migrate an instance 269aa8f7-448b-49c3-b641-f313f10c205d to compute node 5

nova live-migration --block-migrate 269aa8f7-448b-49c3-b641-f313f10c205d compute5
edit flag offensive delete link more


thanks for your answer. is there a way to use this command from the API? as i understand, block migration is good only if you do not have any shered block storage? and it takes longer, since you copy all of the data to a new host...

AlonFre gravatar imageAlonFre ( 2015-02-16 09:00:43 -0500 )edit

I dont think we have an option to specify the hypervisor from the API. Yes block migration is not non shared storage . However the below command can be used for shared storage :

nova live-migration 0bb04bc1-5535-49e2-8769- 53fa42e184c8 vmcom1-mn
Poonam Agarwal gravatar imagePoonam Agarwal ( 2015-02-16 09:22:25 -0500 )edit

ok, so it is possible to determine to which compute node i want to migrate. in both live-migration and live-block-migration. link to API commands in the live migrate server, there is a parameter:"host-name of the new host". does it works?

AlonFre gravatar imageAlonFre ( 2015-02-16 09:52:48 -0500 )edit

Yeah looks like it. It should work. Would advise you to test the same.

Poonam Agarwal gravatar imagePoonam Agarwal ( 2015-02-16 11:23:51 -0500 )edit

Yes , for cold migration , refer below link. The support for cold migration with target host specifications has been added in Juno.

link text

Poonam Agarwal gravatar imagePoonam Agarwal ( 2015-02-17 03:20:03 -0500 )edit

answered 2015-02-16 06:41:15 -0500

SamYaple gravatar image

updated 2015-02-16 20:50:12 -0500

Unfortunately there is not a way to do this with 'cold' migration. You can specify a server with live-migration though.

For 'cold' migration, as a workaround you can disable the nova-compute service on all of the nodes you don't want to migrate to. This ensures the scheduler only finds one valid host for the instance to go to.

nova service-disable <hostname> nova-compute

This only marks the service down on the controller side, it won't actually mess with instances or traffic (however this prevents those servers from being managed).

Once the scheduler has picked your desired host you can reenabled all of the services you disabled.

I have toyed with the idea of using nova evacuate <instance-id> <target-compute-host> to do this, but it would require shared storage for everything (since this won't actually move any data over). And this will probably leave some cruft on the original compute host since it won't issue any cleanup operations. But its cleaner that disabling all the other services.

Use evacuate at your own risk. You can easily lose data with it.

Poonam Agarwal has answered with how to specify a host with live-migration. Be aware that many factors make live-migration unreliable. In the case of block_migration you can dirty data faster than it can tranfer leaving you with a perpetually migrating image.

edit flag offensive delete link more


when looking at the API guide: link to API commands in the live migrate server, there is a parameter: "host- name of the new host", isn't it an option for magrating to a specific destination compute node?

AlonFre gravatar imageAlonFre ( 2015-02-16 09:12:45 -0500 )edit

You are correct, I have updated my answer. I was only speaking about cold migrate, not live-migrate.

SamYaple gravatar imageSamYaple ( 2015-02-16 20:49:35 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-02-16 06:08:03 -0500

Seen: 8,477 times

Last updated: Feb 16 '15