LoginSignup
0
0

More than 5 years have passed since last update.

Openstack - Nova Migration (Manually) between AZ

Last updated at Posted at 2015-12-13

Nova Migration Type

The migration types are:

  1. Non-live migration (sometimes referred to simply as ‘migration’)
    The instance is shut down for a period of time to be moved to another hypervisor. In this case, the instance recognizes that it was rebooted.

  2. Live migration (or ‘true live migration’)
    Almost no instance downtime. Useful when the instances must be kept running during the migration.
    The different types of live migration are:

    • 2-1. Shared storage-based live migration
      Both hypervisors have access to shared storage.
    • 2-2. Block live migration
      No shared storage is required. Incompatible with read-only devices such as CD-ROMs and Configuration Drive (config_drive).
    • 2-3. Volume-backed live migration
      Instances are backed by volumes rather than ephemeral disk, no shared storage is required, and migration is supported (currently only available for libvirt-based hypervisors).

What's this?

nova migrate を使用した AZ 間の Nova instance の移動ではなく、

手動で Nova instance を別の AZ へ移動。

Brief summary procedure:

  1. Nova の snapshot 取得
  2. その snapshot から 別 AZ で Nova boot

Migrate Nova instance

Initial state

Hypervisor (Compute node)

# nova hypervisor-list
+----+-----------------------+
| ID | Hypervisor hostname   |
+----+-----------------------+
| 6  | node-27               |
| 9  | node-28               |
| 15 | node-31               |
+----+-----------------------+

AZ

# nova availability-zone-list | egrep -A 10 "^\| nova"
| nova                     | available                              |
| |- node-27               |                                        |
| | |- nova-compute        | enabled :-) 2015-02-25T01:12:12.000000 |
| |- node-28               |                                        |
| | |- nova-compute        | enabled :-) 2015-02-25T01:12:15.000000 |
| nova2                    | available                              |
| |- node-31               |                                        |
| | |- nova-compute        | enabled :-) 2015-02-25T01:12:13.000000 |
+--------------------------+----------------------------------------+

Nova instance is on node-27 of AZ:nova

# nova list --field name,status,,OS-EXT-STS:vm_state,OS-EXT-AZ:availability_zone,OS-EXT-SRV-ATTR:hypervisor_hostname
+--------------------------------------+------------+--------+--+----------------------+------------------------------+--------------------------------------+
| ID                                   | Name       | Status |  | OS-EXT-STS: Vm State | OS-EXT-AZ: Availability Zone | OS-EXT-SRV-ATTR: Hypervisor Hostname |
+--------------------------------------+------------+--------+--+----------------------+------------------------------+--------------------------------------+
| 4cabed9e-94fe-4229-9fb9-b4e785895845 | admin_vm01 | ACTIVE |  | active               | nova                         | node-27                              |
+--------------------------------------+------------+--------+--+----------------------+------------------------------+--------------------------------------+

Nova snapshot

Take Nova snapshot

Recommend to stop a instance before take a snapshot.

$ nova image-create --poll admin_vm01 admin_vm01_ss
Server snapshotting... 100% complete
Finished

List Glance images

$ glance image-list --name admin_vm01_ss
+--------------------------------------+---------------+-------------+------------------+------------+--------+
| ID                                   | Name          | Disk Format | Container Format | Size       | Status |
+--------------------------------------+---------------+-------------+------------------+------------+--------+
| 95385cef-879c-4b36-91d7-e96f87c0c8ed | admin_vm01_ss | raw         | bare             | 1073741824 | active |
+--------------------------------------+---------------+-------------+------------------+------------+--------+

$ glance image-show admin_vm01_ss | egrep "Property|instance_uuid"
| Property                              | Value                                |
| Property 'instance_uuid'              | 4cabed9e-94fe-4229-9fb9-b4e785895845 |

Boot Nova instance in different AZ:nova2 from the snapshot of AZ:nova

Nova boot

# nova boot --flavor m1.tiny \
            --image admin_vm01_ss \
            --security-groups default \
            --availability-zone nova2 \
            --nic net-id=b3fa9d4d-4c21-47f5-be07-cf2ff518035e \
            admin_vm02
+--------------------------------------+------------------------------------------------------+
| Property                             | Value                                                |
+--------------------------------------+------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                               |
| OS-EXT-AZ:availability_zone          | nova                                                 |
| OS-EXT-SRV-ATTR:host                 | -                                                    |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                    |
| OS-EXT-SRV-ATTR:instance_name        | instance-0000048c                                    |
| OS-EXT-STS:power_state               | 0                                                    |
| OS-EXT-STS:task_state                | scheduling                                           |
| OS-EXT-STS:vm_state                  | building                                             |
| OS-SRV-USG:launched_at               | -                                                    |
| OS-SRV-USG:terminated_at             | -                                                    |
| accessIPv4                           |                                                      |
| accessIPv6                           |                                                      |
| adminPass                            | yWYtEPCu78qz                                         |
| config_drive                         |                                                      |
| created                              | 2015-02-25T01:22:19Z                                 |
| flavor                               | m1.tiny (1)                                          |
| hostId                               |                                                      |
| id                                   | e75a9a13-1df2-43e3-923e-bd6f4b56996c                 |
| image                                | admin_vm01_ss (d2aad231-0b2a-4785-b58c-aa57300e5dee) |
| key_name                             | -                                                    |
| metadata                             | {}                                                   |
| name                                 | admin_vm02                                           |
| os-extended-volumes:volumes_attached | []                                                   |
| progress                             | 0                                                    |
| security_groups                      | default                                              |
| status                               | BUILD                                                |
| tenant_id                            | a8085d1871f847bdb906ef4a28d1bd48                     |
| updated                              | 2015-02-25T01:22:19Z                                 |
| user_id                              | a1c2ec19759040e39f219fcf82028bf6                     |
+--------------------------------------+------------------------------------------------------+

Check the Nova instance

New Nova instance is booted on node-31 in AZ:nova2

# nova list --field name,status,,OS-EXT-STS:vm_state,OS-EXT-AZ:availability_zone,OS-EXT-SRV-ATTR:hypervisor_hostname
+--------------------------------------+------------+--------+--+----------------------+------------------------------+--------------------------------------+
| ID                                   | Name       | Status |  | OS-EXT-STS: Vm State | OS-EXT-AZ: Availability Zone | OS-EXT-SRV-ATTR: Hypervisor Hostname |
+--------------------------------------+------------+--------+--+----------------------+------------------------------+--------------------------------------+
| 4cabed9e-94fe-4229-9fb9-b4e785895845 | admin_vm01 | ACTIVE |  | active               | nova                         | node-27                              |
| e75a9a13-1df2-43e3-923e-bd6f4b56996c | admin_vm02 | ACTIVE |  | active               | nova2                        | node-31                              |
+--------------------------------------+------------+--------+--+----------------------+------------------------------+--------------------------------------+

# nova show admin_vm02 | egrep "Property|AZ|hypervisor| id |image"
| Property                             | Value                                                    |
| OS-EXT-AZ:availability_zone          | nova2                                                    |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | node-31                                                  |
| id                                   | e75a9a13-1df2-43e3-923e-bd6f4b56996c                     |
| image                                | admin_vm01_ss (d2aad231-0b2a-4785-b58c-aa57300e5dee)     |

Environment

  • Openstack : Juno
  • Ceph : Firefly

Reference

Nova Migration (non live migration) to Different Hypervisor
Nova Migration (non live migration) to Different Hypervisor between AZ
Nova Migration (true live migration) to Different Hypervisor
Nova Migration (true live migration) to Different Hypervisor between AZ
Nova Migration (Manually) between AZ
Nova Migration (Manually) between Region
Nova Migration (true live migration) to Different Hypervisor - Volume-backend live migration (instance)
Nova Migration (true live migration) to Different Hypervisor - Volume-backend live migration (instance) between AZ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0