def delete(self, ip_range): """Deletes floating ips by range.""" admin_context = context.get_admin_context() ips = ({'address': str(address)} for address in self.address_to_hosts(ip_range)) db.floating_ip_bulk_destroy(admin_context, ips)
def update(self, req, id, body): """Bulk delete floating IPs""" context = req.environ["nova.context"] authorize(context) if id != "delete": raise webob.exc.HTTPNotFound("Unknown action") try: ip_range = body["ip_range"] except (TypeError, KeyError): raise webob.exc.HTTPUnprocessableEntity() try: ips = ({"address": str(address)} for address in self._address_to_hosts(ip_range)) except exception.InvalidInput as exc: raise webob.exc.HTTPBadRequest(explanation=str(exc)) db.floating_ip_bulk_destroy(context, ips) return {"floating_ips_bulk_delete": ip_range}
def update(self, req, id, body): """Bulk delete floating IPs.""" context = req.environ['nova.context'] authorize(context) if id != "delete": raise webob.exc.HTTPNotFound("Unknown action") try: ip_range = body['ip_range'] except (TypeError, KeyError): raise webob.exc.HTTPUnprocessableEntity() try: ips = ({'address': str(address)} for address in self._address_to_hosts(ip_range)) except exception.InvalidInput as exc: raise webob.exc.HTTPBadRequest(explanation=str(exc)) db.floating_ip_bulk_destroy(context, ips) return {"floating_ips_bulk_delete": ip_range}
def destroy(cls, context, ips): db.floating_ip_bulk_destroy(context, ips)