Add find_share() for shared file system share resource
Change-Id: I5e6af38d47735eeb983d06c43ad2f9c9be9a6c15
This commit is contained in:
@@ -33,7 +33,7 @@ service.
|
|||||||
.. autoclass:: openstack.shared_file_system.v2._proxy.Proxy
|
.. autoclass:: openstack.shared_file_system.v2._proxy.Proxy
|
||||||
:noindex:
|
:noindex:
|
||||||
:members: shares, get_share, delete_share, update_share, create_share,
|
:members: shares, get_share, delete_share, update_share, create_share,
|
||||||
revert_share_to_snapshot, resize_share
|
revert_share_to_snapshot, resize_share, find_share
|
||||||
|
|
||||||
|
|
||||||
Shared File System Storage Pools
|
Shared File System Storage Pools
|
||||||
|
@@ -109,6 +109,26 @@ class Proxy(proxy.Proxy):
|
|||||||
base_path = '/shares/detail' if details else None
|
base_path = '/shares/detail' if details else None
|
||||||
return self._list(_share.Share, base_path=base_path, **query)
|
return self._list(_share.Share, base_path=base_path, **query)
|
||||||
|
|
||||||
|
def find_share(self, name_or_id, ignore_missing=True, **query):
|
||||||
|
"""Find a single share
|
||||||
|
|
||||||
|
:param name_or_id: The name or ID of a share.
|
||||||
|
:param bool ignore_missing: When set to ``False``
|
||||||
|
:class:`~openstack.exceptions.ResourceNotFound` will be
|
||||||
|
raised when the resource does not exist.
|
||||||
|
When set to ``True``, None will be returned when
|
||||||
|
attempting to find a nonexistent resource.
|
||||||
|
:param dict query: Any additional parameters to be passed into
|
||||||
|
underlying methods. such as query filters.
|
||||||
|
|
||||||
|
:returns: One :class:`~openstack.shared_file_system.v2.share.Share`
|
||||||
|
or None
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._find(
|
||||||
|
_share.Share, name_or_id, ignore_missing=ignore_missing, **query
|
||||||
|
)
|
||||||
|
|
||||||
def get_share(self, share_id):
|
def get_share(self, share_id):
|
||||||
"""Lists details of a single share
|
"""Lists details of a single share
|
||||||
|
|
||||||
|
@@ -24,9 +24,9 @@ class Share(resource.Resource):
|
|||||||
allow_create = True
|
allow_create = True
|
||||||
allow_fetch = True
|
allow_fetch = True
|
||||||
allow_commit = True
|
allow_commit = True
|
||||||
allow_delete = True
|
|
||||||
allow_list = True
|
allow_list = True
|
||||||
allow_head = False
|
allow_head = False
|
||||||
|
allow_delete = True
|
||||||
|
|
||||||
#: Properties
|
#: Properties
|
||||||
#: The share instance access rules status. A valid value is active,
|
#: The share instance access rules status. A valid value is active,
|
||||||
|
@@ -36,6 +36,11 @@ class ShareTest(base.BaseSharedFileSystemTest):
|
|||||||
assert isinstance(sot, _share.Share)
|
assert isinstance(sot, _share.Share)
|
||||||
self.assertEqual(self.SHARE_ID, sot.id)
|
self.assertEqual(self.SHARE_ID, sot.id)
|
||||||
|
|
||||||
|
def test_find(self):
|
||||||
|
sot = self.user_cloud.share.find_share(name_or_id=self.SHARE_NAME)
|
||||||
|
assert isinstance(sot, _share.Share)
|
||||||
|
self.assertEqual(self.SHARE_ID, sot.id)
|
||||||
|
|
||||||
def test_list_share(self):
|
def test_list_share(self):
|
||||||
shares = self.user_cloud.share.shares(details=False)
|
shares = self.user_cloud.share.shares(details=False)
|
||||||
self.assertGreater(len(list(shares)), 0)
|
self.assertGreater(len(list(shares)), 0)
|
||||||
|
@@ -55,6 +55,9 @@ class TestSharedFileSystemShare(TestSharedFileSystemProxy):
|
|||||||
def test_share_get(self):
|
def test_share_get(self):
|
||||||
self.verify_get(self.proxy.get_share, share.Share)
|
self.verify_get(self.proxy.get_share, share.Share)
|
||||||
|
|
||||||
|
def test_share_find(self):
|
||||||
|
self.verify_find(self.proxy.find_share, share.Share)
|
||||||
|
|
||||||
def test_share_delete(self):
|
def test_share_delete(self):
|
||||||
self.verify_delete(self.proxy.delete_share, share.Share, False)
|
self.verify_delete(self.proxy.delete_share, share.Share, False)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user