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

Eric Blake eblake at redhat.com
Wed Mar 14 17:22:35 UTC 2012


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

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 at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120314/c1b0ecef/attachment-0001.sig>


More information about the libvir-list mailing list