Merge "Fix incorrect use of snapshot instances"

This commit is contained in:
Jenkins 2015-09-01 07:35:27 +00:00 committed by Gerrit Code Review
commit d2b74bdd37
2 changed files with 17 additions and 11 deletions

View File

@ -179,9 +179,10 @@ class V3StorageConnection(driver.HuaweiBase):
def create_snapshot(self, snapshot, share_server=None):
"""Create a snapshot."""
snap_name = snapshot['id']
share_proto = snapshot['share_proto']
share_proto = snapshot['share']['share_proto']
share_name = self.helper._get_share_name_by_id(snapshot['share_id'])
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)
@ -202,7 +203,8 @@ class V3StorageConnection(driver.HuaweiBase):
LOG.debug("Delete a snapshot.")
snap_name = snapshot['id']
share_name = self.helper._get_share_name_by_id(snapshot['share_id'])
share_name = self.helper._get_share_name_by_id(
snapshot['share']['share_id'])
sharefsid = self.helper._get_fsid_by_name(share_name)
if sharefsid is None:

View File

@ -533,24 +533,28 @@ class HuaweiShareDriverTestCase(test.TestCase):
self.nfs_snapshot = {
'id': 'fake_snapshot_uuid',
'share_name': 'share_fake_uuid',
'share_id': 'fake_uuid',
'display_name': 'snapshot',
'name': 'fake_snapshot_name',
'share_size': 1,
'size': 1,
'share_proto': 'NFS',
'share': {
'share_name': 'share_fake_uuid',
'share_id': 'fake_uuid',
'share_size': 1,
'share_proto': 'NFS',
},
}
self.cifs_snapshot = {
'id': 'fake_snapshot_uuid',
'share_name': 'share_fake_uuid',
'share_id': 'fake_uuid',
'display_name': 'snapshot',
'name': 'fake_snapshot_name',
'share_size': 1,
'size': 1,
'share_proto': 'CIFS',
'share': {
'share_name': 'share_fake_uuid',
'share_id': 'fake_uuid',
'share_size': 1,
'share_proto': 'CIFS',
},
}
self.security_service = {