Revision 6e73f499 snf-cyclades-app/synnefo/api/ports.py

b/snf-cyclades-app/synnefo/api/ports.py
218 218
    log.info('delete_port %s', port_id)
219 219
    user_id = request.user_uniq
220 220
    port = util.get_port(port_id, user_id, for_update=True)
221

  
222
    # Deleting port that is connected to a public network is allowed only if
223
    # the port has an associated floating IP address.
224
    if port.network.public and not port.ips.filter(floating_ip=True,
225
                                                   deleted=False).exists():
226
        raise faults.Forbidden("Cannot disconnect from public network.")
227

  
221 228
    servers.delete_port(port)
222 229
    return HttpResponse(status=204)
223 230

  

Also available in: Unified diff