Re: [PATCH] Split contents of <cmdline>...</cmdline> and set LXC init argv

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

 



On 03/14/2012 09:24 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> 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;

This part may change, depending on what we do in the previous patch
(yeah, this should have been sent as a two-part series) - for example,
we may decide to add a virStrSplitShell(), then we don't even have to
pass in the " \t" string of separators, but can instead rely on
virStrSplitShell that takes a single flat arg and reliably splits it out
in the same way as the shell and virsh does it.  But once you have the
split args,

ACK to the rest of the patch.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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