def delete(self, req, type_id, id): """Delete encryption specs for a given volume type.""" context = req.environ['cinder.context'] authorize(context) if self._encrypted_type_in_use(context, type_id): expl = _('Cannot delete encryption specs. Volume type in use.') raise webob.exc.HTTPBadRequest(explanation=expl) else: db.volume_type_encryption_delete(context, type_id) return webob.Response(status_int=202)
def delete(self, req, type_id, id): """Delete encryption specs for a given volume type.""" context = req.environ['cinder.context'] authorize(context) if self._encrypted_type_in_use(context, type_id): expl = _('Cannot delete encryption specs. Volume type in use.') raise webob.exc.HTTPBadRequest(explanation=expl) else: # Not found exception will be handled at the wsgi level db.volume_type_encryption_delete(context, type_id) return webob.Response(status_int=http_client.ACCEPTED)
def delete(self, req, type_id, id): """Delete encryption specs for a given volume type.""" context = req.environ['cinder.context'] self._authorize_policy(context, policy.DELETE_ENCRYPTION_POLICY) if self._encrypted_type_in_use(context, type_id): expl = _('Cannot delete encryption specs. Volume type in use.') raise webob.exc.HTTPBadRequest(explanation=expl) else: # Not found exception will be handled at the wsgi level db.volume_type_encryption_delete(context, type_id) return webob.Response(status_int=http_client.ACCEPTED)
def test_volume_type_encryption_delete(self): values = { "cipher": "fake_cipher", "key_size": 256, "provider": "fake_provider", "volume_type_id": "fake_type", "control_location": "front-end", } encryption = db.volume_type_encryption_create(self.ctxt, "fake_type", values) self._assertEqualObjects(values, encryption, self._ignored_keys) db.volume_type_encryption_delete(self.ctxt, encryption["volume_type_id"]) encryption_get = db.volume_type_encryption_get(self.ctxt, encryption["volume_type_id"]) self.assertIsNone(encryption_get)
def test_volume_type_encryption_delete(self): values = { 'cipher': 'fake_cipher', 'key_size': 256, 'provider': 'fake_provider', 'volume_type_id': 'fake_type', 'control_location': 'front-end', } encryption = db.volume_type_encryption_update_or_create( self.ctxt, 'fake_type', values) self._assertEqualObjects(values, encryption, self._ignored_keys) db.volume_type_encryption_delete(self.ctxt, encryption['volume_type_id']) encryption_get = \ db.volume_type_encryption_get(self.ctxt, encryption['volume_type_id']) self.assertIsNone(encryption_get)
def test_volume_type_encryption_delete(self): values = { 'cipher': 'fake_cipher', 'key_size': 256, 'provider': 'fake_provider', 'volume_type_id': 'fake_type', 'control_location': 'front-end', } encryption = db.volume_type_encryption_update_or_create(self.ctxt, 'fake_type', values) self._assertEqualObjects(values, encryption, self._ignored_keys) db.volume_type_encryption_delete(self.ctxt, encryption['volume_type_id']) encryption_get = \ db.volume_type_encryption_get(self.ctxt, encryption['volume_type_id']) self.assertEqual(None, encryption_get)