Revision 99af08a4 snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py | ||
---|---|---|
108 | 108 |
for bend in backends: |
109 | 109 |
bnet = get_backend_network(network, bend) |
110 | 110 |
if not bnet: |
111 |
# CASE-1: Paritioned network |
|
112 |
if not network.public: |
|
113 |
bnet = reconcile_parted_network(network, bend) |
|
114 |
if not fix: |
|
115 |
continue |
|
116 |
else: |
|
111 |
try: |
|
112 |
gnet = ganeti_networks[bend][network.id] |
|
113 |
if not network.public and network.action != "DESTROY": |
|
114 |
# Network exists in Ganeti backend, but not in DB. |
|
115 |
reconcile_parted_network(network, bend) |
|
116 |
except KeyError: |
|
117 |
# Network does not exist either in DB not in Ganeti. |
|
118 |
# Nothing to reconcile.. |
|
117 | 119 |
continue |
118 | 120 |
|
119 | 121 |
try: |
... | ... | |
201 | 203 |
write("D: Missing Ganeti network %s in backend %s\n" % |
202 | 204 |
(network, backend)) |
203 | 205 |
if fix: |
204 |
backend_mod.create_network(network, [backend])
|
|
206 |
backend_mod.create_network(network, backend)
|
|
205 | 207 |
write("F: Issued OP_NETWORK_CONNECT\n") |
206 | 208 |
|
207 | 209 |
|
... | ... | |
213 | 215 |
for group in hanging_groups: |
214 | 216 |
write('F: Connecting network %s to nodegroup %s\n' |
215 | 217 |
% (network, group)) |
216 |
backend_mod.connect_network(network, backend, group=group) |
|
218 |
backend_mod.connect_network(network, backend, depends=[], |
|
219 |
group=group) |
|
217 | 220 |
|
218 | 221 |
|
219 | 222 |
def reconcile_unsynced_network(network, backend, backend_network): |
... | ... | |
278 | 281 |
try: |
279 | 282 |
network = Network.objects.get(id=net_id) |
280 | 283 |
backend_mod.delete_network(network, |
281 |
backends=[back_end])
|
|
284 |
backend=back_end)
|
|
282 | 285 |
except Network.DoesNotExist: |
283 | 286 |
write("Not entry for network %s in DB !!\n" % net_id) |
284 | 287 |
|
Also available in: Unified diff