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

Re: [libvirt] [PATCH v2] Add 'lxc-enter-namespace' command to virsh



On 01/15/2013 11:17 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Add a 'lxc-enter-namespace' command which accepts a domain name
> and then a command + args to run, attached to the container
> 
> eg
> 
>   virsh -c lxc:/// lxc-enter-namespace demo -- /bin/ps -auxf
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  tools/Makefile.am    |  1 +
>  tools/virsh-domain.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/virsh.pod      |  8 +++++
>  3 files changed, 103 insertions(+)

>  /*
> + * "lxc-enter-namespace" namespace
> + */
> +static const vshCmdInfo info_lxc_enter_namespace[] = {
> +    {"help", N_("LXC Guest Enter Namespace")},
> +    {"desc", N_("Run an arbitrary lxc guest enter namespace; use at your own risk")},
> +    {NULL, NULL}
> +};
> +
> +static const vshCmdOptDef opts_lxc_enter_namespace[] = {
> +    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
> +    {NULL, 0, 0, NULL}

You deleted too much - here, you still need a VSH_OT_ARGV argument for
the parser to not reject remaining arguments of the command line.
+    {"cmd", VSH_OT_ARGV, VSH_OFLAG_REQ, N_("namespace")},

> +++ b/tools/virsh.pod
> @@ -3056,6 +3056,14 @@ When I<--aysnc> is given, the command waits for timeout whether success or
>  failed. And when I<--block> is given, the command waits forever with blocking
>  timeout.
>  
> +=item B<lxc-enter-namespace> I<domain> -- /path/to/binary [arg1, [arg2, ...]]
> +
> +Enter the namespace of I<domain> and execute the command C</path/to/binary>
> +passing the requested args. The binary path is relative to the container
> +root filesystem, not the host root filesystem. The binary will inherit the
> +environment variables / console visible to virsh. This command only works
> +when connected to the LXC hypervisor driver.
> +

ACK with that line re-added.

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

Attachment: signature.asc
Description: OpenPGP digital signature


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