<div dir="ltr">The fd for --ps-socket doesn't have to be a UNIX socket, it can be a TCP socket just fine.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">śr., 30 sty 2019 o 12:25 Martin Wuehrer <<a href="mailto:martin.wuehrer@artech.at">martin.wuehrer@artech.at</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Radostin,<br>
<br>
Sorry, but I have actually another usecase where the criu-dump and the<br>
pageserver are running on two machines connected via network.<br>
Thus in this case I don't have the possibility to access the UNIX-<br>
socket from the dumping machine and I need the TCP address and port of<br>
the machine where the pageserver runs.<br>
<br>
But thanks anyway.<br>
<br>
Martin<br>
<br>
On Wed, 2019-01-30 at 11:13 +0000, Radostin Stoyanov wrote:<br>
> Hi Martin,<br>
> <br>
> I remember that I sent a similar patch some time ago<br>
> <br>
> <a href="https://lists.openvz.org/pipermail/criu/2018-February/040352.html" rel="noreferrer" target="_blank">https://lists.openvz.org/pipermail/criu/2018-February/040352.html</a><br>
> <br>
> What do you think about the idea of starting page server via c-lib?<br>
> Another, thing that might be useful is the '--ps-socket' option which<br>
> allows to pass a file descriptor as socket for incoming connection<br>
> (instead of --address and --port)<br>
> <br>
> Radostin<br>
> <br>
> On 30/01/2019 09:34, <a href="mailto:martin.wuehrer@artech.at" target="_blank">martin.wuehrer@artech.at</a> wrote:<br>
> > From: Martin Wührer <<a href="mailto:martin.wuehrer@artech.at" target="_blank">martin.wuehrer@artech.at</a>><br>
> > <br>
> > According to <a href="https://criu.org/API_compliance" rel="noreferrer" target="_blank">https://criu.org/API_compliance</a>, the C-library<br>
> > doesn't support the pageserver option.<br>
> > This patch contains the functions<br>
> > `criu_(local_)set_page_server_address_port()`<br>
> > that allow to specify on which ip and tcp-port the pageserver<br>
> > is listening.<br>
> > <br>
> > This patch affects only the c-lib, as criu-rpc already supports the<br>
> > pageserver settings.<br>
> > <br>
> > Signed-off-by: Martin Wührer <<a href="mailto:martin.wuehrer@artech.at" target="_blank">martin.wuehrer@artech.at</a>><br>
> > ---<br>
> > lib/c/criu.c | 31 +++++++++++++++++++++++++++++++<br>
> > lib/c/criu.h | 2 ++<br>
> > 2 files changed, 33 insertions(+)<br>
> > <br>
> > diff --git a/lib/c/criu.c b/lib/c/criu.c<br>
> > index 11dc6e84..6d299835 100644<br>
> > --- a/lib/c/criu.c<br>
> > +++ b/lib/c/criu.c<br>
> > @@ -193,6 +193,11 @@ void criu_local_free_opts(criu_opts *opts)<br>
> > }<br>
> > opts->rpc->n_external = 0;<br>
> > <br>
> > + if(opts->rpc->ps) {<br>
> > + free(opts->rpc->ps->address);<br>
> > + free(opts->rpc->ps);<br>
> > + }<br>
> > +<br>
> > free(opts->rpc->cgroup_props_file);<br>
> > free(opts->rpc->cgroup_props);<br>
> > free(opts->rpc->parent_img);<br>
> > @@ -1018,6 +1023,32 @@ int criu_add_external(char *key)<br>
> > return criu_local_add_external(global_opts, key);<br>
> > }<br>
> > <br>
> > +int criu_local_set_page_server_address_port(criu_opts *opts, const<br>
> > char *address, int port)<br>
> > +{<br>
> > + opts->rpc->ps = malloc(sizeof(CriuPageServerInfo));<br>
> > + if (opts->rpc->ps) {<br>
> > + criu_page_server_info__init(opts->rpc->ps);<br>
> > +<br>
> > + opts->rpc->ps->address = strdup(address);<br>
> > + if (!opts->rpc->ps->address) {<br>
> > + free(opts->rpc->ps);<br>
> > + opts->rpc->ps = NULL;<br>
> > + goto out;<br>
> > + }<br>
> > +<br>
> > + opts->rpc->ps->has_port = true;<br>
> > + opts->rpc->ps->port = port;<br>
> > + }<br>
> > +<br>
> > +out:<br>
> > + return -ENOMEM;<br>
> > +}<br>
> > +<br>
> > +int criu_set_page_server_address_port(const char *address, int<br>
> > port)<br>
> > +{<br>
> > + return criu_local_set_page_server_address_port(global_opts,<br>
> > address, port);<br>
> > +}<br>
> > +<br>
> > static CriuResp *recv_resp(int socket_fd)<br>
> > {<br>
> > unsigned char *buf = NULL;<br>
> > diff --git a/lib/c/criu.h b/lib/c/criu.h<br>
> > index 8acd342a..ceb30353 100644<br>
> > --- a/lib/c/criu.h<br>
> > +++ b/lib/c/criu.h<br>
> > @@ -97,6 +97,7 @@ void criu_set_ghost_limit(unsigned int limit);<br>
> > int criu_add_irmap_path(char *path);<br>
> > int criu_add_inherit_fd(int fd, char *key);<br>
> > int criu_add_external(char *key);<br>
> > +int criu_set_page_server_address_port(const char *address, int<br>
> > port);<br>
> > <br>
> > /*<br>
> > * The criu_notify_arg_t na argument is an opaque<br>
> > @@ -211,6 +212,7 @@ int criu_local_add_cg_props_file(criu_opts<br>
> > *opts, char *path);<br>
> > int criu_local_add_cg_dump_controller(criu_opts *opts, char<br>
> > *name);<br>
> > int criu_local_add_inherit_fd(criu_opts *opts, int fd, char *key);<br>
> > int criu_local_add_external(criu_opts *opts, char *key);<br>
> > +int criu_local_set_page_server_address_port(criu_opts *opts, const<br>
> > char *address, int port);<br>
> > <br>
> > void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char<br>
> > *action, criu_notify_arg_t na));<br>
> > <br>
<br>
_______________________________________________<br>
CRIU mailing list<br>
<a href="mailto:CRIU@openvz.org" target="_blank">CRIU@openvz.org</a><br>
<a href="https://lists.openvz.org/mailman/listinfo/criu" rel="noreferrer" target="_blank">https://lists.openvz.org/mailman/listinfo/criu</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Paweł Stradomski</div>