Merge "Fix create snapshot API in Huawei driver"

This commit is contained in:
Jenkins 2015-09-12 00:25:57 +00:00 committed by Gerrit Code Review
commit 6c70839cfd
3 changed files with 5 additions and 10 deletions

View File

@ -192,10 +192,9 @@ class V3StorageConnection(driver.HuaweiBase):
snap_name = snapshot['id']
share_proto = snapshot['share']['share_proto']
share_name = self.helper._get_share_name_by_id(
snapshot['share']['share_id'])
share_url_type = self.helper._get_share_url_type(share_proto)
share = self.helper._get_share_by_name(share_name, share_url_type)
share = self.helper._get_share_by_name(snapshot['share_name'],
share_url_type)
if not share:
err_msg = _('Can not create snapshot,'
@ -214,9 +213,7 @@ class V3StorageConnection(driver.HuaweiBase):
LOG.debug("Delete a snapshot.")
snap_name = snapshot['id']
share_name = self.helper._get_share_name_by_id(
snapshot['share']['share_id'])
sharefsid = self.helper._get_fsid_by_name(share_name)
sharefsid = self.helper._get_fsid_by_name(snapshot['share_name'])
if sharefsid is None:
LOG.warning(_LW('Delete snapshot share id %s fs has been '

View File

@ -612,10 +612,6 @@ class RestHelper(object):
share_path = "/" + share_name.replace("-", "_") + "/"
return share_path
def _get_share_name_by_id(self, share_id):
share_name = "share_" + share_id
return share_name
def _get_share_name_by_export_location(self, export_location, share_proto):
export_location_split = None
share_name = None

View File

@ -563,6 +563,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
'display_name': 'snapshot',
'name': 'fake_snapshot_name',
'size': 1,
'share_name': 'share_fake_uuid',
'share': {
'share_name': 'share_fake_uuid',
'share_id': 'fake_uuid',
@ -576,6 +577,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
'display_name': 'snapshot',
'name': 'fake_snapshot_name',
'size': 1,
'share_name': 'share_fake_uuid',
'share': {
'share_name': 'share_fake_uuid',
'share_id': 'fake_uuid',