[CRIU] [PATCH 2/2] p.haul: use ssh tunneling and controll it with ssh* cmdline opts
Pavel Emelyanov
xemul at parallels.com
Mon Oct 27 11:39:18 PDT 2014
_rpc_proxy_caller(self._rpc_sk, RPC_CMD, "init_rpc")(args)
>>> @@ -51,7 +57,17 @@ class rpc_proxy:
>>>
>>> def _make_sk(self):
>>> sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> - sk.connect((self._srv, rpc_port))
>>> + # ssh tunnel needs some time to start working, so lets
>>> + # make CONNECT_ATTEMPTS attempts to connect.
>> I don't like it. Can you shed more light on what's going on here?
>
> We have no way to check if ssh tunnel is created other than try to connect.
Yes, and AFAIU when you connect to local ssh, it "blocks" the
connection and goes to connect remotely. I don't see the need
in retries.
> But I should have used connection timeout here =). Will fix.
>
>>> + for n in xrange(CONNECT_ATTEMPTS):
>>> + try:
>>> + sk.connect(self._srv)
>>> + except socket.error as e:
>>> + if e.errno != errno.ECONNREFUSED or n == CONNECT_ATTEMPTS - 1:
>>> + raise e
>>> + else:
>>> + continue
>>> + break
>>> host = _rpc_proxy_caller(sk, RPC_CMD, "get_name")()
>>> return (sk, host)
>>>
More information about the CRIU
mailing list