How-To Migrate Volumes Using CLI

Problem

You want to migrate volumes from one Cinder pool to another pool.

Environment

  • Platform9 Managed OpenStack - All Versions

  • Cinder

Answer

There are two major scenarios for which volume migration is supported in Cinder:

  1. Migration between two back-ends with the same volume type, regardless if they are located on the same cinder-volume host or not.

cinder migrate [--force-host-copy [[True|False]]] [--lock-volume [[True|False]]] [volume] [host]

Mandatory arguments:  
[volume] ID of volume to migrate.  
[host]Destination host.The format of host is host@backend#POOL, while 'host' is the host name of the volume node, 'backend' is the back-end name and 'POOL' is a logical concept to describe a set of storage resource, residing in the back-end. If the back-end does not have specified pools, 'POOL' needs to be set with the same name as 'backend'.

Optional arguments:  
--force-host-copy [[True|False]] Enables or disables generic host-based force-migration,which bypasses the driver optimization.Default=False.  
--lock-volume [[True|False]] Enables or disables the termination of volume migration caused by other commands. This option applies to the available volume. True means it locks the volume state and does not allow the migration to be aborted. The volume status will be in maintenance during the migration. False means it allows the volume migration to be aborted. The volume status is still in the original status. Default=False.

Note: Currently, error handling for failed migration operations is under development in Cinder. If you would like the volume migration to finish without any interruption, please set –-lock-volume to True. If it is set to False, Openstack cannot predict what will happen, if other actions like attach, detach, extend, etc, are issued on the volume during the migration. It all depends on which stage the volume migration has reached and when the request for another action comes.

  1. Migration between two back-ends with different volume types, regardless if the back-ends are located on the same cinder-volume host or not. Here, the source volume type and destination volume type must be different and they must refer to different back-ends.

Additional Information

Please refer to the official document for more information.

Volume Migration via CLIarrow-up-right.

Last updated