Re: [PATCH V2 1/5] Add public API virDomainSendSysrq

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

 



On 12/12/14 10:04, Chunyan Liu wrote:
> Add public API virDomainSendSysrq for sending SysRequest key.
> 
> Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
> ---
>  include/libvirt/libvirt-domain.h |  3 +++
>  src/driver-hypervisor.h          |  4 ++++
>  src/libvirt-domain.c             | 38 ++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms          |  1 +
>  4 files changed, 46 insertions(+)
> 

[...]

> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index cb76d8c..4658fd7 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -11192,3 +11192,41 @@ virDomainFSInfoFree(virDomainFSInfoPtr info)
>          VIR_FREE(info->devAlias[i]);
>      VIR_FREE(info->devAlias);
>  }
> +
> +
> +/**
> + * virDomainSendSysrq:
> + * @domain:    pointer to domain object, or NULL for Domain0
> + * @key:    SysRq key, like h, c, ...
> + *
> + * Send SysRq key to the guest.
> + *
> + * Returns 0 in case of success, -1 in case of failure.
> + */
> +int
> +virDomainSendSysrq(virDomainPtr domain, const char *key)

The new API should definitely have a 'flags' argument although it may be
unused for now.

> +{
> +    virConnectPtr conn;
> +    VIR_DOMAIN_DEBUG(domain, "key=%s", key);
> +
> +    virResetLastError();
> +
> +    virCheckDomainReturn(domain, -1);
> +    conn = domain->conn;
> +
> +    virCheckReadOnlyGoto(conn->flags, error);
> +
> +    if (conn->driver->domainSendSysrq) {
> +        int ret;
> +        ret = conn->driver->domainSendSysrq(domain, key);
> +        if (ret < 0)
> +            goto error;
> +        return ret;
> +    }
> +
> +    virReportUnsupportedError();
> +
> + error:
> +    virDispatchError(domain->conn);
> +    return -1;
> +}
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index e4c2df1..80d1dd2 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -688,6 +688,7 @@ LIBVIRT_1.2.11 {
>      global:
>          virDomainFSInfoFree;
>          virDomainGetFSInfo;
> +        virDomainSendSysrq;

This needs to be in it's own section according to the release the API
will be in (1.2.12 currently)

>  } LIBVIRT_1.2.9;
>  
>  # .... define new API here using predicted next version number ....
> 

Peter

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]