Revision 2b4becab snf-cyclades-gtools/synnefo/ganeti/eventd.py
b/snf-cyclades-gtools/synnefo/ganeti/eventd.py | ||
---|---|---|
56 | 56 |
from signal import signal, SIGINT, SIGTERM |
57 | 57 |
import setproctitle |
58 | 58 |
|
59 |
from ganeti import utils, jqueue, constants, serializer, cli |
|
59 |
from ganeti import utils, jqueue, constants, serializer, pathutils, cli
|
|
60 | 60 |
from ganeti import errors as ganeti_errors |
61 |
from ganeti.ssconf import SimpleConfigReader
|
|
61 |
from ganeti.ssconf import SimpleStore
|
|
62 | 62 |
|
63 | 63 |
|
64 | 64 |
from synnefo import settings |
... | ... | |
206 | 206 |
return |
207 | 207 |
|
208 | 208 |
data = serializer.LoadJson(data) |
209 |
try: # Compatibility with Ganeti version |
|
210 |
job = jqueue._QueuedJob.Restore(None, data, False) |
|
211 |
except TypeError: |
|
212 |
job = jqueue._QueuedJob.Restore(None, data) |
|
209 |
job = jqueue._QueuedJob.Restore(None, data, False, False) |
|
213 | 210 |
|
214 | 211 |
job_id = int(job.id) |
215 | 212 |
|
... | ... | |
331 | 328 |
def find_cluster_name(): |
332 | 329 |
global handler_logger |
333 | 330 |
try: |
334 |
scr = SimpleConfigReader()
|
|
335 |
name = scr.GetClusterName()
|
|
331 |
ss = SimpleStore()
|
|
332 |
name = ss.GetClusterName()
|
|
336 | 333 |
except Exception as e: |
337 | 334 |
handler_logger.error('Can not get the name of the Cluster: %s' % e) |
338 | 335 |
raise e |
... | ... | |
437 | 434 |
|
438 | 435 |
try: |
439 | 436 |
# Fail if adding the inotify() watch fails for any reason |
440 |
res = wm.add_watch(constants.QUEUE_DIR, mask)
|
|
441 |
if res[constants.QUEUE_DIR] < 0:
|
|
437 |
res = wm.add_watch(pathutils.QUEUE_DIR, mask)
|
|
438 |
if res[pathutils.QUEUE_DIR] < 0:
|
|
442 | 439 |
raise Exception("pyinotify add_watch returned negative descriptor") |
443 | 440 |
|
444 |
logger.info("Now watching %s of %s" % |
|
445 |
(constants.QUEUE_DIR, cluster_name))
|
|
441 |
logger.info("Now watching %s of %s" % (pathutils.QUEUE_DIR,
|
|
442 |
cluster_name)) |
|
446 | 443 |
|
447 | 444 |
while True: # loop forever |
448 | 445 |
# process the queue of events as explained above |
Also available in: Unified diff