Merge "Fix huawei driver cannot delete qos while status is idle"
This commit is contained in:
commit
77d245618f
@ -20,7 +20,10 @@ STATUS_FSSNAPSHOT_HEALTH = '1'
|
||||
STATUS_JOIN_DOMAIN = '1'
|
||||
STATUS_EXIT_DOMAIN = '0'
|
||||
STATUS_SERVICE_RUNNING = "2"
|
||||
STATUS_QOS_ACTIVE = '2'
|
||||
|
||||
QOS_STATUSES = (STATUS_QOS_ACTIVE,
|
||||
STATUS_QOS_INACTIVATED,
|
||||
STATUS_QOS_IDLE) = ('2', '45', '46')
|
||||
|
||||
DEFAULT_WAIT_INTERVAL = 3
|
||||
DEFAULT_TIMEOUT = 60
|
||||
|
@ -95,7 +95,7 @@ class SmartQos(object):
|
||||
def delete_qos(self, qos_id):
|
||||
qos_info = self.helper.get_qos_info(qos_id)
|
||||
qos_status = qos_info['RUNNINGSTATUS']
|
||||
if qos_status == constants.STATUS_QOS_ACTIVE:
|
||||
if qos_status != constants.STATUS_QOS_INACTIVATED:
|
||||
self.helper.activate_deactivate_qos(qos_id, False)
|
||||
self.helper.delete_qos_policy(qos_id)
|
||||
|
||||
|
@ -4458,3 +4458,27 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||
'fake_pair_id')
|
||||
|
||||
self.assertEqual(expected_state, result_state)
|
||||
|
||||
@ddt.data(*constants.QOS_STATUSES)
|
||||
def test_delete_qos(self, qos_status):
|
||||
self.driver.plugin.helper.custom_results['/ioclass/11'] = {
|
||||
"GET": """{"error":{"code":0}, "data":{"RUNNINGSTATUS": "%s"}}""" %
|
||||
qos_status
|
||||
}
|
||||
|
||||
activate_deactivate_qos_mock = self.mock_object(
|
||||
self.driver.plugin.helper,
|
||||
'activate_deactivate_qos')
|
||||
delete_qos_mock = self.mock_object(
|
||||
self.driver.plugin.helper,
|
||||
'delete_qos_policy')
|
||||
|
||||
qos = smartx.SmartQos(self.driver.plugin.helper)
|
||||
qos.delete_qos('11')
|
||||
|
||||
if qos_status == constants.STATUS_QOS_INACTIVATED:
|
||||
activate_deactivate_qos_mock.assert_not_called()
|
||||
else:
|
||||
activate_deactivate_qos_mock.assert_called_once_with('11', False)
|
||||
|
||||
delete_qos_mock.assert_called_once_with('11')
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Fixed qos deletion failing in huawei driver when qos status is 'idle'
|
||||
by deactivating it first.
|
Loading…
Reference in New Issue
Block a user