[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/2] lxc: allow user to specify command working directory



On Thu, Jun 01, 2017 at 02:26:17PM +0200, Cédric Bosdonnat wrote:
> Some containers may want the application to run in a special directory.
> Add <initdir> element in the domain configuration to handle this case
> and use it in the lxc driver.
> ---
>  docs/formatdomain.html.in            |  5 +++++
>  docs/schemas/domaincommon.rng        |  5 +++++
>  src/conf/domain_conf.c               |  5 +++++
>  src/conf/domain_conf.h               |  1 +
>  src/lxc/lxc_container.c              |  4 +++-
>  tests/lxcxml2xmldata/lxc-initdir.xml | 30 ++++++++++++++++++++++++++++++
>  tests/lxcxml2xmltest.c               |  1 +
>  7 files changed, 50 insertions(+), 1 deletion(-)
>  create mode 100644 tests/lxcxml2xmldata/lxc-initdir.xml

Any need for the native-to-xml conversion here too ?

> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 03153b972..105f0b7a6 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1841,6 +1841,7 @@ struct _virDomainOSDef {
>      char *init;
>      char **initargv;
>      virDomainOSEnvPtr *initenv;
> +    char *initdir;
>      char *kernel;
>      char *initrd;
>      char *cmdline;
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index ffafc39d7..c122a588e 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -237,7 +237,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
>      virCommandAddEnvString(cmd, "PATH=/bin:/sbin");
>      virCommandAddEnvString(cmd, "TERM=linux");
>      virCommandAddEnvString(cmd, "container=lxc-libvirt");
> -    virCommandAddEnvString(cmd, "HOME=/");
> +/*    virCommandAddEnvString(cmd, "HOME=/"); */
>      virCommandAddEnvPair(cmd, "container_uuid", uuidstr);
>      if (nttyPaths > 1)
>          virCommandAddEnvPair(cmd, "container_ttys", virBufferCurrentContent(&buf));

This doesn't work obviously.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]