Migrate Virtual Machines

Procedure

  1. View the OpenStack server list to determine the VM to be migrated.
    # openstack server list
    
    +--------------------------------------+------+--------+-----------------+------------+
    | ID                                   | Name | Status | Networks        | Image Name |
    +--------------------------------------+------+--------+-----------------+------------+
    | d1df1b5a-70c4-4fed-98b7-423362f2c47c | vm1  | ACTIVE | private=a.b.c.d | ...        |
    | d693db9e-a7cf-45ef-a7c9-b3ecb5f22645 | vm2  | ACTIVE | private=e.f.g.h | ...        |
    +--------------------------------------+------+--------+-----------------+------------+
  2. Select the destination host.
    • For manual selection of the destination host, proceed to the next step.
    • For automatic selection of the destination host, go to Step 6.
  3. View the server details of the selected VM.
    # openstack server show d1df1b5a-70c4-4fed-98b7-423362f2c47c
    
    +----------------------+--------------------------------------+
    | Field                | Value                                |
    +----------------------+--------------------------------------+
    | ...                  | ...                                  |
    | OS-EXT-SRV-ATTR:host | HostB                                |
    | ...                  | ...                                  |
    | addresses            | a.b.c.d                              |
    | flavor               | m1.tiny                              |
    | id                   | d1df1b5a-70c4-4fed-98b7-423362f2c47c |
    | name                 | vm1                                  |
    | status               | ACTIVE                               |
    | ...                  | ...                                  |
    +----------------------+--------------------------------------+
  4. Determine the destination host to migrate the selected VM.
    # openstack compute service list
    
    +----+------------------+-------+----------+---------+-------+----------------------------+
    | ID | Binary           | Host  | Zone     | Status  | State | Updated At                 |
    +----+------------------+-------+----------+---------+-------+----------------------------+
    |  3 | nova-conductor   | HostA | internal | enabled | up    | 2017-02-18T09:42:29.000000 |
    |  4 | nova-scheduler   | HostA | internal | enabled | up    | 2017-02-18T09:42:26.000000 |
    |  5 | nova-consoleauth | HostA | internal | enabled | up    | 2017-02-18T09:42:29.000000 |
    |  6 | nova-compute     | HostB | nova     | enabled | up    | 2017-02-18T09:42:29.000000 |
    |  7 | nova-compute     | HostC | nova     | enabled | up    | 2017-02-18T09:42:29.000000 |
    +----+------------------+-------+----------+---------+-------+----------------------------+
    
    # openstack host show HostC
    
    +-------+------------+-----+-----------+---------+
    | Host  | Project    | CPU | Memory MB | Disk GB |
    +-------+------------+-----+-----------+---------+
    | HostC | (total)    |  16 |     32232 |     878 |
    | HostC | (used_now) |  22 |     21284 |     422 |
    | HostC | (used_max) |  22 |     21284 |     422 |
    | HostC | p1         |  22 |     21284 |     422 |
    | HostC | p2         |  22 |     21284 |     422 |
    +-------+------------+-----+-----------+---------+
  5. Migrate the VM instance.
    • Manual selection of the destination host:
      # openstack server migrate d1df1b5a-70c4-4fed-98b7-423362f2c47c --live HostC
    • Automatic selection of the destination host:
      # nova live-migration d1df1b5a-70c4-4fed-98b7-423362f2c47c
  6. View the host server details of the migrated VM to confirm the status of migration. If migration fails, go to Step 8.
    # openstack server show d1df1b5a-70c4-4fed-98b7-423362f2c47c
    
    +----------------------+--------------------------------------+
    | Field                | Value                                |
    +----------------------+--------------------------------------+
    | ...                  | ...                                  |
    | OS-EXT-SRV-ATTR:host | HostC                                |
    | ...                  | ...                                  |
    +----------------------+--------------------------------------+
  7. Optional: View the log files on the controller and compute nodes for more information about migration failure.
    • nova-scheduler
    • nova-conductor
    • nova-compute
  8. Optional: Stop the migration manually.
    # nova live-migration-abort INSTANCE_ID MIGRATION_ID
  9. Optional: Force complete the migration.
    # nova live-migration-force-complete INSTANCE_ID MIGRATION_ID