Revision 6eed1ede

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

  
51 52

  
52 53
log = getLogger('synnefo.api')
......
168 169
    if type == 'PUBLIC_ROUTED':
169 170
        raise Unauthorized('Can not create a public network.')
170 171

  
172
    cidr_block = int(subnet.split('/')[1])
173
    if cidr_block <= MAX_CIDR_BLOCK:
174
        raise OverLimit("Network size is to big. Please specify a network"
175
                        " smaller than /" + str(MAX_CIDR_BLOCK) + '.')
171 176

  
172 177
    link, mac_prefix = util.network_specs_from_type(type)
173 178
    if not link:
b/snf-cyclades-app/synnefo/app_settings/default/api.py
21 21
# Network Configuration
22 22
#
23 23

  
24
# Maximum allowed network size for private networks.
25
MAX_CIDR_BLOCK = 22
24 26
# Name of the network in Ganeti corresponding to the default public network.
25 27
# All created VMs will obtain an IP from this network.
26 28
GANETI_PUBLIC_NETWORK = 'snf-net-1'

Also available in: Unified diff