On Mon, 2017-06-05 at 15:27 +0100, Daniel P. Berrange wrote: > 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 ? Will be needed once we'll have docker json support in native-o-xml. lxc config file doesn't have it AFAICT. > > 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=/"); */ Oops, looks like I forgot some cleanup > > virCommandAddEnvPair(cmd, "container_uuid", uuidstr); > > if (nttyPaths > 1) > > virCommandAddEnvPair(cmd, "container_ttys", virBufferCurrentContent(&buf)); > > This doesn't work obviously. Hum... weird. I'll recheck my source tree here and resubmit properly -- Cedric -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list