Revision cc92b70f snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py | ||
---|---|---|
42 | 42 |
|
43 | 43 |
from synnefo.settings import PUBLIC_USE_POOL |
44 | 44 |
from django.core.management.base import BaseCommand |
45 |
from django.db import transaction |
|
46 | 45 |
|
47 | 46 |
from synnefo.db.models import Backend, Network, BackendNetwork |
48 | 47 |
from synnefo.db.pools import IPPool |
... | ... | |
76 | 75 |
make_option('--conflicting-ips', action='store_true', |
77 | 76 |
dest='conflicting_ips', default=False, |
78 | 77 |
help='Detect conflicting ips') |
79 |
)
|
|
78 |
) |
|
80 | 79 |
|
81 | 80 |
def handle(self, **options): |
82 | 81 |
global fix, write |
... | ... | |
192 | 191 |
if fix: |
193 | 192 |
etime = datetime.datetime.now() |
194 | 193 |
backend_mod.process_network_status(backend_network, etime, 0, |
195 |
"OP_NETWORK_REMOVE", |
|
196 |
"success", |
|
197 |
"Reconciliation simulated event") |
|
194 |
"OP_NETWORK_REMOVE",
|
|
195 |
"success",
|
|
196 |
"Reconciliation simulated event")
|
|
198 | 197 |
write("F: Reconciled event: OP_NETWORK_REMOVE\n") |
199 | 198 |
|
200 | 199 |
|
... | ... | |
223 | 222 |
write("F: Issuing OP_NETWORK_CONNECT\n") |
224 | 223 |
etime = datetime.datetime.now() |
225 | 224 |
backend_mod.process_network_status(backend_network, etime, 0, |
226 |
"OP_NETWORK_CONNECT", |
|
227 |
"success", |
|
228 |
"Reconciliation simulated eventd") |
|
225 |
"OP_NETWORK_CONNECT",
|
|
226 |
"success",
|
|
227 |
"Reconciliation simulated eventd")
|
|
229 | 228 |
|
230 | 229 |
|
231 | 230 |
def reconcile_ip_pools(network, available_maps, reserved_maps): |
... | ... | |
257 | 256 |
for i in distinct_ips: |
258 | 257 |
ips.remove(i) |
259 | 258 |
for i in ips: |
260 |
machines = [utils.id_to_instance_name(x[1]) \
|
|
259 |
machines = [utils.id_to_instance_name(x[1]) |
|
261 | 260 |
for x in machine_ips if x[0] == i] |
262 | 261 |
write('D: Conflicting IP:%s Machines: %s\n' % |
263 | 262 |
(i, ', '.join(machines))) |
Also available in: Unified diff