Define experimental API header on python client level instead of CLI

For the moment we cannot use experimental APIs using "python" client.
It is possible only if we use shell client (CLI).
It means, we cannot use "share replication", "share migration" and
"consistency groups" APIs of python manilaclient from other apps
such as Manila UI. So, add special experimental header on python
client level instead of CLI.

Change-Id: I6eed5dcfd1cb309817e083856b40e10cc6f970f6
Closes-Bug: #1599586
This commit is contained in:
Valeriy Ponomaryov 2016-07-13 15:11:13 +03:00
parent 947989952a
commit 8c2f3c3a9b
17 changed files with 65 additions and 66 deletions

View File

@ -353,7 +353,8 @@ def experimental_api(f):
@functools.wraps(f) @functools.wraps(f)
def _wrapper(*args, **kwargs): def _wrapper(*args, **kwargs):
client = args[0] client = args[0]
if isinstance(client, manilaclient.v2.client.Client): if (isinstance(client, manilaclient.v2.client.Client) or
hasattr(client, 'client')):
dh = client.client.default_headers dh = client.client.default_headers
dh[constants.EXPERIMENTAL_HTTP_HEADER] = 'true' dh[constants.EXPERIMENTAL_HTTP_HEADER] = 'true'
return f(*args, **kwargs) return f(*args, **kwargs)

View File

@ -46,6 +46,7 @@ class Manager(utils.HookableMixin):
def __init__(self, api): def __init__(self, api):
self.api = api self.api = api
self.client = api.client
@property @property
def api_version(self): def api_version(self):

View File

@ -23,13 +23,18 @@ from manilaclient.v2 import client
class FakeClient(fakes.FakeClient): class FakeClient(fakes.FakeClient):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
client.Client.__init__(self, manilaclient.API_MAX_VERSION, client.Client.__init__(
'username', 'password', self,
'project_id', 'auth_url', manilaclient.API_MAX_VERSION,
input_auth_token='token', 'username',
extensions=kwargs.get('extensions'), 'password',
service_catalog_url='http://localhost:8786', 'project_id',
api_version=manilaclient.API_MAX_VERSION) 'auth_url',
input_auth_token='token',
extensions=kwargs.get('extensions'),
service_catalog_url='http://localhost:8786',
api_version=kwargs.get("api_version", manilaclient.API_MAX_VERSION)
)
self.client = FakeHTTPClient(**kwargs) self.client = FakeHTTPClient(**kwargs)
fake_share_instance = { fake_share_instance = {
@ -73,7 +78,8 @@ class FakeHTTPClient(fakes.FakeHTTPClient):
} }
], ],
"min_version": "2.0", "min_version": "2.0",
"version": "2.8", "version": self.default_headers[
"X-Openstack-Manila-Api-Version"],
"id": "v2.0", "id": "v2.0",
} }
] ]

View File

@ -29,13 +29,10 @@ class ConsistencyGroupSnapshotsTest(utils.TestCase):
class _FakeConsistencyGroupSnapshot(object): class _FakeConsistencyGroupSnapshot(object):
id = 'fake_cg_snapshot_id' id = 'fake_cg_snapshot_id'
class _FakeClient(object):
api_version = manilaclient.API_MAX_VERSION
def setUp(self): def setUp(self):
super(ConsistencyGroupSnapshotsTest, self).setUp() super(ConsistencyGroupSnapshotsTest, self).setUp()
self.manager = cg_snapshots.ConsistencyGroupSnapshotManager( self.manager = cg_snapshots.ConsistencyGroupSnapshotManager(
api=self._FakeClient()) api=fakes.FakeClient())
self.values = { self.values = {
'consistency_group_id': 'fake_cg_id', 'consistency_group_id': 'fake_cg_id',
'name': 'fake snapshot name', 'name': 'fake snapshot name',

View File

@ -28,13 +28,10 @@ class ConsistencyGroupsTest(utils.TestCase):
class _FakeConsistencyGroupSnapshot(object): class _FakeConsistencyGroupSnapshot(object):
id = 'fake_cg_snapshot_id' id = 'fake_cg_snapshot_id'
class _FakeClient(object):
api_version = manilaclient.API_MAX_VERSION
def setUp(self): def setUp(self):
super(ConsistencyGroupsTest, self).setUp() super(ConsistencyGroupsTest, self).setUp()
self.manager = consistency_groups.ConsistencyGroupManager( self.manager = consistency_groups.ConsistencyGroupManager(
api=self._FakeClient()) api=fakes.FakeClient())
self.values = {'name': 'fake name', 'description': 'new cg'} self.values = {'name': 'fake name', 'description': 'new cg'}
def test_create(self): def test_create(self):

View File

@ -15,6 +15,7 @@
import mock import mock
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils
from manilaclient.tests.unit.v2 import fakes
from manilaclient.v2 import scheduler_stats from manilaclient.v2 import scheduler_stats
@ -40,7 +41,7 @@ class PoolManagerTest(utils.TestCase):
def setUp(self): def setUp(self):
super(PoolManagerTest, self).setUp() super(PoolManagerTest, self).setUp()
self.manager = scheduler_stats.PoolManager(api=None) self.manager = scheduler_stats.PoolManager(fakes.FakeClient())
@mock.patch.object(scheduler_stats.PoolManager, '_list', mock.Mock()) @mock.patch.object(scheduler_stats.PoolManager, '_list', mock.Mock())
def test_list(self): def test_list(self):

View File

@ -27,7 +27,8 @@ class SecurityServiceTest(utils.TestCase):
def setUp(self): def setUp(self):
super(SecurityServiceTest, self).setUp() super(SecurityServiceTest, self).setUp()
self.manager = security_services.SecurityServiceManager(api=None) self.manager = security_services.SecurityServiceManager(
fakes.FakeClient())
def test_create_all_fields(self): def test_create_all_fields(self):
values = { values = {

View File

@ -30,7 +30,7 @@ class ShareNetworkTest(utils.TestCase):
def setUp(self): def setUp(self):
super(ShareNetworkTest, self).setUp() super(ShareNetworkTest, self).setUp()
self.manager = share_networks.ShareNetworkManager(api=None) self.manager = share_networks.ShareNetworkManager(fakes.FakeClient())
self.values = { self.values = {
'nova_net_id': 'fake_nova_net_id', 'nova_net_id': 'fake_nova_net_id',
'neutron_net_id': 'fake net id', 'neutron_net_id': 'fake net id',

View File

@ -32,9 +32,8 @@ class ShareReplicasTest(utils.TestCase):
def setUp(self): def setUp(self):
super(ShareReplicasTest, self).setUp() super(ShareReplicasTest, self).setUp()
microversion = api_versions.APIVersion("2.11") microversion = api_versions.APIVersion("2.11")
mock_microversion = mock.Mock(api_version=microversion)
self.manager = share_replicas.ShareReplicaManager( self.manager = share_replicas.ShareReplicaManager(
api=mock_microversion) fakes.FakeClient(api_version=microversion))
def test_create(self): def test_create(self):
values = { values = {

View File

@ -16,6 +16,7 @@
import mock import mock
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils
from manilaclient.tests.unit.v2 import fakes
from manilaclient.v2 import share_servers from manilaclient.v2 import share_servers
@ -68,7 +69,7 @@ class ShareServerManagerTest(utils.TestCase):
def setUp(self): def setUp(self):
super(ShareServerManagerTest, self).setUp() super(ShareServerManagerTest, self).setUp()
self.manager = share_servers.ShareServerManager(api=None) self.manager = share_servers.ShareServerManager(api=fakes.FakeClient())
def test_list(self): def test_list(self):
with mock.patch.object(self.manager, '_list', with mock.patch.object(self.manager, '_list',

View File

@ -533,8 +533,8 @@ class SharesTest(utils.TestCase):
host = "fake_host" host = "fake_host"
force_host_copy = "fake_force_host_copy" force_host_copy = "fake_force_host_copy"
version = api_versions.APIVersion(microversion) version = api_versions.APIVersion(microversion)
mock_microversion = mock.Mock(api_version=version) manager = shares.ShareManager(
manager = shares.ShareManager(api=mock_microversion) api=fakes.FakeClient(api_version=version))
with mock.patch.object(manager, "_action", with mock.patch.object(manager, "_action",
mock.Mock(return_value="fake")): mock.Mock(return_value="fake")):
@ -552,9 +552,7 @@ class SharesTest(utils.TestCase):
def test_migration_complete(self): def test_migration_complete(self):
share = "fake_share" share = "fake_share"
version = api_versions.APIVersion("2.15") manager = shares.ShareManager(api=fakes.FakeClient())
mock_microversion = mock.Mock(api_version=version)
manager = shares.ShareManager(api=mock_microversion)
with mock.patch.object(manager, "_action", with mock.patch.object(manager, "_action",
mock.Mock(return_value="fake")): mock.Mock(return_value="fake")):
@ -566,9 +564,7 @@ class SharesTest(utils.TestCase):
def test_migration_get_progress(self): def test_migration_get_progress(self):
share = "fake_share" share = "fake_share"
version = api_versions.APIVersion("2.15") manager = shares.ShareManager(api=fakes.FakeClient())
mock_microversion = mock.Mock(api_version=version)
manager = shares.ShareManager(api=mock_microversion)
with mock.patch.object(manager, "_action", with mock.patch.object(manager, "_action",
mock.Mock(return_value="fake")): mock.Mock(return_value="fake")):
@ -581,9 +577,7 @@ class SharesTest(utils.TestCase):
def test_reset_task_state(self): def test_reset_task_state(self):
share = "fake_share" share = "fake_share"
state = "fake_state" state = "fake_state"
version = api_versions.APIVersion("2.15") manager = shares.ShareManager(api=fakes.FakeClient())
mock_microversion = mock.Mock(api_version=version)
manager = shares.ShareManager(api=mock_microversion)
with mock.patch.object(manager, "_action", with mock.patch.object(manager, "_action",
mock.Mock(return_value="fake")): mock.Mock(return_value="fake")):
@ -595,9 +589,7 @@ class SharesTest(utils.TestCase):
def test_migration_cancel(self): def test_migration_cancel(self):
share = "fake_share" share = "fake_share"
version = api_versions.APIVersion("2.15") manager = shares.ShareManager(api=fakes.FakeClient())
mock_microversion = mock.Mock(api_version=version)
manager = shares.ShareManager(api=mock_microversion)
with mock.patch.object(manager, "_action", with mock.patch.object(manager, "_action",
mock.Mock(return_value="fake")): mock.Mock(return_value="fake")):

View File

@ -40,7 +40,6 @@ class ShellTest(test_utils.TestCase):
'MANILA_USERNAME': 'username', 'MANILA_USERNAME': 'username',
'MANILA_PASSWORD': 'password', 'MANILA_PASSWORD': 'password',
'MANILA_PROJECT_ID': 'project_id', 'MANILA_PROJECT_ID': 'project_id',
'OS_SHARE_API_VERSION': '2.5',
'MANILA_URL': 'http://no.where', 'MANILA_URL': 'http://no.where',
} }

View File

@ -51,6 +51,7 @@ class ConsistencyGroupSnapshotManager(base.ManagerWithFind):
resource_class = ConsistencyGroupSnapshot resource_class = ConsistencyGroupSnapshot
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def create(self, consistency_group_id, name=None, description=None): def create(self, consistency_group_id, name=None, description=None):
"""Create a consistency group snapshot. """Create a consistency group snapshot.
@ -68,6 +69,7 @@ class ConsistencyGroupSnapshotManager(base.ManagerWithFind):
RESOURCE_NAME) RESOURCE_NAME)
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def get(self, cg_snapshot): def get(self, cg_snapshot):
"""Get a consistency group snapshot. """Get a consistency group snapshot.
@ -80,6 +82,7 @@ class ConsistencyGroupSnapshotManager(base.ManagerWithFind):
RESOURCE_NAME) RESOURCE_NAME)
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def update(self, cg_snapshot, **kwargs): def update(self, cg_snapshot, **kwargs):
"""Updates a consistency group snapshot. """Updates a consistency group snapshot.
@ -97,6 +100,7 @@ class ConsistencyGroupSnapshotManager(base.ManagerWithFind):
RESOURCE_NAME) RESOURCE_NAME)
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def list(self, detailed=True, search_opts=None): def list(self, detailed=True, search_opts=None):
"""Get a list of all consistency group snapshots. """Get a list of all consistency group snapshots.
@ -140,14 +144,17 @@ class ConsistencyGroupSnapshotManager(base.ManagerWithFind):
self._delete(RESOURCE_PATH % cg_id) self._delete(RESOURCE_PATH % cg_id)
@api_versions.wraps("2.4", "2.6") @api_versions.wraps("2.4", "2.6")
@api_versions.experimental_api
def delete(self, cg_snapshot, force=False): def delete(self, cg_snapshot, force=False):
return self._do_delete(cg_snapshot, force, 'os-force_delete') return self._do_delete(cg_snapshot, force, 'os-force_delete')
@api_versions.wraps("2.7") # noqa @api_versions.wraps("2.7") # noqa
@api_versions.experimental_api
def delete(self, cg_snapshot, force=False): def delete(self, cg_snapshot, force=False):
return self._do_delete(cg_snapshot, force, 'force_delete') return self._do_delete(cg_snapshot, force, 'force_delete')
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def members(self, cg_snapshot, search_opts=None): def members(self, cg_snapshot, search_opts=None):
"""Get a list of consistency group snapshot members. """Get a list of consistency group snapshot members.
@ -176,10 +183,12 @@ class ConsistencyGroupSnapshotManager(base.ManagerWithFind):
return self.api.client.post(url, body=body) return self.api.client.post(url, body=body)
@api_versions.wraps("2.4", "2.6") @api_versions.wraps("2.4", "2.6")
@api_versions.experimental_api
def reset_state(self, cg_snapshot, state): def reset_state(self, cg_snapshot, state):
return self._do_reset_state(cg_snapshot, state, 'os-reset_status') return self._do_reset_state(cg_snapshot, state, 'os-reset_status')
@api_versions.wraps("2.7") # noqa @api_versions.wraps("2.7") # noqa
@api_versions.experimental_api
def reset_state(self, cg_snapshot, state): def reset_state(self, cg_snapshot, state):
return self._do_reset_state(cg_snapshot, state, 'reset_status') return self._do_reset_state(cg_snapshot, state, 'reset_status')

View File

@ -51,6 +51,7 @@ class ConsistencyGroupManager(base.ManagerWithFind):
resource_class = ConsistencyGroup resource_class = ConsistencyGroup
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def create(self, share_network=None, name=None, description=None, def create(self, share_network=None, name=None, description=None,
source_cgsnapshot_id=None, share_types=None): source_cgsnapshot_id=None, share_types=None):
"""Create a Consistency Group. """Create a Consistency Group.
@ -87,6 +88,7 @@ class ConsistencyGroupManager(base.ManagerWithFind):
{RESOURCE_NAME: body}, RESOURCE_NAME) {RESOURCE_NAME: body}, RESOURCE_NAME)
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def get(self, consistency_group): def get(self, consistency_group):
"""Get a consistency group. """Get a consistency group.
@ -99,6 +101,7 @@ class ConsistencyGroupManager(base.ManagerWithFind):
RESOURCE_NAME) RESOURCE_NAME)
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def update(self, consistency_group, **kwargs): def update(self, consistency_group, **kwargs):
"""Updates a consistency group. """Updates a consistency group.
@ -116,6 +119,7 @@ class ConsistencyGroupManager(base.ManagerWithFind):
RESOURCE_NAME) RESOURCE_NAME)
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
@api_versions.experimental_api
def list(self, detailed=True, search_opts=None, def list(self, detailed=True, search_opts=None,
sort_key=None, sort_dir=None): sort_key=None, sort_dir=None):
"""Get a list of all shares. """Get a list of all shares.
@ -159,10 +163,12 @@ class ConsistencyGroupManager(base.ManagerWithFind):
self._delete(url) self._delete(url)
@api_versions.wraps("2.4", "2.6") @api_versions.wraps("2.4", "2.6")
@api_versions.experimental_api
def delete(self, consistency_group, force=False): def delete(self, consistency_group, force=False):
return self._do_delete(consistency_group, force, 'os-force_delete') return self._do_delete(consistency_group, force, 'os-force_delete')
@api_versions.wraps("2.7") # noqa @api_versions.wraps("2.7") # noqa
@api_versions.experimental_api
def delete(self, consistency_group, force=False): def delete(self, consistency_group, force=False):
return self._do_delete(consistency_group, force, 'force_delete') return self._do_delete(consistency_group, force, 'force_delete')
@ -173,11 +179,13 @@ class ConsistencyGroupManager(base.ManagerWithFind):
return self.api.client.post(url, body=body) return self.api.client.post(url, body=body)
@api_versions.wraps("2.4", "2.6") @api_versions.wraps("2.4", "2.6")
@api_versions.experimental_api
def reset_state(self, cg, state): def reset_state(self, cg, state):
return self._do_reset_state( return self._do_reset_state(
consistency_group, state, 'os-reset_status') consistency_group, state, 'os-reset_status')
@api_versions.wraps("2.7") # noqa @api_versions.wraps("2.7") # noqa
@api_versions.experimental_api
def reset_state(self, consistency_group, state): def reset_state(self, consistency_group, state):
return self._do_reset_state(consistency_group, state, 'reset_status') return self._do_reset_state(consistency_group, state, 'reset_status')

View File

@ -51,6 +51,7 @@ class ShareReplicaManager(base.ManagerWithFind):
resource_class = ShareReplica resource_class = ShareReplica
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def get(self, replica): def get(self, replica):
"""Get a share replica. """Get a share replica.
@ -61,6 +62,7 @@ class ShareReplicaManager(base.ManagerWithFind):
return self._get(RESOURCE_PATH % replica_id, RESOURCE_NAME) return self._get(RESOURCE_PATH % replica_id, RESOURCE_NAME)
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def list(self, share=None): def list(self, share=None):
"""List all share replicas or list replicas belonging to a share. """List all share replicas or list replicas belonging to a share.
@ -76,6 +78,7 @@ class ShareReplicaManager(base.ManagerWithFind):
return self._list(RESOURCES_PATH + '/detail', RESOURCES_NAME) return self._list(RESOURCES_PATH + '/detail', RESOURCES_NAME)
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def promote(self, replica): def promote(self, replica):
"""Promote the provided replica. """Promote the provided replica.
@ -84,6 +87,7 @@ class ShareReplicaManager(base.ManagerWithFind):
return self._action('promote', replica) return self._action('promote', replica)
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def create(self, share, availability_zone=None, share_network=None): def create(self, share, availability_zone=None, share_network=None):
"""Create a replica for a share. """Create a replica for a share.
@ -107,6 +111,7 @@ class ShareReplicaManager(base.ManagerWithFind):
RESOURCE_NAME) RESOURCE_NAME)
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def delete(self, replica, force=False): def delete(self, replica, force=False):
"""Delete a replica. """Delete a replica.
@ -116,6 +121,7 @@ class ShareReplicaManager(base.ManagerWithFind):
self._do_delete(replica, force=force) self._do_delete(replica, force=force)
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def reset_state(self, replica, state): def reset_state(self, replica, state):
"""Reset the 'status' attr of the replica. """Reset the 'status' attr of the replica.
@ -125,6 +131,7 @@ class ShareReplicaManager(base.ManagerWithFind):
return self._do_reset_state(replica, state, "reset_status") return self._do_reset_state(replica, state, "reset_status")
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def reset_replica_state(self, replica, state): def reset_replica_state(self, replica, state):
"""Reset the 'replica_state' attr of the replica. """Reset the 'replica_state' attr of the replica.
@ -134,6 +141,7 @@ class ShareReplicaManager(base.ManagerWithFind):
return self._do_reset_state(replica, state, "reset_replica_state") return self._do_reset_state(replica, state, "reset_replica_state")
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def resync(self, replica): def resync(self, replica):
"""Re-sync the provided replica. """Re-sync the provided replica.

View File

@ -162,21 +162,25 @@ class ShareManager(base.ManagerWithFind):
"notify": notify}) "notify": notify})
@api_versions.wraps("2.5", "2.6") @api_versions.wraps("2.5", "2.6")
@api_versions.experimental_api
def migration_start(self, share, host, force_host_copy): def migration_start(self, share, host, force_host_copy):
return self._do_migrate_start( return self._do_migrate_start(
share, host, force_host_copy, True, "os-migrate_share") share, host, force_host_copy, True, "os-migrate_share")
@api_versions.wraps("2.7", "2.14") # noqa @api_versions.wraps("2.7", "2.14") # noqa
@api_versions.experimental_api
def migration_start(self, share, host, force_host_copy): def migration_start(self, share, host, force_host_copy):
return self._do_migrate_start( return self._do_migrate_start(
share, host, force_host_copy, True, "migrate_share") share, host, force_host_copy, True, "migrate_share")
@api_versions.wraps("2.15") # noqa @api_versions.wraps("2.15") # noqa
@api_versions.experimental_api
def migration_start(self, share, host, force_host_copy, notify): def migration_start(self, share, host, force_host_copy, notify):
return self._do_migrate_start( return self._do_migrate_start(
share, host, force_host_copy, notify, "migration_start") share, host, force_host_copy, notify, "migration_start")
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
@api_versions.experimental_api
def reset_task_state(self, share, task_state): def reset_task_state(self, share, task_state):
"""Update the provided share with the provided task state. """Update the provided share with the provided task state.
@ -187,6 +191,7 @@ class ShareManager(base.ManagerWithFind):
{"task_state": task_state}) {"task_state": task_state})
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
@api_versions.experimental_api
def migration_complete(self, share): def migration_complete(self, share):
"""Completes migration for a given share. """Completes migration for a given share.
@ -195,6 +200,7 @@ class ShareManager(base.ManagerWithFind):
return self._action('migration_complete', share) return self._action('migration_complete', share)
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
@api_versions.experimental_api
def migration_cancel(self, share): def migration_cancel(self, share):
"""Attempts to cancel migration for a given share. """Attempts to cancel migration for a given share.
@ -203,6 +209,7 @@ class ShareManager(base.ManagerWithFind):
return self._action('migration_cancel', share) return self._action('migration_cancel', share)
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
@api_versions.experimental_api
def migration_get_progress(self, share): def migration_get_progress(self, share):
"""Obtains progress of share migration for a given share. """Obtains progress of share migration for a given share.

View File

@ -180,7 +180,6 @@ def _print_share_replica(cs, replica):
cliutils.print_dict(info) cliutils.print_dict(info)
@api_versions.experimental_api
@api_versions.wraps("2.4") @api_versions.wraps("2.4")
def _find_consistency_group(cs, consistency_group): def _find_consistency_group(cs, consistency_group):
"""Get a consistency group ID.""" """Get a consistency group ID."""
@ -634,7 +633,6 @@ def do_create(cs, args):
help='Enables or disables generic host-based force-migration, which ' help='Enables or disables generic host-based force-migration, which '
'bypasses driver optimizations. Default=False.', 'bypasses driver optimizations. Default=False.',
default=False) default=False)
@api_versions.experimental_api
@api_versions.wraps("2.5", "2.14") @api_versions.wraps("2.5", "2.14")
def do_migrate(cs, args): def do_migrate(cs, args):
"""(Deprecated) Migrates share to a new host (Admin only, Experimental).""" """(Deprecated) Migrates share to a new host (Admin only, Experimental)."""
@ -667,7 +665,6 @@ def do_migrate(cs, args):
help='Enables or disables notification of data copying completed. ' help='Enables or disables notification of data copying completed. '
'Default=True.', 'Default=True.',
default=True) default=True)
@api_versions.experimental_api
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
def do_migration_start(cs, args): def do_migration_start(cs, args):
"""Migrates share to a new host (Admin only, Experimental).""" """Migrates share to a new host (Admin only, Experimental)."""
@ -679,7 +676,6 @@ def do_migration_start(cs, args):
'share', 'share',
metavar='<share>', metavar='<share>',
help='Name or ID of share to complete migration.') help='Name or ID of share to complete migration.')
@api_versions.experimental_api
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
def do_migration_complete(cs, args): def do_migration_complete(cs, args):
"""Completes migration for a given share (Admin only, Experimental).""" """Completes migration for a given share (Admin only, Experimental)."""
@ -691,7 +687,6 @@ def do_migration_complete(cs, args):
'share', 'share',
metavar='<share>', metavar='<share>',
help='Name or ID of share to cancel migration.') help='Name or ID of share to cancel migration.')
@api_versions.experimental_api
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
def do_migration_cancel(cs, args): def do_migration_cancel(cs, args):
"""Cancels migration of a given share when copying """Cancels migration of a given share when copying
@ -721,7 +716,6 @@ def do_migration_cancel(cs, args):
'data_copying_completing, data_copying_completed, ' 'data_copying_completing, data_copying_completed, '
'data_copying_cancelled, data_copying_error. If no value is ' 'data_copying_cancelled, data_copying_error. If no value is '
'provided, migration_error will be used.')) 'provided, migration_error will be used.'))
@api_versions.experimental_api
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
def do_reset_task_state(cs, args): def do_reset_task_state(cs, args):
"""Explicitly update the task state of a share """Explicitly update the task state of a share
@ -737,7 +731,6 @@ def do_reset_task_state(cs, args):
metavar='<share>', metavar='<share>',
help='Name or ID of the share to get share migration progress ' help='Name or ID of the share to get share migration progress '
'information.') 'information.')
@api_versions.experimental_api
@api_versions.wraps("2.15") @api_versions.wraps("2.15")
def do_migration_get_progress(cs, args): def do_migration_get_progress(cs, args):
"""Gets migration progress of a given share when copying """Gets migration progress of a given share when copying
@ -2857,7 +2850,6 @@ def do_shrink(cs, args):
help='Optional snapshot ID to create the share from. (Default=None)', help='Optional snapshot ID to create the share from. (Default=None)',
default=None) default=None)
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_create(cs, args): def do_cg_create(cs, args):
"""Creates a new consistency group (Experimental).""" """Creates a new consistency group (Experimental)."""
@ -2914,7 +2906,6 @@ def do_cg_create(cs, args):
help='Comma separated list of columns to be displayed ' help='Comma separated list of columns to be displayed '
'e.g. --columns "id,name"') 'e.g. --columns "id,name"')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_list(cs, args): def do_cg_list(cs, args):
"""List consistency groups with filters (Experimental).""" """List consistency groups with filters (Experimental)."""
list_of_keys = [ list_of_keys = [
@ -2942,7 +2933,6 @@ def do_cg_list(cs, args):
metavar='<consistency_group>', metavar='<consistency_group>',
help='Name or ID of the consistency group.') help='Name or ID of the consistency group.')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_show(cs, args): def do_cg_show(cs, args):
"""Show details about a consistency group (Experimental).""" """Show details about a consistency group (Experimental)."""
consistency_group = _find_consistency_group(cs, args.consistency_group) consistency_group = _find_consistency_group(cs, args.consistency_group)
@ -2964,7 +2954,6 @@ def do_cg_show(cs, args):
help='Optional consistency group description. (Default=None)', help='Optional consistency group description. (Default=None)',
default=None) default=None)
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_update(cs, args): def do_cg_update(cs, args):
"""Update a consistency group (Experimental).""" """Update a consistency group (Experimental)."""
kwargs = {} kwargs = {}
@ -2992,7 +2981,6 @@ def do_cg_update(cs, args):
help='Attempt to force delete the consistency group (Default=False)' help='Attempt to force delete the consistency group (Default=False)'
' (Admin only).') ' (Admin only).')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_delete(cs, args): def do_cg_delete(cs, args):
"""Remove one or more consistency groups (Experimental).""" """Remove one or more consistency groups (Experimental)."""
failure_count = 0 failure_count = 0
@ -3028,7 +3016,6 @@ def do_cg_delete(cs, args):
'error_deleting. If no state is provided, ' 'error_deleting. If no state is provided, '
'available will be used.')) 'available will be used.'))
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_reset_state(cs, args): def do_cg_reset_state(cs, args):
"""Explicitly update the state of a consistency group """Explicitly update the state of a consistency group
@ -3053,7 +3040,6 @@ def do_cg_reset_state(cs, args):
help='Optional consistency group snapshot description. (Default=None)', help='Optional consistency group snapshot description. (Default=None)',
default=None) default=None)
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_create(cs, args): def do_cg_snapshot_create(cs, args):
"""Creates a new consistency group snapshot (Experimental).""" """Creates a new consistency group snapshot (Experimental)."""
@ -3109,7 +3095,6 @@ def _split_columns(columns, title=True):
help='Comma separated list of columns to be displayed ' help='Comma separated list of columns to be displayed '
'e.g. --columns "id,name"') 'e.g. --columns "id,name"')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_list(cs, args): def do_cg_snapshot_list(cs, args):
"""List consistency group snapshots with filters (Experimental).""" """List consistency group snapshots with filters (Experimental)."""
list_of_keys = [ list_of_keys = [
@ -3136,7 +3121,6 @@ def do_cg_snapshot_list(cs, args):
metavar='<cg_snapshot>', metavar='<cg_snapshot>',
help='Name or ID of the consistency group snapshot.') help='Name or ID of the consistency group snapshot.')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_show(cs, args): def do_cg_snapshot_show(cs, args):
"""Show details about a consistency group snapshot (Experimental).""" """Show details about a consistency group snapshot (Experimental)."""
cg_snapshot = _find_cg_snapshot(cs, args.cg_snapshot) cg_snapshot = _find_cg_snapshot(cs, args.cg_snapshot)
@ -3156,7 +3140,6 @@ def do_cg_snapshot_show(cs, args):
metavar='<cg_snapshot>', metavar='<cg_snapshot>',
help='Name or ID of the consistency group snapshot.') help='Name or ID of the consistency group snapshot.')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_reset_state(cs, args): def do_cg_snapshot_reset_state(cs, args):
"""Explicitly update the state of a consistency group """Explicitly update the state of a consistency group
@ -3182,7 +3165,6 @@ def do_cg_snapshot_reset_state(cs, args):
metavar='<cg_snapshot>', metavar='<cg_snapshot>',
help='Name or ID of the consistency group snapshot.') help='Name or ID of the consistency group snapshot.')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_members(cs, args): def do_cg_snapshot_members(cs, args):
"""Get member details for a consistency group snapshot (Experimental).""" """Get member details for a consistency group snapshot (Experimental)."""
cg_snapshot = _find_cg_snapshot(cs, args.cg_snapshot) cg_snapshot = _find_cg_snapshot(cs, args.cg_snapshot)
@ -3224,7 +3206,6 @@ def do_cg_snapshot_members(cs, args):
help='Optional cg snapshot description. (Default=None)', help='Optional cg snapshot description. (Default=None)',
default=None) default=None)
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_update(cs, args): def do_cg_snapshot_update(cs, args):
"""Update a consistency group snapshot (Experimental).""" """Update a consistency group snapshot (Experimental)."""
kwargs = {} kwargs = {}
@ -3252,7 +3233,6 @@ def do_cg_snapshot_update(cs, args):
help='Attempt to force delete the cg snapshot(s) (Default=False)' help='Attempt to force delete the cg snapshot(s) (Default=False)'
' (Admin only).') ' (Admin only).')
@cliutils.service_type('sharev2') @cliutils.service_type('sharev2')
@api_versions.experimental_api
def do_cg_snapshot_delete(cs, args): def do_cg_snapshot_delete(cs, args):
"""Remove one or more consistency group snapshots (Experimental).""" """Remove one or more consistency group snapshots (Experimental)."""
failure_count = 0 failure_count = 0
@ -3285,7 +3265,6 @@ def do_cg_snapshot_delete(cs, args):
action='single_alias', action='single_alias',
help='List replicas belonging to share.') help='List replicas belonging to share.')
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_list(cs, args): def do_share_replica_list(cs, args):
"""List share replicas (Experimental).""" """List share replicas (Experimental)."""
share = _find_share(cs, args.share_id) if args.share_id else None share = _find_share(cs, args.share_id) if args.share_id else None
@ -3327,7 +3306,6 @@ def do_share_replica_list(cs, args):
action='single_alias', action='single_alias',
help='Optional network info ID or name.') help='Optional network info ID or name.')
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_create(cs, args): def do_share_replica_create(cs, args):
"""Create a share replica (Experimental).""" """Create a share replica (Experimental)."""
share = _find_share(cs, args.share) share = _find_share(cs, args.share)
@ -3347,7 +3325,6 @@ def do_share_replica_create(cs, args):
metavar='<replica>', metavar='<replica>',
help='ID of the share replica.') help='ID of the share replica.')
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_show(cs, args): def do_share_replica_show(cs, args):
"""Show details about a replica (Experimental).""" """Show details about a replica (Experimental)."""
@ -3368,7 +3345,6 @@ def do_share_replica_show(cs, args):
'this option will purge the replica from Manila even if it ' 'this option will purge the replica from Manila even if it '
'is not cleaned up on the backend. Defaults to False.') 'is not cleaned up on the backend. Defaults to False.')
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_delete(cs, args): def do_share_replica_delete(cs, args):
"""Remove one or more share replicas (Experimental).""" """Remove one or more share replicas (Experimental)."""
failure_count = 0 failure_count = 0
@ -3396,7 +3372,6 @@ def do_share_replica_delete(cs, args):
metavar='<replica>', metavar='<replica>',
help='ID of the share replica.') help='ID of the share replica.')
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_promote(cs, args): def do_share_replica_promote(cs, args):
"""Promote specified replica to 'active' replica_state (Experimental).""" """Promote specified replica to 'active' replica_state (Experimental)."""
replica = _find_share_replica(cs, args.replica) replica = _find_share_replica(cs, args.replica)
@ -3415,7 +3390,6 @@ def do_share_replica_promote(cs, args):
'available, error, creating, deleting, error_deleting. If no ' 'available, error, creating, deleting, error_deleting. If no '
'state is provided, available will be used.')) 'state is provided, available will be used.'))
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_reset_state(cs, args): def do_share_replica_reset_state(cs, args):
"""Explicitly update the 'status' of a share replica (Experimental).""" """Explicitly update the 'status' of a share replica (Experimental)."""
replica = _find_share_replica(cs, args.replica) replica = _find_share_replica(cs, args.replica)
@ -3437,7 +3411,6 @@ def do_share_replica_reset_state(cs, args):
'include in_sync, out_of_sync, active, error. If no ' 'include in_sync, out_of_sync, active, error. If no '
'state is provided, out_of_sync will be used.')) 'state is provided, out_of_sync will be used.'))
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_reset_replica_state(cs, args): def do_share_replica_reset_replica_state(cs, args):
"""Explicitly update the 'replica_state' of a share replica """Explicitly update the 'replica_state' of a share replica
@ -3452,7 +3425,6 @@ def do_share_replica_reset_replica_state(cs, args):
metavar='<replica>', metavar='<replica>',
help='ID of the share replica to resync.') help='ID of the share replica to resync.')
@api_versions.wraps("2.11") @api_versions.wraps("2.11")
@api_versions.experimental_api
def do_share_replica_resync(cs, args): def do_share_replica_resync(cs, args):
"""Attempt to update the share replica with its 'active' mirror """Attempt to update the share replica with its 'active' mirror