Revision e3a99a08 db/db_controller.py
b/db/db_controller.py | ||
---|---|---|
30 | 30 |
from threading import Thread, Event, currentThread |
31 | 31 |
|
32 | 32 |
from synnefo.db.models import VirtualMachine |
33 |
from synnefo.logic import utils |
|
33 | 34 |
|
34 | 35 |
GANETI_ZMQ_PUBLISHER = "tcp://62.217.120.67:5801" # FIXME: move to settings.py |
35 | 36 |
|
... | ... | |
65 | 66 |
return |
66 | 67 |
|
67 | 68 |
if msg["type"] != "ganeti-op-status": |
68 |
logging.debug("Ignoring message of uknown type %s." % (msg["type"])) |
|
69 |
logging.debug("Ignoring message of uknown type %s." % (msg["type"],))
|
|
69 | 70 |
continue |
70 | 71 |
|
71 |
vmid = VirtualMachine.id_from_instance_name(msg["instance"])
|
|
72 |
vmid = utils.id_from_instance_name(msg["instance"])
|
|
72 | 73 |
vm = VirtualMachine.objects.get(id=vmid) |
73 | 74 |
|
74 |
logging.debug("Processing msg: %s" % (msg)) |
|
75 |
logging.debug("Processing msg: %s" % (msg,))
|
|
75 | 76 |
vm.process_backend_msg(msg["jobId"], msg["operation"], msg["status"], msg["logmsg"]) |
76 | 77 |
vm.save() |
77 | 78 |
logging.debug("Done processing msg for vm %s." % (msg["instance"])) |
... | ... | |
79 | 80 |
except KeyError: |
80 | 81 |
logging.error("Malformed incoming JSON, missing attributes: " + data) |
81 | 82 |
except VirtualMachine.InvalidBackendIdError: |
82 |
logging.debug("Ignoring msg for unknown instance %s." % msg["instance"])
|
|
83 |
logging.debug("Ignoring msg for unknown instance %s." % (msg["instance"],))
|
|
83 | 84 |
except VirtualMachine.DoesNotExist: |
84 | 85 |
logging.error("VM for instance %s with id %d not found in DB." % (msg["instance"], vmid)) |
85 | 86 |
except Exception as e: |
Also available in: Unified diff