Revision 8d5795b4 snf-cyclades-app/synnefo/logic/ips.py
b/snf-cyclades-app/synnefo/logic/ips.py | ||
---|---|---|
44 | 44 |
def allocate_ip(network, userid, address=None, floating_ip=False): |
45 | 45 |
"""Try to allocate an IP from networks IP pools.""" |
46 | 46 |
if network.action == "DESTROY": |
47 |
raise faults.Conflict("Can not allocate IP. Network %s is being"
|
|
47 |
raise faults.Conflict("Cannot allocate IP. Network %s is being" |
|
48 | 48 |
" deleted" % network.id) |
49 | 49 |
ip_pools = IPPoolTable.objects.select_for_update()\ |
50 | 50 |
.filter(subnet__network=network) |
... | ... | |
100 | 100 |
if backend is not None: |
101 | 101 |
log_msg += " Backend: %s" % backend |
102 | 102 |
log.error(log_msg) |
103 |
exception_msg = "Can not allocate a %s IP address." % ip_type
|
|
103 |
exception_msg = "Cannot allocate a %s IP address." % ip_type |
|
104 | 104 |
raise faults.Conflict(exception_msg) |
105 | 105 |
|
106 | 106 |
|
... | ... | |
110 | 110 |
floating_ip = allocate_public_ip(userid, floating_ip=True) |
111 | 111 |
else: |
112 | 112 |
if not network.floating_ip_pool: |
113 |
msg = ("Can not allocate floating IP. Network %s is"
|
|
113 |
msg = ("Cannot allocate floating IP. Network %s is" |
|
114 | 114 |
" not a floating IP pool.") |
115 | 115 |
raise faults.Conflict(msg % network.id) |
116 | 116 |
if network.action == "DESTROY": |
117 |
msg = "Can not allocate floating IP. Network %s is being deleted."
|
|
117 |
msg = "Cannot allocate floating IP. Network %s is being deleted." |
|
118 | 118 |
raise faults.Conflict(msg % network.id) |
119 | 119 |
|
120 | 120 |
# Allocate the floating IP |
Also available in: Unified diff