Revision 0196d9a3 snf-cyclades-app/synnefo/api/networks.py

b/snf-cyclades-app/synnefo/api/networks.py
44 44
from synnefo.api import util
45 45
from synnefo.api.actions import network_actions
46 46
from synnefo.api.common import method_not_allowed
47
from synnefo.api.faults import BadRequest, OverLimit, Unauthorized
47
from synnefo.api.faults import (BadRequest, OverLimit,
48
                                Unauthorized, NetworkInUse)
48 49
from synnefo.db.models import Network, Pool, BridgePool, MacPrefixPool
49 50
from synnefo.logic import backend
50 51

  
......
250 251
    if net.public:
251 252
        raise Unauthorized('Can not delete the public network.')
252 253

  
254
    if net.machines.all():  # Nics attached on network
255
        raise NetworkInUse('Machines are connected to network.')
256

  
253 257
    net.action = 'DESTROY'
254 258
    net.save()
255 259

  

Also available in: Unified diff