Merge "Bump MANILACLIENT_VERSION and use sharev2 endpoint"
This commit is contained in:
commit
b18aadc84d
@ -18,7 +18,7 @@ from manilaclient import client as manila_client
|
|||||||
from manilaclient import exceptions
|
from manilaclient import exceptions
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
MANILACLIENT_VERSION = "2"
|
MANILACLIENT_VERSION = "2.13"
|
||||||
CLIENT_NAME = 'manila'
|
CLIENT_NAME = 'manila'
|
||||||
|
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ class ManilaClientPlugin(client_plugin.ClientPlugin):
|
|||||||
|
|
||||||
exceptions_module = exceptions
|
exceptions_module = exceptions
|
||||||
|
|
||||||
service_types = [SHARE] = ['share']
|
service_types = [SHARE] = ['sharev2']
|
||||||
|
|
||||||
def _create(self):
|
def _create(self):
|
||||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||||
|
@ -192,11 +192,21 @@ class ManilaShare(resource.Resource):
|
|||||||
def _request_share(self):
|
def _request_share(self):
|
||||||
return self.client().shares.get(self.resource_id)
|
return self.client().shares.get(self.resource_id)
|
||||||
|
|
||||||
|
def _request_export_locations(self):
|
||||||
|
# Only return the "path" response parameter, because that is what was
|
||||||
|
# returned before API version "2.9" by the shares endpoint
|
||||||
|
return [export_location.to_dict()['path']
|
||||||
|
for export_location in
|
||||||
|
self.client().share_export_locations.list(self.resource_id)]
|
||||||
|
|
||||||
def _resolve_attribute(self, name):
|
def _resolve_attribute(self, name):
|
||||||
if self.resource_id is None:
|
if self.resource_id is None:
|
||||||
return
|
return
|
||||||
share = self._request_share()
|
if name == self.EXPORT_LOCATIONS_ATTR:
|
||||||
return str(getattr(share, name))
|
attr = self._request_export_locations()
|
||||||
|
else:
|
||||||
|
attr = getattr(self._request_share(), name)
|
||||||
|
return str(attr)
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
# Request IDs of entities from manila
|
# Request IDs of entities from manila
|
||||||
|
@ -46,13 +46,22 @@ class DummyShare(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.availability_zone = 'az'
|
self.availability_zone = 'az'
|
||||||
self.host = 'host'
|
self.host = 'host'
|
||||||
self.export_locations = 'el'
|
|
||||||
self.share_server_id = 'id'
|
self.share_server_id = 'id'
|
||||||
self.created_at = 'ca'
|
self.created_at = 'ca'
|
||||||
self.status = 's'
|
self.status = 's'
|
||||||
self.project_id = 'p_id'
|
self.project_id = 'p_id'
|
||||||
|
|
||||||
|
|
||||||
|
class DummyShareExportLocation(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.export_location = {
|
||||||
|
'path': 'el'
|
||||||
|
}
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return self.export_location
|
||||||
|
|
||||||
|
|
||||||
class ManilaShareTest(common.HeatTestCase):
|
class ManilaShareTest(common.HeatTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -212,9 +221,11 @@ class ManilaShareTest(common.HeatTestCase):
|
|||||||
def test_attributes(self):
|
def test_attributes(self):
|
||||||
share = self._create_share("share")
|
share = self._create_share("share")
|
||||||
share.client().shares.get.return_value = DummyShare()
|
share.client().shares.get.return_value = DummyShare()
|
||||||
|
share.client().share_export_locations.list.return_value = [
|
||||||
|
DummyShareExportLocation()]
|
||||||
self.assertEqual('az', share.FnGetAtt('availability_zone'))
|
self.assertEqual('az', share.FnGetAtt('availability_zone'))
|
||||||
self.assertEqual('host', share.FnGetAtt('host'))
|
self.assertEqual('host', share.FnGetAtt('host'))
|
||||||
self.assertEqual('el', share.FnGetAtt('export_locations'))
|
self.assertEqual("['el']", share.FnGetAtt('export_locations'))
|
||||||
self.assertEqual('id', share.FnGetAtt('share_server_id'))
|
self.assertEqual('id', share.FnGetAtt('share_server_id'))
|
||||||
self.assertEqual('ca', share.FnGetAtt('created_at'))
|
self.assertEqual('ca', share.FnGetAtt('created_at'))
|
||||||
self.assertEqual('s', share.FnGetAtt('status'))
|
self.assertEqual('s', share.FnGetAtt('status'))
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Manila resources now use the 'sharev2' endpoint and API version '2.13'.
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
OS::Manila::Share now properly supports 'cephx' as a value for property
|
||||||
|
'{"access_rules": [{"access_type": ""}]}'.
|
Loading…
x
Reference in New Issue
Block a user