# Test that the retype API works for both available and in-use
self._retype_volume_exec(202)
self.mock_volume_get.return_value['status'] = 'in-use'
- specs = {'qos_specs': {'id': 'fakeqid1', 'consumer': 'back-end'}}
+ specs = {'id': 'fakeqid1', 'name': 'fake_name1',
+ 'consumer': 'back-end', 'specs': {'key1': 'value1'}}
_mock_get_qspecs.return_value = specs
self._retype_volume_exec(202)
def _retype_volume_diff_qos(self, vol_status, consumer, expected_status,
_mock_get_qspecs):
def fake_get_qos(ctxt, qos_id):
- d1 = {'qos_specs': {'id': 'fakeqid1', 'consumer': consumer}}
- d2 = {'qos_specs': {'id': 'fakeqid2', 'consumer': consumer}}
- return d1 if d1['qos_specs']['id'] == qos_id else d2
+ d1 = {'id': 'fakeqid1', 'name': 'fake_name1',
+ 'consumer': consumer, 'specs': {'key1': 'value1'}}
+ d2 = {'id': 'fakeqid2', 'name': 'fake_name2',
+ 'consumer': consumer, 'specs': {'key1': 'value1'}}
+ return d1 if d1['id'] == qos_id else d2
self.mock_volume_get.return_value['status'] = vol_status
_mock_get_qspecs.side_effect = fake_get_qos
for qos_id in [old_vol_type_qos_id, vol_type_qos_id]:
if qos_id:
specs = qos_specs.get_qos_specs(context.elevated(), qos_id)
- if specs['qos_specs']['consumer'] != 'back-end':
+ if specs['consumer'] != 'back-end':
msg = _('Retype cannot change front-end qos specs for '
'in-use volumes')
raise exception.InvalidInput(reason=msg)