[libvirt] [PATCH V3 3/5] virsh: add 'sysrq' command
Chun Yan Liu
cyliu at suse.com
Thu Dec 18 03:35:34 UTC 2014
>>> On 12/17/2014 at 08:14 PM, in message <549173AC.2000707 at redhat.com>, Ján
Tomko<jtomko at 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 at 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
>
>
More information about the libvir-list
mailing list