[libvirt] [PATCH 4/6] LXC: Wire up the virDomainCreate{XML}WithFiles methods

Michal Privoznik mprivozn at redhat.com
Thu Jul 18 08:43:59 UTC 2013


On 12.07.2013 17:38, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Wire up the new virDomainCreate{XML}WithFiles methods in the
> LXC driver, so that FDs get passed down to the init process.
> 
> The lxc_container code needs to do a little dance in order
> to renumber the file descriptors it receives into linear
> order, starting from STDERR_FILENO + 1.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/lxc/lxc_container.c  | 136 +++++++++++++++++++++++++++++++++++++----------
>  src/lxc/lxc_container.h  |   6 ++-
>  src/lxc/lxc_controller.c |  36 +++++++++++--
>  src/lxc/lxc_driver.c     |  45 +++++++++++++---
>  src/lxc/lxc_process.c    |  16 +++++-
>  src/lxc/lxc_process.h    |   1 +
>  6 files changed, 197 insertions(+), 43 deletions(-)
> 

> @@ -853,6 +856,12 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver,
>          virCommandPreserveFD(cmd, ttyFDs[i]);
>      }
>  
> +    for (i = 0; i < nfiles; i++) {
> +        virCommandAddArg(cmd, "--passfd");
> +        virCommandAddArgFormat(cmd, "%d", files[i]);
> +        virCommandPreserveFD(cmd, files[i], 0);

How does this even compile? s/, 0//

> +    }
> +
>      virCommandAddArgPair(cmd, "--security",
>                           virSecurityManagerGetModel(driver->securityManager));
>  

Michal




More information about the libvir-list mailing list