[libvirt] [PATCH v2] Add 'lxc-enter-namespace' command to virsh
Eric Blake
eblake at redhat.com
Tue Jan 15 19:07:26 UTC 2013
On 01/15/2013 11:17 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130115/755ec970/attachment-0001.sig>
More information about the libvir-list
mailing list