Commit fb3fad6c authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Also handle IN_MOVED_TO event in

Also handle the IN_MOVED_TO event from inotify() in,
to work with Ganeti versions >=2.4.2, which write to a temporary file
in the job queue, then rename it immediately.
parent 77517226
......@@ -57,6 +57,9 @@ class JobFileHandler(pyinotify.ProcessEvent):
def process_IN_CLOSE_WRITE(self, event):
def process_IN_MOVED_TO(self, event):
if self.chan == None:
self.chan = self.open_channel()
......@@ -91,7 +94,7 @@ class JobFileHandler(pyinotify.ProcessEvent):
except IndexError:
logmsg = None
self.logger.debug("%d: %s(%s) %s %s",
self.logger.debug("Job: %d: %s(%s) %s %s",
int(, op.input.OP_ID, instances, op.status, logmsg)
# Construct message
......@@ -192,7 +195,8 @@ def main():
# Monitor the Ganeti job queue, create and push notifications
wm = pyinotify.WatchManager()
mask = pyinotify.EventsCodes.ALL_FLAGS["IN_CLOSE_WRITE"]
mask = pyinotify.EventsCodes.ALL_FLAGS["IN_MOVED_TO"] | \
handler = JobFileHandler(logger)
notifier = pyinotify.Notifier(wm, handler)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment