Before starting migrations, review the Configure migrations section.
Migration provides a scheme to migrate running instances from one OpenStack Compute server to another OpenStack Compute server.
Procedure 4.6. To migrate instances
Look at the running instances, to get the ID of the instance you wish to migrate.
$ nova list +--------------------------------------+------+--------+-----------------+ | ID | Name | Status |Networks | +--------------------------------------+------+--------+-----------------+ | d1df1b5a-70c4-4fed-98b7-423362f2c47c | vm1 | ACTIVE | private=a.b.c.d | | d693db9e-a7cf-45ef-a7c9-b3ecb5f22645 | vm2 | ACTIVE | private=e.f.g.h | +--------------------------------------+------+--------+-----------------+
Look at information associated with that instance. This example uses 'vm1' from above.
$ nova show d1df1b5a-70c4-4fed-98b7-423362f2c47c +-------------------------------------+----------------------------------------------------------+ | Property | Value | +-------------------------------------+----------------------------------------------------------+ ... | OS-EXT-SRV-ATTR:host | HostB | ... | flavor | m1.tiny | | id | d1df1b5a-70c4-4fed-98b7-423362f2c47c | | name | vm1 | | private network | a.b.c.d | | status | ACTIVE | ... +-------------------------------------+----------------------------------------------------------+
In this example, vm1 is running on HostB.
Select the server to which instances will be migrated:
# nova service-list +------------------+------------+----------+---------+-------+----------------------------+-----------------+ | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +------------------+------------+----------+---------+-------+----------------------------+-----------------+ | nova-consoleauth | HostA | internal | enabled | up | 2014-03-25T10:33:25.000000 | - | | nova-scheduler | HostA | internal | enabled | up | 2014-03-25T10:33:25.000000 | - | | nova-conductor | HostA | internal | enabled | up | 2014-03-25T10:33:27.000000 | - | | nova-compute | HostB | nova | enabled | up | 2014-03-25T10:33:31.000000 | - | | nova-compute | HostC | nova | enabled | up | 2014-03-25T10:33:31.000000 | - | | nova-cert | HostA | internal | enabled | up | 2014-03-25T10:33:31.000000 | - | +------------------+-----------------------+----------+---------+-------+----------------------------+-----------------+
In this example, HostC can be picked up because
nova-compute
is running on it.Ensure that HostC has enough resources for migration.
# nova host-describe HostC +-----------+------------+-----+-----------+---------+ | HOST | PROJECT | cpu | memory_mb | disk_gb | +-----------+------------+-----+-----------+---------+ | HostC | (total) | 16 | 32232 | 878 | | HostC | (used_now) | 13 | 21284 | 442 | | HostC | (used_max) | 13 | 21284 | 442 | | HostC | p1 | 13 | 21284 | 442 | | HostC | p2 | 13 | 21284 | 442 | +-----------+------------+-----+-----------+---------+
cpu:the number of cpu
memory_mb:total amount of memory (in MB)
disk_gb:total amount of space for NOVA-INST-DIR/instances (in GB)
1st line shows total amount of resources for the physical server.
2nd line shows currently used resources.
3rd line shows maximum used resources.
4th line and under shows the resource for each project.
Use the nova live-migration command to migrate the instances:
$ nova live-migration
server
host_name
Where
server
can be either the server's ID or name. For example:$ nova live-migration d1df1b5a-70c4-4fed-98b7-423362f2c47c HostC Migration of d1df1b5a-70c4-4fed-98b7-423362f2c47c initiated.
Ensure instances are migrated successfully with nova list. If instances are still running on HostB, check log files (src/dest
nova-compute
andnova-scheduler
) to determine why.Note Although the nova command is called live-migration, under the default Compute configuration options the instances are suspended before migration.
For more details, see Configure migrations in OpenStack Configuration Reference.