[libvirt] [PATCH 9/9] Add 'lxc-enter-namespace' command to virsh
Eric Blake
eblake at redhat.com
Tue Jan 15 00:40:17 UTC 2013
On 12/21/2012 10:08 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 | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 101 insertions(+)
Missing documentation in virsh.pod. But the command itself looks nice.
> + dom = vshCommandOptDomain(ctl, cmd, NULL);
> + if (dom == NULL)
> + goto cleanup;
> +
> + while ((opt = vshCommandOptArgv(cmd, opt))) {
> + if (VIR_EXPAND_N(cmdargv, ncmdargv, 1) < 0) {
> + vshError(ctl, _("%s: %d: failed to allocate argv"),
> + __FILE__, __LINE__);
> + exit(EXIT_FAILURE);
vshError() already exits, so this is dead code.
> + }
> + cmdargv[ncmdargv-1] = opt->data;
> + }
> + if (VIR_EXPAND_N(cmdargv, ncmdargv, 1) < 0) {
> + vshError(ctl, _("%s: %d: failed to allocate argv"),
> + __FILE__, __LINE__);
> + exit(EXIT_FAILURE);
and again.
> + }
> + cmdargv[ncmdargv-1] = NULL;
space around '-'
> @@ -8760,6 +8859,7 @@ const vshCmdDef domManagementCmds[] = {
> {"inject-nmi", cmdInjectNMI, opts_inject_nmi, info_inject_nmi, 0},
> {"send-key", cmdSendKey, opts_send_key, info_send_key, 0},
> {"send-process-signal", cmdSendProcessSignal, opts_send_process_signal, info_send_process_signal, 0},
> + {"lxc-enter-namespace", cmdLxcEnterNamespace, opts_lxc_enter_namespace, info_lxc_enter_namespace, 0},
> {"managedsave", cmdManagedSave, opts_managedsave, info_managedsave, 0},
> {"managedsave-remove", cmdManagedSaveRemove, opts_managedsaveremove,
Hmm, pre-existing, but these aren't sorted.
--
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/20130114/77e250e6/attachment-0001.sig>
More information about the libvir-list
mailing list