Migrating Volumes

Metacloud enables you to migrate volumes between hosts that support their volume-type. Migrating a volume transparently moves data from the current host for the volume to a new one. Migration can be performed for storage evacuation, for maintenance, or manual optimizations to improve performance and reliability.

Live migrations are classified by the instance storage:

  • Shared Storage-based Live Migration—The instance has ephemeral disks that are located on storage shared between the source and destination hosts.
  • Block Live Migration—The instance has ephemeral disks that are not shared between the source and destination hosts. Block live migration requires copying disks from the source to the destination host and is incompatible with read-only devices like CD-ROMS.
  • Volume-backed Live Migration— Instances use volumes rather than ephemeral disks. Volume-backed migrations take more time and put more load on the network because, like shared-storage it does not copy disks.

Using the Storage service to migrate the volume allows the Block Storage driver to perform optimizations. If the service is not able to perform the migration and the volume is not attached to an VM, the Block Storage service creates a volume and copies the data from the original volume to the new volume.

Note
While most storage drivers support data migration, not all do. See the following sections for more information:

If the volume is attached to a VM instance, the Block Storage service creates a volume, and calls Compute to copy the data from the original volume to the new volume.

To migrate data:

  1. List the available servers.

    $ cinder get-pools
    | Property | Value                       |
    |----------|-----------------------------|
    | name     | server1@storage-1#storage-1 |
    	
    | Property | Value                       |
    |----------|-----------------------------|
    | name     | server2@storage-2#storage-2 |
    
  2. Access available servers by adding the pool name.

    $ cinder manage <HOST_NAME>
    server1@storage-1    zone1
    server2@storage-2    zone1
    
  3. Check the current status of the volume.

    $ openstack volume show <VOLUME_ID>
    +---------------------------------------+---------------------------------------------------------------------------------+
    | Field                                 | Value                                                                           |
    +---------------------------------------+---------------------------------------------------------------------------------+
    | attachments                           | []                                                                              |
    | availability_zone                     | stage1                                                                          |
    | bootable                              | true                                                                            |
    | consistencygroup_id                   | None                                                                            |
    | created_at                            | 2016-12-14T20:47:40.000000                                                      |
    | description                           |                                                                                 |
    | encrypted                             | False                                                                           |
    | id                                    | <volume_id>                                                                     |
    | migration_status                      | None                                                                            |
    | multiattach                           | False                                                                           |
    | name                                  | <volume_name>                                                                   |
    | os-vol-host-attr:host                 | Host.AZ@volume-type#volume-type                                                 |
    | os-vol-mig-status-attr:migstat        | None                                                                            |
    | os-vol-mig-status-attr:name_id        | <new_volume_name>                                                               |
    | os-vol-tenant-attr:tenant_id          | <tenant_id>                                                                     |
    | os-volume-replication:driver_data     | None                                                                            |
    | os-volume-replication:extended_status | None                                                                            |
    | properties                            |                                                                                 |
    | replication_status                    | disabled                                                                        |
    | size                                  | 3                                                                               |
    | snapshot_id                           | None                                                                            |
    | source_volid                          | None                                                                            |
    | status                                | available                                                                       |
    | type                                  | ceph                                                                            |
    | user_id                               | <user_id>                                                                       |
    | volume_image_metadata                 | {u'container_format': u'bare', u'min_ram': u'0', u'disk_format': u'raw', u      |
    |                                       | 'image_name': u'ubuntu_1404_server_cloudimg_amd64',u'image_id': u'<image_id>',  |
    |                                       | u'checksum': u'<checksum>', u'min_disk': u'0', u'size': u'2361393152'}          |
    +---------------------------------------+---------------------------------------------------------------------------------+
    

    Make note of the following attributes:

    • os-vol-host-attr:host—the volume’s current host.
    • os-vol-mig-status-attr:migstat—the status of this volume’s migration (None means that a migration is not currently in progress).
    • os-vol-mig-status-attr:name_id—the volume ID that provides the basis for the host volume name. Before a volume is ever migrated, its name on the storage server may be based on the volume ID (see the volume_name_template configuration parameter). For example, if volume_name_template is kept as the default value (volume-%s), your first storage server has a volume named volume-<volume_id>. During the course of a migration, if you create a volume and copy over the data, the volume will get the new name but keeps the original ID. This is exposed by the name_id attribute.

    Note
    If you plan to decommission a block storage node, you must stop the cinder volume service on the node after performing the migration.

  4. Stop the cinder volume service.

    # service openstack-cinder-volume stop
    # chkconfig openstack-cinder-volume off
    

Stopping the cinder volume service prevents volumes from being allocated to the node.

  1. Migrate this volume to the second storage server:

    $ openstack volume migrate <VOLUME_ID> \ server2@storage-2#storage-2
    
  2. (Optional) View the status of the migration. During the migration process, the migstat attribute shows states such as migrating or completing. On error, migstat is set to None and the host attribute shows the original host.

    $ openstack volume show <VOLUME_ID>
    +---------------------------------------+---------------------------------------------------------------------------------+
    | Field                                 | Value                                                                           |
    +---------------------------------------+---------------------------------------------------------------------------------+
    | attachments                           | []                                                                              |
    | availability_zone                     | stage1                                                                          |
    | bootable                              | true                                                                            |
    | consistencygroup_id                   | None                                                                            |
    | created_at                            | 2016-12-14T20:47:40.000000                                                      |
    | description                           |                                                                                 |
    | encrypted                             | False                                                                           |
    | id                                    | <volume_id>                                                                     |
    | migration_status                      | None                                                                            |
    | multiattach                           | False                                                                           |
    | name                                  | <new_volume>                                                                    |
    | os-vol-host-attr:host                 | New-Host.AZ@volume-type#volume-type                                             |
    | os-vol-mig-status-attr:migstat        | None                                                                            |
    | os-vol-mig-status-attr:name_id        | <volume_id>                                                                     |
    | os-vol-tenant-attr:tenant_id          | <tenant_id>                                                                     |
    | os-volume-replication:driver_data     | None                                                                            |
    | os-volume-replication:extended_status | None                                                                            |
    | properties                            |                                                                                 |
    | replication_status                    | disabled                                                                        |
    | size                                  | 3                                                                               |
    | snapshot_id                           | None                                                                            |
    | source_volid                          | None                                                                            |
    | status                                | available                                                                       |
    | type                                  | ceph                                                                            |
    | user_id                               | <user_id>                                                                       |
    | volume_image_metadata                 | {u'container_format': u'bare', u'min_ram': u'0', u'disk_format': u'raw', u      |
    |                                       | 'image_name': u'ubuntu_1404_server_cloudimg_amd64',u'image_id': u'<image_id>',  |
    |                                       | u'checksum': u'<checksum>', u'min_disk': u'0', u'size': u'2361393152'}          |
    +---------------------------------------+---------------------------------------------------------------------------------+
    

Note that migstat is None, host is the new host, and name_id holds the ID of the volume created by the migration. The second storage server, contains the volume volume-<volume_tenant_id>.

Note
Migrating volumes that have snapshots is currently not supported.

When a migration is in process, it is only visible to administrators through volume status and other indicators. Non-administrators cannot tell a migration is taking place. Some operations are not allowed while a migration is taking place, such as attaching, detaching, or deleting a volume. If you perform one of these actions during a migration you will receive an error.