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

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

 



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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux