From 7fb5ac7cd87fa4916b6c4813dcf3a10ad4b89d96 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 10 Dec 2012 14:34:15 +0100
Subject: [PATCH] Improve error message for when adding inotify watcher fails

Explicitely mention the fs.inotify.max_user_watches sysctl value.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/asyncnotifier.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/asyncnotifier.py b/lib/asyncnotifier.py
index 37a2fcbd8..f4b0815fb 100644
--- a/lib/asyncnotifier.py
+++ b/lib/asyncnotifier.py
@@ -109,7 +109,9 @@ class FileEventHandlerBase(pyinotify.ProcessEvent):
 
     ret = result.get(filename, -1)
     if ret <= 0:
-      raise errors.InotifyError("Could not add inotify watcher (%s)" % ret)
+      raise errors.InotifyError("Could not add inotify watcher (error code %s);"
+                                " increasing fs.inotify.max_user_watches sysctl"
+                                " might be necessary" % ret)
 
     return result[filename]
 
-- 
GitLab