Revision 5e1d07d4
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, Unauthorized, |
|
47 |
from synnefo.api.faults import (ServiceUnavailable, BadRequest, Unauthorized,
|
|
48 | 48 |
NetworkInUse, OverLimit) |
49 | 49 |
from synnefo.db.models import Network |
50 | 50 |
from synnefo.db.pools import EmptyPool |
... | ... | |
202 | 202 |
action='CREATE', |
203 | 203 |
state='PENDING') |
204 | 204 |
except EmptyPool: |
205 |
raise OverLimit('Network count limit exceeded.') |
|
205 |
log.error("Failed to allocate resources for network of type: %s", |
|
206 |
net_type) |
|
207 |
raise ServiceUnavailable("Failed to allocate resources for network") |
|
206 | 208 |
|
207 | 209 |
# Create BackendNetwork entries for each Backend |
208 | 210 |
network.create_backend_network() |
b/snf-cyclades-app/synnefo/api/servers.py | ||
---|---|---|
261 | 261 |
|
262 | 262 |
if backend is None: |
263 | 263 |
log.error("No available backends for VM with flavor %s", flavor) |
264 |
raise Exception("No available backends")
|
|
264 |
raise faults.ServiceUnavailable("No available backends")
|
|
265 | 265 |
except: |
266 | 266 |
transaction.rollback() |
267 | 267 |
raise |
... | ... | |
273 | 273 |
(network, address) = util.allocate_public_address(backend) |
274 | 274 |
if address is None: |
275 | 275 |
log.error("Public networks of backend %s are full", backend) |
276 |
raise faults.OverLimit("Can not allocate IP for new machine."
|
|
277 |
" Public networks are full.")
|
|
276 |
msg = "Failed to allocate public IP for new VM"
|
|
277 |
raise faults.ServiceUnavailable(msg)
|
|
278 | 278 |
nic = {'ip': address, 'network': network.backend_id} |
279 | 279 |
else: |
280 | 280 |
network = choice(list(util.backend_public_networks(backend))) |
Also available in: Unified diff