>> On 12/17/2014 at 08:14 PM, in message
<549173AC.2000707(a)redhat.com>, Ján
Tomko<jtomko(a)redhat.com> wrote:
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(a)suse.com>
> ---
> 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:
Thanks, I'll update them.
Jan