Re: [PATCH 9/9] Add 'lxc-enter-namespace' command to virsh

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

 



On 12/21/2012 10:08 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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

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]