[libvirt] [PATCH V3 3/5] virsh: add 'sysrq' command
Ján Tomko
jtomko at redhat.com
Wed Dec 17 12:14:36 UTC 2014
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:
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141217/762a2a07/attachment-0001.sig>
More information about the libvir-list
mailing list