Revision 1cb7846c snf-cyclades-app/synnefo/logic/reconciliation.py
b/snf-cyclades-app/synnefo/logic/reconciliation.py | ||
---|---|---|
61 | 61 |
import logging |
62 | 62 |
import itertools |
63 | 63 |
import bitarray |
64 |
from datetime import datetime |
|
64 |
from datetime import datetime, timedelta
|
|
65 | 65 |
|
66 | 66 |
from django.db import transaction |
67 | 67 |
from synnefo.db.models import (Backend, VirtualMachine, Flavor, |
... | ... | |
74 | 74 |
logger = logging.getLogger() |
75 | 75 |
logging.basicConfig() |
76 | 76 |
|
77 |
try: |
|
78 |
CHECK_INTERVAL = settings.RECONCILIATION_CHECK_INTERVAL |
|
79 |
except AttributeError: |
|
80 |
CHECK_INTERVAL = 60 |
|
77 |
BUILDING_NIC_TIMEOUT = timedelta(seconds=120) |
|
81 | 78 |
|
82 | 79 |
GANETI_JOB_ERROR = "error" |
83 | 80 |
GANETI_JOBS_PENDING = ["queued", "waiting", "running", "canceling"] |
... | ... | |
285 | 282 |
server_id) |
286 | 283 |
|
287 | 284 |
def reconcile_unsynced_nics(self, server_id, db_server, gnt_server): |
288 |
building_time = (self.event_time - |
|
289 |
backend_mod.BUILDING_NIC_TIMEOUT) |
|
285 |
building_time = self.event_time - BUILDING_NIC_TIMEOUT |
|
290 | 286 |
db_nics = db_server.nics.exclude(state="BUILD", |
291 | 287 |
created__lte=building_time) \ |
292 | 288 |
.order_by("id") |
Also available in: Unified diff