Merge "Add api_version wraps for some v3 volume APIs"

This commit is contained in:
Zuul 2018-01-31 07:00:25 +00:00 committed by Gerrit Code Review
commit c46785561b
4 changed files with 13 additions and 0 deletions

@ -26,6 +26,7 @@ class VolumeAttachment(base.Resource):
class VolumeAttachmentManager(base.ManagerWithFind):
resource_class = VolumeAttachment
@api_versions.wraps('3.27')
def create(self, volume_id, connector, instance_id):
"""Create a attachment for specified volume."""
body = {'attachment': {'volume_uuid': volume_id,
@ -34,10 +35,12 @@ class VolumeAttachmentManager(base.ManagerWithFind):
retval = self._create('/attachments', body, 'attachment')
return retval.to_dict()
@api_versions.wraps('3.27')
def delete(self, attachment):
"""Delete an attachment by ID."""
return self._delete("/attachments/%s" % base.getid(attachment))
@api_versions.wraps('3.27')
def list(self, detailed=False, search_opts=None, marker=None, limit=None,
sort_key=None, sort_dir=None, sort=None):
"""List all attachments."""
@ -51,6 +54,7 @@ class VolumeAttachmentManager(base.ManagerWithFind):
sort_dir=sort_dir, sort=sort)
return self._list(url, resource_type, limit=limit)
@api_versions.wraps('3.27')
def show(self, id):
"""Attachment show.
@ -61,6 +65,7 @@ class VolumeAttachmentManager(base.ManagerWithFind):
return self.resource_class(self, body['attachment'], loaded=True,
resp=resp)
@api_versions.wraps('3.27')
def update(self, id, connector):
"""Attachment update."""
body = {'attachment': {'connector': connector}}

@ -44,6 +44,7 @@ class GroupSnapshotManager(base.ManagerWithFind):
"""Manage :class:`GroupSnapshot` resources."""
resource_class = GroupSnapshot
@api_versions.wraps('3.14')
def create(self, group_id, name=None, description=None,
user_id=None,
project_id=None):
@ -67,6 +68,7 @@ class GroupSnapshotManager(base.ManagerWithFind):
return self._create('/group_snapshots', body, 'group_snapshot')
@api_versions.wraps('3.14')
def get(self, group_snapshot_id):
"""Get a group snapshot.
@ -86,6 +88,7 @@ class GroupSnapshotManager(base.ManagerWithFind):
body = {'status': state} if state else {}
return self._action('reset_status', group_snapshot, body)
@api_versions.wraps('3.14')
def list(self, detailed=True, search_opts=None):
"""Lists all group snapshots.
@ -102,6 +105,7 @@ class GroupSnapshotManager(base.ManagerWithFind):
return self._list("/group_snapshots%s%s" % (detail, query_string),
"group_snapshots")
@api_versions.wraps('3.14')
def delete(self, group_snapshot):
"""Delete a group_snapshot.
@ -109,6 +113,7 @@ class GroupSnapshotManager(base.ManagerWithFind):
"""
return self._delete("/group_snapshots/%s" % base.getid(group_snapshot))
@api_versions.wraps('3.14')
def update(self, group_snapshot, **kwargs):
"""Update the name or description for a group_snapshot.

@ -151,6 +151,7 @@ class VolumeManager(volumes.VolumeManager):
return self._action('revert', volume,
info={'snapshot_id': base.getid(snapshot.id)})
@api_versions.wraps('3.12')
def summary(self, all_tenants):
"""Get volumes summary."""
url = "/volumes/summary"

@ -16,6 +16,7 @@
"""
Interface to workers API
"""
from cinderclient import api_versions
from cinderclient.apiclient import base as common_base
from cinderclient import base
@ -33,6 +34,7 @@ class Service(base.Resource):
class WorkerManager(base.Manager):
base_url = '/workers'
@api_versions.wraps('3.24')
def clean(self, **filters):
url = self.base_url + '/cleanup'
resp, body = self.api.client.post(url, body=filters)