VNX: fix issue when backing-up in-use volume
When backing-up an in-use volume, initialize_connection_snapshot did not
return connection information for attaching the snapshot thus causing
below error:
TypeError: 'NoneType' object has no attribute '__getitem__'
This commit fixes above issue.
Change-Id: Ie31a0cfe447aee670018914d379d178933437b8c
Closes-bug: #1693956
(cherry picked from commit 530259db85
)
This commit is contained in:
parent
bccd77a600
commit
e58d89cbff
|
@ -1034,11 +1034,11 @@ class TestCommonAdapter(test.TestCase):
|
||||||
def test_initialize_connection_snapshot(self, common_adapter, mocked_res,
|
def test_initialize_connection_snapshot(self, common_adapter, mocked_res,
|
||||||
mocked_input):
|
mocked_input):
|
||||||
common_adapter.client.attach_snapshot = mock.Mock()
|
common_adapter.client.attach_snapshot = mock.Mock()
|
||||||
common_adapter._initialize_connection = mock.Mock()
|
common_adapter._initialize_connection = mock.Mock(return_value='fake')
|
||||||
|
|
||||||
snapshot = mocked_input['snapshot']
|
snapshot = mocked_input['snapshot']
|
||||||
smp_name = 'tmp-smp-' + snapshot.id
|
smp_name = 'tmp-smp-' + snapshot.id
|
||||||
common_adapter.initialize_connection_snapshot(snapshot, None)
|
conn = common_adapter.initialize_connection_snapshot(snapshot, None)
|
||||||
common_adapter.client.attach_snapshot.assert_called_once_with(
|
common_adapter.client.attach_snapshot.assert_called_once_with(
|
||||||
smp_name, snapshot.name)
|
smp_name, snapshot.name)
|
||||||
lun = mocked_res['lun']
|
lun = mocked_res['lun']
|
||||||
|
@ -1048,6 +1048,7 @@ class TestCommonAdapter(test.TestCase):
|
||||||
called_volume.vnx_lun_id))
|
called_volume.vnx_lun_id))
|
||||||
self.assertIsNone(
|
self.assertIsNone(
|
||||||
common_adapter._initialize_connection.call_args[0][1])
|
common_adapter._initialize_connection.call_args[0][1])
|
||||||
|
self.assertIs(common_adapter._initialize_connection(), conn)
|
||||||
|
|
||||||
@res_mock.mock_driver_input
|
@res_mock.mock_driver_input
|
||||||
@res_mock.patch_common_adapter
|
@res_mock.patch_common_adapter
|
||||||
|
|
|
@ -1118,7 +1118,7 @@ class CommonAdapter(object):
|
||||||
self.client.attach_snapshot(smp_name, snapshot.name)
|
self.client.attach_snapshot(smp_name, snapshot.name)
|
||||||
lun = self.client.get_lun(name=smp_name)
|
lun = self.client.get_lun(name=smp_name)
|
||||||
volume = common.Volume(smp_name, snapshot.id, vnx_lun_id=lun.lun_id)
|
volume = common.Volume(smp_name, snapshot.id, vnx_lun_id=lun.lun_id)
|
||||||
self._initialize_connection(volume, connector)
|
return self._initialize_connection(volume, connector)
|
||||||
|
|
||||||
def terminate_connection_snapshot(self, snapshot, connector, **kwargs):
|
def terminate_connection_snapshot(self, snapshot, connector, **kwargs):
|
||||||
"""Terminates connection for snapshot mount point."""
|
"""Terminates connection for snapshot mount point."""
|
||||||
|
|
Loading…
Reference in New Issue