Re: [PATCH V3 3/5] virsh: add 'sysrq' command

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

 



On 12/17/2014 09:48 AM, Chunyan Liu wrote:
> All domainSendSysrq related API should be manageable from
> the virsh command line. So, expose 'virsh sysrq' command.
> 
> Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
> ---
>  tools/virsh-domain.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 

> +
> +static bool
> +cmdSysrq(vshControl *ctl, const vshCmd *cmd)
> +{
> +    virDomainPtr dom;
> +    bool ret = false;
> +    const char *key = NULL;
> +
> +    if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
> +        return false;
> +
> +    if (vshCommandOptStringReq(ctl, cmd, "key", &key) < 0)
> +        return false;

dom needs to be freed.

> +
> +    if (!(virDomainSendSysrq(dom, key[0], 0) < 0))
> +        ret = true;
> +

Just a nitpick: I find our usual template more readable:
    if (vir...() < 0)
        goto cleanup;

    ret = true
 cleanup:

Jan

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]