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 <[email protected]> > --- > 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
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
