As of the Ocata release of OpenStack, manila supports migration of shares across different pools through an experimental API. Since it was first introduced, several enhancements have been made through the subsequent releases while still in experimental state. This developer document reflects the latest version of the experimental Share Migration API.
The Share Migration API is an administrator-only experimental API that allows the invoker to select a destination pool to migrate a share to, while still allowing clients to access the source share instance during the migration. Migration of data is generally expected to be disruptive for users accessing the source, because at some point it will cease to exist. For this reason, the share migration feature is implemented in a 2-phase approach, for the purpose of controlling the timing of that expected disruption of migrating shares.
The first phase of migration is when operations that take the longest are performed, such as data copying or replication. After the first pass of data copying is complete, it is up to the administrator to trigger the second phase, often referred to as switchover phase, which may perform operations such as a last sync and deleting the source share instance.
During the data copy phase, users remain connected to the source, and may have to reconnect after the switchover phase. In order to migrate a share, manila may employ one of two mechanisms which provide different capabilities and affect how the disruption occurs with regards to user access during data copy phase and disconnection during switchover phase. Those two mechanisms are:
Note that during a share migration, access rules cannot be added or removed.
As of Ocata release, this feature allows several concurrent migrations (driver-assisted or host-assisted) to be performed, having a best-effort type of scalability.
The migration of a share is started by invoking the migration_start
API.
The parameters are:
host@backend#pool
representation. This
parameter is mandatory.After started, a migration may be cancelled through the migration_cancel
API, have its status obtained through the migration_get_progress
API, and
completed through the migration_complete
API after reaching a certain
state (see Workflows
section below).
Upon invoking migration_start
, several validations will be performed by the
API layer, such as:
If any of the above validations fail, the API will return an error. Otherwise, the task_state field value will transition to migration_starting and the share’s status will transition to migrating. Past this point, all validations, state transitions and errors will not produce any notifications to the user. Instead, the given share’s task_state field value will transition to migration_error.
Following API validation, the scheduler will validate if the supplied destination is compatible with the desired share type according to the pool’s capabilities. If this validation fails, the task_state field value will transition to migration_error.
The scheduler then invokes the source share pool’s manager to proceed with the migration, transitioning the task_state field value to migration_in_progress. If force-host-assisted-migration API parameter is not set, then a driver-assisted migration will be attempted first.
Note that whichever mechanism is employed, there will be a new share instance created in the database, referred to as the “destination instance”, with a status field value migrating_to. This share instance will not have its export location displayed during migration and will prevail instead of the original instance database entry when migration is complete.
A share server will be created as needed at the destination pool. Then, the share server details are provided to the driver to report the set of migration capabilities for this destination. If the API parameters writable, nondisruptive, preserve_metadata and preserve_snapshots are satisfied by the reported migration capabilities, the task_state field value transitions to migration_driver_starting and the driver is invoked to start the migration.
The driver’s migration_start method should start a job in the storage back end and return, allowing the task_state field value to transition to migration_driver_in_progress. If any of the API parameters described previously are not satisfied, or the driver raises an exception in migration_start, the driver-assisted migration ends setting the task_state field value to migration_error, all allocated resources will be cleaned up and migration will proceed to the host-assisted migration mechanism.
Once the migration_start driver method succeeds, a periodic task that checks for shares with task_state field value migration_driver_in_progress will invoke the driver’s migration_continue method, responsible for executing the next steps of migration until the data copy phase is completed, transitioning the task_state field value to migration_driver_phase1_done. If this step fails, the task_state field value transitions to migration_error and all allocated resources will be cleaned up.
A new share will be created at the destination pool and the source share’s access rules will be changed to read-only. The task_state field value transitions to data_copying_starting and the Data Service is then invoked to mount both shares and copy data from the source to the destination.
In order for the Data Service to mount the shares, it will ask the storage driver to allow access to the node where the Data Service is running. It will then attempt to mount the shares via their respective adminstrator-only export locations that are served in the administrator network when available, otherwise the regular export locations will be used.
In order for the access and mount procedures to succeed, the administrator-only export location must be reachable from the Data Service and the access parameter properly configured in the Data Service configuration file. For instance, a NFS share should require an IP configuration, whereas a CIFS share should require a username credential. Those parameters should be previously set in the Data Service configuration file by the administrator.
The data copy routine runs commands as root user for the purpose of setting the correct file metadata to the newly created files at the destination share. It can optionally verify the integrity of all files copied through a configuration parameter. Once copy is completed, the shares are unmounted, their access from the Data Service are removed and the task_state field value transitions to data_copying_completed, allowing the switchover phase to be invoked.
When invoked, the task_state field value transitions to migration_completing. Whichever migration mechanism is used, the source share instance is deleted and the access rules are applied to the destination share instance. In the driver-assisted migration, the driver is first invoked to perform a final sync.
The last step is to update the share model’s optional capability fields, such as create_share_from_snapshot_support, revert_to_snapshot_support and mount_snapshot_support, according to the new_share_type, if it had been specified when the migration was initiated.
At last, the task_state field value transitions to migration_success. If the nondisruptive driver-assisted capability is not supported or the host-assisted migration mechanism is used, the export location will change and clients will need to remount the share.
All drivers that implement the driver-assisted migration mechanism should be able to perform all required steps from the source share instance back end within the implementation of the interfaces listed in the section below. Those steps include:
For host-assisted migration, drivers may override some methods defined in the base class in case it is necessary to support it.
migration_continue
method.migration_continue
will be
invoked continuously with an interval configured in the share manager service
(migration_driver_continue_interval
). The invocation will stop when the
driver finishes the data copy phase. In case of host-assisted migration, the
migration job is disrupted only if the manila-data service is restarted. In
such event, the migration has to be restarted from the beginning.update_access
interface, along with its recovery mode mechanism.ShareDriver
(driver_handles_share_servers, *args, **kwargs)Class defines interface of NAS driver.
migration_cancel
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Cancels migration of a given share to another host.
Note
Is called in source share’s backend to cancel migration.
If possible, driver can implement a way to cancel an in-progress migration.
Parameters: |
|
---|
migration_check_compatibility
(context, source_share, destination_share, share_server=None, destination_share_server=None)Checks destination compatibility for migration of a given share.
Note
Is called to test compatibility with destination backend.
Driver should check if it is compatible with destination backend so driver-assisted migration can proceed.
Parameters: |
|
---|---|
Returns: | A dictionary containing values indicating if destination backend is compatible, if share can remain writable during migration, if it can preserve all file metadata and if it can perform migration of given share non-disruptively. Example: {
'compatible': True,
'writable': True,
'preserve_metadata': True,
'nondisruptive': True,
'preserve_snapshots': True,
}
|
migration_complete
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Completes migration of a given share to another host.
Note
Is called in source share’s backend to complete migration.
If driver is implementing 2-phase migration, this method should perform the disruptive tasks related to the 2nd phase of migration, thus completing it. Driver should also delete all original share data from source backend.
Parameters: |
|
---|---|
Returns: | If the migration changes the share export locations, snapshot provider locations or snapshot export locations, this method should return a dictionary with the relevant info. In such case, a dictionary containing a list of export locations and a list of model updates for each snapshot indexed by their IDs. Example: {
'export_locations':
[
{
'path': '1.2.3.4:/foo',
'metadata': {},
'is_admin_only': False
},
{
'path': '5.6.7.8:/foo',
'metadata': {},
'is_admin_only': True
},
],
'snapshot_updates':
{
'bc4e3b28-0832-4168-b688-67fdc3e9d408':
{
'provider_location': '/snapshots/foo/bar_1',
'export_locations':
[
{
'path': '1.2.3.4:/snapshots/foo/bar_1',
'is_admin_only': False,
},
{
'path': '5.6.7.8:/snapshots/foo/bar_1',
'is_admin_only': True,
},
],
},
'2e62b7ea-4e30-445f-bc05-fd523ca62941':
{
'provider_location': '/snapshots/foo/bar_2',
'export_locations':
[
{
'path': '1.2.3.4:/snapshots/foo/bar_2',
'is_admin_only': False,
},
{
'path': '5.6.7.8:/snapshots/foo/bar_2',
'is_admin_only': True,
},
],
},
},
}
|
migration_continue
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Continues migration of a given share to another host.
Note
Is called in source share’s backend to continue migration.
Driver should implement this method to continue monitor the migration progress in storage and perform following steps until 1st phase is completed.
Parameters: |
|
---|---|
Returns: | Boolean value to indicate if 1st phase is finished. |
migration_get_progress
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Obtains progress of migration of a given share to another host.
Note
Is called in source share’s backend to obtain migration progress.
If possible, driver can implement a way to return migration progress information.
Parameters: |
|
---|---|
Returns: | A dictionary with at least ‘total_progress’ field containing the percentage value. |
migration_start
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Starts migration of a given share to another host.
Note
Is called in source share’s backend to start migration.
Driver should implement this method if willing to perform migration in a driver-assisted way, useful for when source share’s backend driver is compatible with destination backend driver. This method should start the migration procedure in the backend and end. Following steps should be done in ‘migration_continue’.
Parameters: |
|
---|
ShareDriver
(driver_handles_share_servers, *args, **kwargs)Class defines interface of NAS driver.
connection_get_info
(context, share, share_server=None)Is called to provide necessary generic migration logic.
Parameters: |
|
---|---|
Returns: | A dictionary with migration information. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.