vzmigrate: improve ssh mux master hack

The problem of running 'sleep 3600' as a command to execute by first
ssh session is that sleep stays after vzmigrate is finished, since
terminating ssh itself doesn't lead to terminating what it started
remotely, so that 'sleep 3600' exists on remote host for an hour.
While not a big problem per se, it looks ugly and will cause some
questions.

The other problem is, if vzmigrate will take longer than 1 hour
(say due to very long rsyncs), by the time we start doing live
migration the master ssh connection will break.

To fix both problems, change sleep to echo and sleep 5 wrapped
in an endless loop.

* echo is needed for it to fail once ssh connection is broken
  and stdout is closed, so the loop will be terminated
  (rather than hanging around for too long after vzmigrate
  finishes).

* sleep is needed to not have too much \n traffic

The only downside is every few seconds a useless \n is sent
from remote host to local /dev/null. Should not have any impact.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed