Commit 68da0e52 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Do not release externally reserved IPs

Do not automatically release an externally reserved IP if it is released
from a Ganeti backend. The IP should be released with snf-manage
network-modify management commands.
parent 182a1fd2
......@@ -415,7 +415,7 @@ def update_network_state(network):
@transaction.commit_on_success
def process_network_modify(back_network, etime, jobid, opcode, status,
add_reserved_ips, remove_reserved_ips):
add_reserved_ips):
assert (opcode == "OP_NETWORK_SET_PARAMS")
if status not in [x[0] for x in BACKEND_STATUSES]:
raise Network.InvalidBackendMsgError(opcode, status)
......@@ -424,15 +424,12 @@ def process_network_modify(back_network, etime, jobid, opcode, status,
back_network.backendjobstatus = status
back_network.opcode = opcode
if add_reserved_ips or remove_reserved_ips:
if add_reserved_ips:
net = back_network.network
pool = net.get_pool()
if add_reserved_ips:
for ip in add_reserved_ips:
pool.reserve(ip, external=True)
if remove_reserved_ips:
for ip in remove_reserved_ips:
pool.put(ip, external=True)
pool.save()
if status == 'success':
......
......@@ -198,8 +198,7 @@ def update_network(network, msg, event_time):
if opcode == "OP_NETWORK_SET_PARAMS":
backend_mod.process_network_modify(network, event_time, jobid, opcode,
status, msg['add_reserved_ips'],
msg['remove_reserved_ips'])
status, msg['add_reserved_ips'])
else:
backend_mod.process_network_status(network, event_time, jobid, opcode,
status, msg['logmsg'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment