rpc.get_notifier('QoSSpecs').info(context,
'qos_specs.create',
notifier_info)
- except exception.InvalidInput as err:
+ except exception.InvalidQoSSpecs as err:
notifier_err = dict(name=name, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.create',
raise exception.QoSSpecsExists(specs_id=name)
elif name == "555":
raise exception.QoSSpecsCreateFailed(name=id, qos_specs=specs)
+ elif name == "444":
+ raise exception.InvalidQoSSpecs(reason=name)
pass
self.assertEqual(1, notifier.get_notification_count())
self.assertEqual('qos_specs_1', res_dict['qos_specs']['name'])
+ @mock.patch('cinder.volume.qos_specs.create',
+ side_effect=return_qos_specs_create)
+ def test_create_invalid_input(self, mock_qos_get_specs):
+ body = {"qos_specs": {"name": "444",
+ "consumer": "invalid_consumer"}}
+ req = fakes.HTTPRequest.blank('/v2/fake/qos-specs')
+
+ notifier = fake_notifier.get_fake_notifier()
+ with mock.patch('cinder.rpc.get_notifier', return_value=notifier):
+ self.assertRaises(webob.exc.HTTPBadRequest,
+ self.controller.create, req, body)
+ self.assertEqual(1, notifier.get_notification_count())
+
@mock.patch('cinder.volume.qos_specs.create',
side_effect=return_qos_specs_create)
@mock.patch('cinder.volume.qos_specs.get_qos_specs_by_name',