Add snapshot_support property to ShareType

Add new property snapshot_support property to
Manila::ShareType resource.

Change-Id: If72ec0fd3598dba8889dc36b957b5832d1ddaf61
Closes-bug: #1541051
This commit is contained in:
Peter Razumovsky 2016-02-02 21:33:18 +03:00
parent 35b90e3fc5
commit af16d2314f
2 changed files with 15 additions and 4 deletions

View File

@ -33,9 +33,11 @@ class ManilaShareType(resource.Resource):
support_status = support.SupportStatus(version='5.0.0')
PROPERTIES = (
NAME, IS_PUBLIC, DRIVER_HANDLES_SHARE_SERVERS, EXTRA_SPECS
NAME, IS_PUBLIC, DRIVER_HANDLES_SHARE_SERVERS, EXTRA_SPECS,
SNAPSHOT_SUPPORT
) = (
'name', 'is_public', 'driver_handles_share_servers', 'extra_specs'
'name', 'is_public', 'driver_handles_share_servers', 'extra_specs',
'snapshot_support'
)
properties_schema = {
@ -59,6 +61,13 @@ class ManilaShareType(resource.Resource):
properties.Schema.MAP,
_("Extra specs key-value pairs defined for share type."),
update_allowed=True
),
SNAPSHOT_SUPPORT: properties.Schema(
properties.Schema.BOOLEAN,
_('Boolean extra spec that used for filtering of backends by '
'their capability to create share snapshots.'),
support_status=support.SupportStatus(version='6.0.0'),
default=True
)
}
@ -71,7 +80,8 @@ class ManilaShareType(resource.Resource):
name=self.properties.get(self.NAME),
spec_driver_handles_share_servers=self.properties.get(
self.DRIVER_HANDLES_SHARE_SERVERS),
is_public=self.properties.get(self.IS_PUBLIC)
is_public=self.properties.get(self.IS_PUBLIC),
spec_snapshot_support=self.properties.get(self.SNAPSHOT_SUPPORT)
)
self.resource_id_set(share_type.id)
extra_specs = self.properties.get(self.EXTRA_SPECS)

View File

@ -33,6 +33,7 @@ resources:
driver_handles_share_servers: True
extra_specs: {"test":"test"}
is_public: False
snapshot_support: True
"""
@ -75,7 +76,7 @@ class ManilaShareTypeTest(common.HeatTestCase):
self.assertEqual("type_id", share_type.resource_id)
share_type.client().share_types.create.assert_called_once_with(
name="test_share_type", spec_driver_handles_share_servers=True,
is_public=False)
is_public=False, spec_snapshot_support=True)
fake_share_type.set_keys.assert_called_once_with({"test": "test"})
self.assertEqual('share_types', share_type.entity)