Sometimes when we rename a LUN on the array, we should
add some description to record some information like
volume id on cinder side. This patch will enable this.
Closes-Bug: #
1537304
Change-Id: Ib156e61b5b1e305c41426cf5c6001dd44770140c
wwns = self.driver.client.get_online_free_wwns()
self.assertEqual(['1'], wwns)
+ @mock.patch.object(rest_client.RestClient, 'call',
+ return_value={"data": {"ID": 1}, "error": {"code": 0}})
+ def test_rename_lun(self, mock_call):
+ des = 'This LUN is renamed.'
+ new_name = 'test_name'
+ self.driver.client.rename_lun('1', new_name, des)
+ self.assertEqual(1, mock_call.call_count)
+ url = "/lun/1"
+ data = {"NAME": new_name, "DESCRIPTION": des}
+ mock_call.assert_called_once_with(url, data, "PUT")
+
class HuaweiConfTestCase(test.TestCase):
def setUp(self):
LOG.debug("Rename LUN %(old_name)s to %(new_name)s.",
{'old_name': lun_info.get('NAME'),
'new_name': new_name})
- self.client.rename_lun(lun_id, new_name, # pylint: disable=E1121
- description)
+ self.client.rename_lun(lun_id, new_name, description)
model_update = {}
model_update.update({'provider_location': lun_id})
return initiators
- def rename_lun(self, lun_id, new_name):
+ def rename_lun(self, lun_id, new_name, description=None):
url = "/lun/" + lun_id
data = {"NAME": new_name}
+ if description:
+ data.update({"DESCRIPTION": description})
result = self.call(url, data, "PUT")
msg = _('Rename lun on array error.')
self._assert_rest_result(result, msg)