Beispiel #1
0
    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)
Beispiel #2
0
    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}
Beispiel #3
0
    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}
Beispiel #4
0
 def destroy(cls, context, ips):
     db.floating_ip_bulk_destroy(context, ips)
Beispiel #5
0
 def destroy(cls, context, ips):
     db.floating_ip_bulk_destroy(context, ips)