[PATCH 3/4] lxc: Pass another pipe to lxc_controller

Martin Kletzander mkletzan at redhat.com
Thu Apr 22 11:25:55 UTC 2021


On Tue, Apr 20, 2021 at 04:15:17PM +0200, Michal Privoznik wrote:
>Currently, there is only a single pipe passed to lxc_controller
>and it is used by lxc_controller to signal to the LXC driver that
>the container is set up and ready to run. However, in the next
>commit we will need to signal that the LXC driver has done its
>part of startup process and thus the controller can proceed.
>Unfortunately, virCommand handshake can't be used for this,
>because it's already used to read controller's PID.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/lxc/lxc_controller.c | 46 ++++++++++++++++++++++++++++------------
> src/lxc/lxc_process.c    | 21 +++++++++++-------
> 2 files changed, 46 insertions(+), 21 deletions(-)
>

[...]

>diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
>index ac635efe7a..493e19f03d 100644
>--- a/src/lxc/lxc_process.c
>+++ b/src/lxc/lxc_process.c
>@@ -939,7 +939,8 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
>                                 int *nsInheritFDs,
>                                 int *files,
>                                 size_t nfiles,
>-                                int handshakefd,
>+                                int handshakefdW,
>+                                int handshakefdR,
>                                 int * const logfd,
>                                 const char *pidfile)
> {
>@@ -1003,12 +1004,13 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
>                          virSecurityManagerGetModel(driver->securityManager));
>
>     virCommandAddArg(cmd, "--handshakefd");

Maybe using plural here?

>-    virCommandAddArgFormat(cmd, "%d", handshakefd);
>+    virCommandAddArgFormat(cmd, "%d:%d", handshakefdR, handshakefdW);
>

This was a little bit confusing as I would put it the other way, but
ultimately does not matter.  It would be easier to spot if you also
changed the help output and maybe s/handshakefd/handshakefds/ in the
struct option passed to getopt_long().

Anyway, with at least the help output changed:

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210422/6bd186dc/attachment-0001.sig>


More information about the libvir-list mailing list