import-export: Improve timeout error reporting
authorMichael Hanselmann <hansmi@google.com>
Thu, 6 Jan 2011 16:36:38 +0000 (17:36 +0100)
committerMichael Hanselmann <hansmi@google.com>
Thu, 6 Jan 2011 16:42:08 +0000 (17:42 +0100)
When the source cluster takes too long to create a snapshot, the
destination would time out. Unfortunately no good error message was
written unless debug logging was enabled, not even to the log file. This
will be improved with this patch.

Another patch to be backported from master will hopefully avoid this
situation completely.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

daemons/import-export

index ce9c3bd..d8a508f 100755 (executable)
@@ -271,10 +271,16 @@ def ProcessChildIO(child, socat_stderr_read_fd, dd_stderr_read_fd,
       timeout = None
 
       if listen_timeout and not exit_timeout:
+        assert mode == constants.IEM_IMPORT and options.connect_timeout
         if status_file.GetConnected():
           listen_timeout = None
         elif listen_timeout.Remaining() < 0:
-          logging.info("Child process didn't establish connection in time")
+          errmsg = ("Child process didn't establish connection in time"
+                    " (%0.0fs), sending SIGTERM" % options.connect_timeout)
+          logging.error(errmsg)
+          status_file.AddRecentOutput(errmsg)
+          status_file.Update(True)
+
           child.Kill(signal.SIGTERM)
           exit_timeout = \
             locking.RunningTimeout(CHILD_LINGER_TIMEOUT, True)