Avoid use of deprecated commands in lenovo driver
Recent firmware updates contain minor syntax changes. This change updates the driver to use the correct syntax based on the firmware version or whether the backend is 'linear' or 'virtual'. Change-Id: I981639cebd054fa758efa565a9a32d71a311a1a9
This commit is contained in:
parent
2a5f80f026
commit
7c707f4205
|
@ -36,6 +36,9 @@ resp_login = '''<RESPONSE><OBJECT basetype="status" name="status" oid="1">
|
|||
<PROPERTY name="response">12a1626754554a21d85040760c81b</PROPERTY>
|
||||
<PROPERTY name="return-code">1</PROPERTY></OBJECT></RESPONSE>'''
|
||||
|
||||
resp_fw_ti = '''<RESPONSE><PROPERTY name="sc-fw">T252R07</PROPERTY>
|
||||
<PROPERTY name="return-code">0</PROPERTY></RESPONSE>'''
|
||||
|
||||
resp_fw = '''<RESPONSE><PROPERTY name="sc-fw">GLS220R001</PROPERTY>
|
||||
<PROPERTY name="return-code">0</PROPERTY></RESPONSE>'''
|
||||
|
||||
|
@ -291,6 +294,25 @@ class TestDotHillClient(test.TestCase):
|
|||
ret = self.client.get_active_iscsi_target_portals()
|
||||
self.assertEqual(portals, ret)
|
||||
|
||||
@mock.patch.object(dothill.DotHillClient, '_request')
|
||||
def test_delete_snapshot(self, mock_request):
|
||||
mock_request.side_effect = [None, None]
|
||||
self.client.delete_snapshot('dummy', 'linear')
|
||||
mock_request.assert_called_with('/delete/snapshot', 'cleanup', 'dummy')
|
||||
self.client.delete_snapshot('dummy', 'paged')
|
||||
mock_request.assert_called_with('/delete/snapshot', 'dummy')
|
||||
|
||||
@mock.patch.object(dothill.DotHillClient, '_request')
|
||||
def test_list_luns_for_host(self, mock_request):
|
||||
mock_request.side_effect = [etree.XML(response_no_lun),
|
||||
etree.XML(response_lun)]
|
||||
self.client._fw = 'T100'
|
||||
self.client.list_luns_for_host('dummy')
|
||||
mock_request.assert_called_with('/show/host-maps', 'dummy')
|
||||
self.client._fw = 'G221'
|
||||
self.client.list_luns_for_host('dummy')
|
||||
mock_request.assert_called_with('/show/maps/initiator', 'dummy')
|
||||
|
||||
|
||||
class FakeConfiguration1(object):
|
||||
dothill_backend_name = 'OpenStack'
|
||||
|
@ -523,7 +545,8 @@ class TestFCDotHillCommon(test.TestCase):
|
|||
self.assertRaises(exception.Invalid, self.common.delete_snapshot,
|
||||
test_snap)
|
||||
self.assertIsNone(self.common.delete_snapshot(test_snap))
|
||||
mock_delete.assert_called_with('sqqqqqqqqqqqqqqqqqqq')
|
||||
mock_delete.assert_called_with('sqqqqqqqqqqqqqqqqqqq',
|
||||
self.common.backend_type)
|
||||
|
||||
@mock.patch.object(dothill.DotHillClient, 'map_volume')
|
||||
def test_map_volume(self, mock_map):
|
||||
|
|
|
@ -287,9 +287,12 @@ class DotHillClient(object):
|
|||
" %s", e.msg)
|
||||
return None
|
||||
|
||||
def delete_snapshot(self, snap_name):
|
||||
def delete_snapshot(self, snap_name, backend_type):
|
||||
try:
|
||||
self._request("/delete/snapshot", "cleanup", snap_name)
|
||||
if backend_type == 'linear':
|
||||
self._request("/delete/snapshot", "cleanup", snap_name)
|
||||
else:
|
||||
self._request("/delete/snapshot", snap_name)
|
||||
except exception.DotHillRequestError as e:
|
||||
# -10050 => The volume was not found on this system.
|
||||
# This can occur during controller failover.
|
||||
|
@ -334,7 +337,10 @@ class DotHillClient(object):
|
|||
return stats
|
||||
|
||||
def list_luns_for_host(self, host):
|
||||
tree = self._request("/show/host-maps", host)
|
||||
if self.is_titanium():
|
||||
tree = self._request("/show/host-maps", host)
|
||||
else:
|
||||
tree = self._request("/show/maps/initiator", host)
|
||||
return [int(prop.text) for prop in tree.xpath(
|
||||
"//PROPERTY[@name='lun']")]
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ class DotHillCommon(object):
|
|||
|
||||
self.client_login()
|
||||
try:
|
||||
self.client.delete_snapshot(snap_name)
|
||||
self.client.delete_snapshot(snap_name, self.backend_type)
|
||||
except exception.DotHillRequestError as ex:
|
||||
# if the volume wasn't found, ignore the error
|
||||
if 'The volume was not found on this system.' in ex.args:
|
||||
|
|
Loading…
Reference in New Issue