From: "Daniel P. Berrange" <berra...@redhat.com> Currently for LXC we set LIBVIRT_LXC_CMDLINE to contain the contents of <cmdline>...</cmdline>. It is more convenient if we just set the argv[] of the init binary directly though.
* lxc/lxc_container.c: Set init argv from cmdline --- src/lxc/lxc_container.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index d827b35..93dfb86 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -117,11 +117,19 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virCommandPtr cmd; + char **args = NULL; + size_t i; + + if (vmDef->os.cmdline && + !(args = virStrSplitQuoted(vmDef->os.cmdline, " \t"))) + return NULL; virUUIDFormat(vmDef->uuid, uuidstr); cmd = virCommandNew(vmDef->os.init); + virCommandAddArgSet(cmd, (const char **)args); + virCommandAddEnvString(cmd, "PATH=/bin:/sbin"); virCommandAddEnvString(cmd, "TERM=linux"); virCommandAddEnvString(cmd, "container=lxc-libvirt"); @@ -131,6 +139,10 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef) if (vmDef->os.cmdline) virCommandAddEnvPair(cmd, "LIBVIRT_LXC_CMDLINE", vmDef->os.cmdline); + for (i = 0 ; args[i] ; i++) + VIR_FREE(args[i]); + VIR_FREE(args); + return cmd; } -- 1.7.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list