<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Helvetica, Arial, sans-serif">Hi Andrei and Rodrigo,<br>
      <br>
      I would be happy to help finishing the criu --remote work and
      complete the Image cache/proxy TODO list [1].<br>
      Rodrigo would you be able to send the patches for single thread
      model to the mailing list?<br>
      <br>
      [1] <a class="moz-txt-link-freetext" href="https://criu.org/Image_cache/proxy_TODO">https://criu.org/Image_cache/proxy_TODO</a><br>
      <br>
      --<br>
      Radostin<br>
    </font><br>
    <div class="moz-cite-prefix">On 10/05/18 10:05, Rodrigo Bruno wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADy33kCmb3LaE8W_CeJ0EMDPEK6byp1pfsZ_e18GZZr=+VOuOw@mail.gmail.com">
      <div dir="ltr">Hi Andrei and Radostin,
        <div><br>
        </div>
        <div>in our last iteration, I sent to Andei a patch to rework
          the cache-proxy code to be single threaded.</div>
        <div><br>
        </div>
        <div>Is it possible to merge that patch into CRIU dev?</div>
        <div><br>
        </div>
        <div>I think it would be easy this way because we would be then
          working on small code changes to fix bugs related to tests
          failing.</div>
        <div><br>
        </div>
        <div>I would be able to help fixing the implementation.</div>
        <div><br>
        </div>
        <div>best,</div>
        <div>rodrigo</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2018-05-10 2:10 GMT+01:00 Andrei Vagin
          <span dir="ltr">&lt;<a href="mailto:avagin@virtuozzo.com"
              target="_blank" moz-do-not-send="true">avagin@virtuozzo.com</a>&gt;</span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
            Radostin,<br>
            <br>
            Should we run this test in scripts/travis/travis-tests?<br>
            <br>
            Rodrigo has patches, which reworks image proxy &amp; cache
            to a single<br>
            thread model. These patches are mostly ready to be merged,
            but need<br>
            some work.<br>
            <br>
            Would it be interesting for you to finish criu --remote,
            that we could<br>
            merge it into the master branch?<br>
            <br>
            For that, all tests have to pass, and image and cache have
            to<br>
            be single-thread processes.<br>
            <br>
            There is one inline comment.<br>
            <br>
            On Mon, Feb 12, 2018 at 10:54:05AM +0000, Radostin Stoyanov
            wrote:<br>
            &gt; Signed-off-by: Radostin Stoyanov &lt;<a
              href="mailto:rstoyanov1@gmail.com" moz-do-not-send="true">rstoyanov1@gmail.com</a>&gt;<br>
            &gt; ---<br>
            &gt;  test/others/rpc/remote.py | 86
            ++++++++++++++++++++++++++++++<wbr>+++++++++++++++++<br>
            &gt;  test/others/rpc/run.sh    | 26 ++++++++++++++<br>
            &gt;  2 files changed, 112 insertions(+)<br>
            &gt;  create mode 100644 test/others/rpc/remote.py<br>
            &gt; <br>
            &gt; diff --git a/test/others/rpc/remote.py
            b/test/others/rpc/remote.py<br>
            &gt; new file mode 100644<br>
            &gt; index 00000000..96ce3e21<br>
            &gt; --- /dev/null<br>
            &gt; +++ b/test/others/rpc/remote.py<br>
            &gt; @@ -0,0 +1,86 @@<br>
            &gt; +#!/usr/bin/env python2<br>
            &gt; +<br>
            &gt; +import socket, os, imp, sys, errno, signal<br>
            &gt; +import rpc_pb2 as rpc<br>
            &gt; +import argparse<br>
            &gt; +<br>
            &gt; +MAX_MSG_SIZE = 1024<br>
            &gt; +<br>
            &gt; +parser = argparse.ArgumentParser(<wbr>description="Test
            --remote option using CRIU RPC")<br>
            &gt; +parser.add_argument('socket', type = str, help = "CRIU
            service socket")<br>
            &gt; +parser.add_argument('dir', type = str, help =
            "Directory where CRIU images should be placed")<br>
            &gt; +parser.add_argument('pid', type = int, help = "PID of
            process to be dumped")<br>
            &gt; +<br>
            &gt; +args = vars(parser.parse_args())<br>
            &gt; +<br>
            &gt; +# Connect to RPC socket<br>
            &gt; +s = socket.socket(socket.AF_UNIX,
            socket.SOCK_SEQPACKET)<br>
            &gt; +s.connect(args['socket'])<br>
            &gt; +<br>
            &gt; +# Open images-dir<br>
            &gt; +dir_fd = os.open(args['dir'], os.O_DIRECTORY)<br>
            &gt; +if dir_fd &lt; 0:<br>
            &gt; +     print "Failed to open dir %s" % args['dir']<br>
            &gt; +     sys.exit(-1)<br>
            &gt; +<br>
            &gt; +# Prepare dump request<br>
            &gt; +req = rpc.criu_req()<br>
            &gt; +req.type = rpc.DUMP<br>
            &gt; +req.opts.remote      = True<br>
            &gt; +req.opts.log_level = 4<br>
            &gt; +req.opts.pid = args['pid']<br>
            &gt; +req.opts.images_dir_fd       = dir_fd<br>
            &gt; +<br>
            &gt; +# Send dump request<br>
            &gt; +s.send(req.SerializeToString(<wbr>))<br>
            &gt; +<br>
            &gt; +# Receive responce<br>
            &gt; +resp = rpc.criu_resp()<br>
            &gt; +resp.ParseFromString(s.recv(<wbr>MAX_MSG_SIZE))<br>
            &gt; +<br>
            &gt; +# Reconnect to RPC socket<br>
            &gt; +s.close()<br>
            &gt; +s = socket.socket(socket.AF_UNIX,
            socket.SOCK_SEQPACKET)<br>
            &gt; +s.connect(args['socket'])<br>
            &gt; +<br>
            &gt; +<br>
            &gt; +if resp.type != rpc.DUMP:<br>
            &gt; +     print 'Unexpected dump msg type'<br>
            &gt; +     sys.exit(-1)<br>
            &gt; +else:<br>
            &gt; +     if resp.success:<br>
            &gt; +             print 'Dump Success'<br>
            &gt; +     else:<br>
            &gt; +             print 'Dump Fail'<br>
            &gt; +             sys.exit(-1)<br>
            &gt; +<br>
            &gt; +req                  = rpc.criu_req()<br>
            &gt; +req.type             = rpc.RESTORE<br>
            &gt; +req.opts.remote      = True<br>
            &gt; +req.opts.log_level = 4<br>
            &gt; +req.opts.images_dir_fd       = dir_fd<br>
            &gt; +<br>
            &gt; +# Send restore request<br>
            &gt; +s.send(req.SerializeToString(<wbr>))<br>
            &gt; +<br>
            &gt; +# Receive response<br>
            &gt; +resp         = rpc.criu_resp()<br>
            &gt; +resp.ParseFromString(s.recv(<wbr>MAX_MSG_SIZE))<br>
            &gt; +<br>
            &gt; +# Close RPC socket<br>
            &gt; +s.close()<br>
            &gt; +# Close fd of images dir<br>
            &gt; +os.close(dir_fd)<br>
            &gt; +<br>
            &gt; +if resp.type != rpc.RESTORE:<br>
            &gt; +     print 'Unexpected restore msg type'<br>
            &gt; +     sys.exit(-1)<br>
            &gt; +else:<br>
            &gt; +     if resp.success:<br>
            &gt; +             print 'Restore success'<br>
            &gt; +             print "PID of the restored program is
            %d\n" % (resp.restore.pid)<br>
            &gt; +             # Kill restored process<br>
            &gt; +             os.kill(resp.restore.pid, signal.SIGTERM)<br>
            &gt; +     else:<br>
            &gt; +             print 'Restore fail'<br>
            &gt; +             sys.exit(-1)<br>
            &gt; diff --git a/test/others/rpc/run.sh
            b/test/others/rpc/run.sh<br>
            &gt; index ed99addb..5364cc90 100755<br>
            &gt; --- a/test/others/rpc/run.sh<br>
            &gt; +++ b/test/others/rpc/run.sh<br>
            &gt; @@ -76,6 +76,31 @@ function test_errno {<br>
            &gt;       setsid ./errno.py build/criu_service.socket
            build/imgs_errno &lt; /dev/null &amp;&gt;&gt;
            build/output_errno<br>
            &gt;  }<br>
            &gt;  <br>
            &gt; +function test_remote {<br>
            &gt; +     mkdir -p build/imgs_remote<br>
            &gt; +<br>
            &gt; +     title_print "Run image-cache"<br>
            &gt; +     ${CRIU} image-cache -v4 -o dump-loop.log -D
            build/imgs_remote --port 9996 &amp;<br>
            &gt; +     CACHE_PID=${!}<br>
            &gt; +<br>
            &gt; +     title_print "Run image-proxy"<br>
            &gt; +     ${CRIU} image-proxy -v4 -o dump-loop.log -D
            build/imgs_remote --address localhost --port 9996 &amp;<br>
            <br>
            How do you wait when image-cache creates a listen socket?<br>
            <br>
            &gt; +     PROXY_PID=${!}<br>
            &gt; +<br>
            &gt; +     title_print "Run loop.sh"<br>
            &gt; +     setsid ./loop.sh &lt; /dev/null &amp;&gt;
            build/loop.log &amp;<br>
            &gt; +     LOOP_PID=${!}<br>
            &gt; +     echo "Start loop with pid ${P}"<br>
            &gt; +<br>
            &gt; +     title_print "Run dump/restore with --remote test"<br>
            &gt; +     ./remote.py build/criu_service.socket
            build/imgs_remote $P &lt; /dev/null &amp;&gt;&gt;
            build/output_remote<br>
            &gt; +<br>
            &gt; +     # Clean up on failure<br>
            &gt; +     kill -SIGTERM ${LOOP_PID}<br>
            &gt; +     kill -SIGTERM ${CACHE_PID}<br>
            &gt; +     kill -SIGTERM ${PROXT_PID}<br>
            &gt; +}<br>
            &gt; +<br>
            &gt;  trap 'echo "FAIL"; stop_server' EXIT<br>
            &gt;  <br>
            &gt;  start_server<br>
            &gt; @@ -85,6 +110,7 @@ test_py<br>
            &gt;  test_restore_loop<br>
            &gt;  test_ps<br>
            &gt;  test_errno<br>
            &gt; +test_remote<br>
            &gt;  <br>
            &gt;  stop_server<br>
            <span class="HOEnZb"><font color="#888888">&gt;  <br>
                &gt; -- <br>
                &gt; 2.14.3<br>
                &gt; <br>
                &gt; ______________________________<wbr>_________________<br>
                &gt; CRIU mailing list<br>
                &gt; <a href="mailto:CRIU@openvz.org"
                  moz-do-not-send="true">CRIU@openvz.org</a><br>
                &gt; <a
                  href="https://lists.openvz.org/mailman/listinfo/criu"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">https://lists.openvz.org/<wbr>mailman/listinfo/criu</a><br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>