def delete(self, req, type_id, id): """ Deletes an existing extra spec """ context = req.environ['cinder.context'] self._check_type(context, type_id) authorize(context) db.volume_type_extra_specs_delete(context, type_id, id) return webob.Response(status_int=202)
def test_volume_type_extra_specs_delete(self): expected_specs = self.vol_type1_specs.copy() del expected_specs['vol_extra2'] db.volume_type_extra_specs_delete(context.get_admin_context(), self.volume_type1_id, 'vol_extra2') actual_specs = db.volume_type_extra_specs_get( context.get_admin_context(), self.volume_type1_id) self.assertEquals(expected_specs, actual_specs)
def test_volume_type_extra_specs_delete(self): expected_specs = self.vol_type1_specs.copy() del expected_specs['vol_extra2'] db.volume_type_extra_specs_delete(context.get_admin_context(), self.volume_type1_id, 'vol_extra2') actual_specs = db.volume_type_extra_specs_get( context.get_admin_context(), self.volume_type1_id) self.assertEqual(expected_specs, actual_specs)
def delete(self, req, type_id, id): """ Deletes an existing extra spec """ context = req.environ['cinder.context'] self._check_type(context, type_id) authorize(context) db.volume_type_extra_specs_delete(context, type_id, id) notifier_info = dict(type_id=type_id, id=id) notifier_api.notify(context, 'volumeTypeExtraSpecs', 'volume_type_extra_specs.delete', notifier_api.INFO, notifier_info) return webob.Response(status_int=202)
def delete(self, req, type_id, id): """Deletes an existing extra spec.""" context = req.environ['cinder.context'] self._check_type(context, type_id) authorize(context) self._allow_update(context, type_id) # Not found exception will be handled at the wsgi level db.volume_type_extra_specs_delete(context, type_id, id) notifier_info = dict(type_id=type_id, id=id) notifier = rpc.get_notifier('volumeTypeExtraSpecs') notifier.info(context, 'volume_type_extra_specs.delete', notifier_info) return webob.Response(status_int=http_client.ACCEPTED)
def delete(self, req, type_id, id): """Deletes an existing extra spec.""" context = req.environ['cinder.context'] self._check_type(context, type_id) authorize(context) try: db.volume_type_extra_specs_delete(context, type_id, id) except exception.VolumeTypeExtraSpecsNotFound as error: raise webob.exc.HTTPNotFound(explanation=error.msg) notifier_info = dict(type_id=type_id, id=id) notifier = rpc.get_notifier('volumeTypeExtraSpecs') notifier.info(context, 'volume_type_extra_specs.delete', notifier_info) return webob.Response(status_int=202)
def delete(self, req, type_id, id): """Deletes an existing extra spec.""" context = req.environ['cinder.context'] self._check_type(context, type_id) authorize(context) # Not found exception will be handled at the wsgi level db.volume_type_extra_specs_delete(context, type_id, id) notifier_info = dict(type_id=type_id, id=id) notifier = rpc.get_notifier('volumeTypeExtraSpecs') notifier.info(context, 'volume_type_extra_specs.delete', notifier_info) return webob.Response(status_int=202)
def delete(self, req, type_id, id): """Deletes an existing extra spec.""" context = req.environ["cinder.context"] self._check_type(context, type_id) authorize(context) try: db.volume_type_extra_specs_delete(context, type_id, id) except exception.VolumeTypeExtraSpecsNotFound as error: raise webob.exc.HTTPNotFound(explanation=error.msg) notifier_info = dict(type_id=type_id, id=id) notifier = rpc.get_notifier("volumeTypeExtraSpecs") notifier.info(context, "volume_type_extra_specs.delete", notifier_info) return webob.Response(status_int=202)
def delete(self, req, type_id, id): """ Deletes an existing extra spec """ context = req.environ['cinder.context'] self._check_type(context, type_id) authorize(context) try: db.volume_type_extra_specs_delete(context, type_id, id) except exception.VolumeTypeExtraSpecsNotFound as error: raise webob.exc.HTTPNotFound(explanation=unicode(error)) notifier_info = dict(type_id=type_id, id=id) notifier_api.notify(context, 'volumeTypeExtraSpecs', 'volume_type_extra_specs.delete', notifier_api.INFO, notifier_info) return webob.Response(status_int=202)
def delete(self, req, type_id, id): """Deletes an existing extra spec.""" context = req.environ['cinder.context'] self._check_type(context, type_id) context.authorize(policy.DELETE_POLICY) self._allow_update(context, type_id) # Not found exception will be handled at the wsgi level db.volume_type_extra_specs_delete(context, type_id, id) # Get created_at and updated_at for notification volume_type = volume_types.get_volume_type(context, type_id) notifier_info = dict(type_id=type_id, id=id, created_at=volume_type['created_at'], updated_at=volume_type['updated_at'], deleted_at=volume_type['deleted_at']) notifier = rpc.get_notifier('volumeTypeExtraSpecs') notifier.info(context, 'volume_type_extra_specs.delete', notifier_info)