Fix create snapshot API in Huawei driver
Since "Migrate share" have been merged, The share['id'] is not consistent with share['name']. So can not use 'share_name' in create_share API and use 'share_id' in create_snapshot API at the same time. Now change snapshot['share']['share_id'] to snapshot['share_name'] in create_snapshot API. Change-Id: Ieedda9318762ba2c683788f023a87728d7287504 Closes-Bug: #1494614
This commit is contained in:
parent
b1f06b6b8b
commit
037fc4bbee
|
@ -194,10 +194,9 @@ class V3StorageConnection(driver.HuaweiBase):
|
||||||
snap_name = snapshot['id']
|
snap_name = snapshot['id']
|
||||||
share_proto = snapshot['share']['share_proto']
|
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_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:
|
if not share:
|
||||||
err_msg = _('Can not create snapshot,'
|
err_msg = _('Can not create snapshot,'
|
||||||
|
@ -216,9 +215,7 @@ class V3StorageConnection(driver.HuaweiBase):
|
||||||
LOG.debug("Delete a snapshot.")
|
LOG.debug("Delete a snapshot.")
|
||||||
snap_name = snapshot['id']
|
snap_name = snapshot['id']
|
||||||
|
|
||||||
share_name = self.helper._get_share_name_by_id(
|
sharefsid = self.helper._get_fsid_by_name(snapshot['share_name'])
|
||||||
snapshot['share']['share_id'])
|
|
||||||
sharefsid = self.helper._get_fsid_by_name(share_name)
|
|
||||||
|
|
||||||
if sharefsid is None:
|
if sharefsid is None:
|
||||||
LOG.warning(_LW('Delete snapshot share id %s fs has been '
|
LOG.warning(_LW('Delete snapshot share id %s fs has been '
|
||||||
|
|
|
@ -612,10 +612,6 @@ class RestHelper(object):
|
||||||
share_path = "/" + share_name.replace("-", "_") + "/"
|
share_path = "/" + share_name.replace("-", "_") + "/"
|
||||||
return share_path
|
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):
|
def _get_share_name_by_export_location(self, export_location, share_proto):
|
||||||
export_location_split = None
|
export_location_split = None
|
||||||
share_name = None
|
share_name = None
|
||||||
|
|
|
@ -563,6 +563,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||||
'display_name': 'snapshot',
|
'display_name': 'snapshot',
|
||||||
'name': 'fake_snapshot_name',
|
'name': 'fake_snapshot_name',
|
||||||
'size': 1,
|
'size': 1,
|
||||||
|
'share_name': 'share_fake_uuid',
|
||||||
'share': {
|
'share': {
|
||||||
'share_name': 'share_fake_uuid',
|
'share_name': 'share_fake_uuid',
|
||||||
'share_id': 'fake_uuid',
|
'share_id': 'fake_uuid',
|
||||||
|
@ -576,6 +577,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||||
'display_name': 'snapshot',
|
'display_name': 'snapshot',
|
||||||
'name': 'fake_snapshot_name',
|
'name': 'fake_snapshot_name',
|
||||||
'size': 1,
|
'size': 1,
|
||||||
|
'share_name': 'share_fake_uuid',
|
||||||
'share': {
|
'share': {
|
||||||
'share_name': 'share_fake_uuid',
|
'share_name': 'share_fake_uuid',
|
||||||
'share_id': 'fake_uuid',
|
'share_id': 'fake_uuid',
|
||||||
|
|
Loading…
Reference in New Issue