Merge "Use Share Instance ID in 'name' property"
This commit is contained in:
commit
1faf8ea70f
|
@ -267,8 +267,8 @@ class Share(BASE, ManilaBase):
|
|||
class ShareInstance(BASE, ManilaBase):
|
||||
__tablename__ = 'share_instances'
|
||||
|
||||
_extra_keys = ['export_location', 'availability_zone']
|
||||
_proxified_properties = ('name', 'user_id', 'project_id', 'size',
|
||||
_extra_keys = ['name', 'export_location', 'availability_zone']
|
||||
_proxified_properties = ('user_id', 'project_id', 'size',
|
||||
'display_name', 'display_description',
|
||||
'snapshot_id', 'share_proto', 'share_type_id',
|
||||
'is_public')
|
||||
|
@ -277,6 +277,10 @@ class ShareInstance(BASE, ManilaBase):
|
|||
for share_property in self._proxified_properties:
|
||||
setattr(self, share_property, share[share_property])
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return CONF.share_name_template % self.id
|
||||
|
||||
@property
|
||||
def export_location(self):
|
||||
if len(self.export_locations) > 0:
|
||||
|
|
|
@ -186,6 +186,13 @@ class ShareDatabaseAPITestCase(test.TestCase):
|
|||
self.assertRaises(exception.NotFound, db_api.share_get,
|
||||
self.ctxt, share['id'])
|
||||
|
||||
def test_share_instance_get(self):
|
||||
share = db_utils.create_share()
|
||||
|
||||
instance = db_api.share_instance_get(self.ctxt, share.instance['id'])
|
||||
|
||||
self.assertEqual('share-%s' % instance['id'], instance['name'])
|
||||
|
||||
@ddt.data('host')
|
||||
def test_share_get_all_sort_by_share_instance_fields(self, sort_key):
|
||||
shares = [db_utils.create_share(**{sort_key: n, 'size': 1})
|
||||
|
|
Loading…
Reference in New Issue