manila/manila/data/rpcapi.py
Rodrigo Barbieri 9639e72692 Share migration Newton improvements
At Austin 2016 summit there were several improvements to
Share migration feature discussed. This patch implements
these changes.

Changes are:
- Added 'Writable' API parameter: user chooses whether share must
remain writable during migration.
- Added 'Preserve Metadata' API parameter: user chooses whether
share must preserve all file metadata on migration.
- Added 'Non-disruptive' API parameter: user chooses whether
migration of share must be performed non-disruptively.
- Removed existing 'Notify', thus removing 1-phase migration
possibility.
- Renamed existing 'Force Host Copy' parameter to 'Force
Host-assisted Migration'.
- Renamed all 'migration_info' and 'migration_get_info' entries to
'connection_info' and 'connection_get_info'.
- Updated driver interfaces with the new API parameters, drivers
must respect them.
- Changed share/api => scheduler RPCAPI back to asynchronous.
- Added optional SHA-256 validation to perform additional check if
bytes were corrupted during copying.
- Added mount options configuration to Data Service so CIFS shares
can be mounted.
- Driver may override _get_access_mapping if supports a different
access_type/protocol combination than what is defined by default.
- Added CIFS share protocol support and 'user' access type
support to Data Service.
- Reset Task State API now allows task_state to be unset using
'None' value.
- Added possibility to change share-network when migrating a share.
- Bumped microversion to 2.22.
- Removed support of all previous versions of Share Migration APIs.

APIImpact
DocImpact

Implements: blueprint newton-migration-improvements
Change-Id: Ief49a46c86ed3c22d3b31021aff86a9ce0ecbe3b
2016-08-31 12:38:14 -03:00

68 lines
2.3 KiB
Python

# Copyright 2015, Hitachi Data Systems.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Client side of the data manager RPC API.
"""
from oslo_config import cfg
import oslo_messaging as messaging
from manila import rpc
CONF = cfg.CONF
class DataAPI(object):
"""Client side of the data RPC API.
API version history:
1.0 - Initial version,
Add migration_start(),
data_copy_cancel(),
data_copy_get_progress()
"""
BASE_RPC_API_VERSION = '1.0'
def __init__(self):
super(DataAPI, self).__init__()
target = messaging.Target(topic=CONF.data_topic,
version=self.BASE_RPC_API_VERSION)
self.client = rpc.get_client(target, version_cap='1.0')
def migration_start(self, context, share_id, ignore_list,
share_instance_id, dest_share_instance_id,
connection_info_src, connection_info_dest):
call_context = self.client.prepare(version='1.0')
call_context.cast(
context,
'migration_start',
share_id=share_id,
ignore_list=ignore_list,
share_instance_id=share_instance_id,
dest_share_instance_id=dest_share_instance_id,
connection_info_src=connection_info_src,
connection_info_dest=connection_info_dest)
def data_copy_cancel(self, context, share_id):
call_context = self.client.prepare(version='1.0')
call_context.call(context, 'data_copy_cancel', share_id=share_id)
def data_copy_get_progress(self, context, share_id):
call_context = self.client.prepare(version='1.0')
return call_context.call(context, 'data_copy_get_progress',
share_id=share_id)