From cf7bc890fcdfbcae314603395889f0329b7eb70a Mon Sep 17 00:00:00 2001 From: Ramana Raja Date: Tue, 15 Sep 2015 12:34:08 +0530 Subject: [PATCH] glusterfs: Fix use of ShareSnapshotInstance object Previously, a 'ShareSnapshot' object was passed to the driver's API method by share's manager.py during a create_share_from_snapshot call. Now, a 'ShareSnapshotInstance' object is passed to the driver during the same call. The object no longer has the attribute 'share' used by the driver code, and in it's place has the attribute 'share_instance'. So replace use of 'share' attribute with 'share_instance'. Change-Id: Ibea11b33772f24609f9cd3180d61ab7f6307c1b8 Closes-Bug: #1495382 --- manila/share/drivers/glusterfs/layout_volume.py | 2 +- .../share/drivers/glusterfs/test_layout_volume.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manila/share/drivers/glusterfs/layout_volume.py b/manila/share/drivers/glusterfs/layout_volume.py index 2740f465c2..75c18524ba 100644 --- a/manila/share/drivers/glusterfs/layout_volume.py +++ b/manila/share/drivers/glusterfs/layout_volume.py @@ -445,7 +445,7 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase): def create_share_from_snapshot(self, context, share, snapshot, share_server=None): - old_gmgr = self._share_manager(snapshot['share']) + old_gmgr = self._share_manager(snapshot['share_instance']) # Snapshot clone feature in GlusterFS server essential to support this # API is available in GlusterFS server versions 3.7 and higher. So do diff --git a/manila/tests/share/drivers/glusterfs/test_layout_volume.py b/manila/tests/share/drivers/glusterfs/test_layout_volume.py index 69400a0d41..3cc8a4643b 100644 --- a/manila/tests/share/drivers/glusterfs/test_layout_volume.py +++ b/manila/tests/share/drivers/glusterfs/test_layout_volume.py @@ -687,7 +687,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): share = new_share() snapshot = { 'id': 'fake_snap_id', - 'share': new_share(export_location=glusterfs_target) + 'share_instance': new_share(export_location=glusterfs_target) } volume = ''.join(['manila-', share['id']]) new_export_location = ':/'.join([glusterfs_server, volume]) @@ -721,7 +721,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): ('snapshot', 'clone', volume, 'fake_snap_id_xyz')) old_gmgr.gluster_call.assert_has_calls([mock.call(*a) for a in args]) self._layout._share_manager.assert_called_once_with( - snapshot['share']) + snapshot['share_instance']) self._layout._glustermanager.assert_called_once_with( gmgr.parse(new_export_location)) self._layout.driver._setup_via_manager.assert_called_once_with( @@ -760,7 +760,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): snapshot = { 'id': 'fake_snap_id', - 'share': new_share(export_location=glusterfs_target) + 'share_instance': new_share(export_location=glusterfs_target) } self.assertRaises(exception.GlusterfsException, self._layout.create_share_from_snapshot, @@ -773,7 +773,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): ('snapshot', 'clone', volume, 'fake_snap_id_xyz')) old_gmgr.gluster_call.assert_has_calls([mock.call(*a) for a in args]) self._layout._share_manager.assert_called_once_with( - snapshot['share']) + snapshot['share_instance']) self.assertFalse(new_gmgr.get_gluster_vol_option.called) self.assertFalse(new_gmgr.gluster_call.called) self.assertNotIn(new_export_location, @@ -810,7 +810,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): snapshot = { 'id': 'fake_snap_id', - 'share': new_share(export_location=glusterfs_target) + 'share_instance': new_share(export_location=glusterfs_target) } self.assertRaises(exception.GlusterfsException, self._layout.create_share_from_snapshot, @@ -820,7 +820,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): self._layout._find_actual_backend_snapshot_name.called) self.assertFalse(old_gmgr.gluster_call.called) self._layout._share_manager.assert_called_once_with( - snapshot['share']) + snapshot['share_instance']) self.assertFalse(self._layout._glustermanager.called) self.assertFalse(new_gmgr.get_gluster_vol_option.called) self.assertFalse(new_gmgr.gluster_call.called)