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

Re: [libvirt] [PATCH 13/14] Add QEMU monitor callbacks for basic lifecycle events



On Thu, Nov 26, 2009 at 06:27:31PM +0000, Daniel P. Berrange wrote:
> * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add callbacks
>   for reset, shutdown, poweroff and stop events. Add convenience
>   methods for emiting those events
> ---
>  src/qemu/qemu_monitor.c |   60 +++++++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor.h |   13 ++++++++++
>  2 files changed, 73 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index 11025a7..b0ed182 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -709,6 +709,66 @@ int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
>  }
>  
>  
> +int qemuMonitorEmitShutdown(qemuMonitorPtr mon)
> +{
> +    int ret = -1;
> +    VIR_DEBUG("mon=%p", mon);
> +
> +    qemuMonitorRef(mon);
> +    qemuMonitorUnlock(mon);
> +    if (mon->cb && mon->cb->domainShutdown)
> +        ret = mon->cb->domainShutdown(mon, mon->vm);
> +    qemuMonitorLock(mon);
> +    qemuMonitorUnref(mon);
> +    return ret;
> +}
> +
> +
> +int qemuMonitorEmitReset(qemuMonitorPtr mon)
> +{
> +    int ret = -1;
> +    VIR_DEBUG("mon=%p", mon);
> +
> +    qemuMonitorRef(mon);
> +    qemuMonitorUnlock(mon);
> +    if (mon->cb && mon->cb->domainReset)
> +        ret = mon->cb->domainReset(mon, mon->vm);
> +    qemuMonitorLock(mon);
> +    qemuMonitorUnref(mon);
> +    return ret;
> +}
> +
> +
> +int qemuMonitorEmitPowerdown(qemuMonitorPtr mon)
> +{
> +    int ret = -1;
> +    VIR_DEBUG("mon=%p", mon);
> +
> +    qemuMonitorRef(mon);
> +    qemuMonitorUnlock(mon);
> +    if (mon->cb && mon->cb->domainPowerdown)
> +        ret = mon->cb->domainPowerdown(mon, mon->vm);
> +    qemuMonitorLock(mon);
> +    qemuMonitorUnref(mon);
> +    return ret;
> +}
> +
> +
> +int qemuMonitorEmitStop(qemuMonitorPtr mon)
> +{
> +    int ret = -1;
> +    VIR_DEBUG("mon=%p", mon);
> +
> +    qemuMonitorRef(mon);
> +    qemuMonitorUnlock(mon);
> +    if (mon->cb && mon->cb->domainStop)
> +        ret = mon->cb->domainStop(mon, mon->vm);
> +    qemuMonitorLock(mon);
> +    qemuMonitorUnref(mon);
> +    return ret;
> +}
> +
> +
>  int
>  qemuMonitorStartCPUs(qemuMonitorPtr mon,
>                       virConnectPtr conn)
> diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
> index 7aa6ee5..8b1e3a3 100644
> --- a/src/qemu/qemu_monitor.h
> +++ b/src/qemu/qemu_monitor.h
> @@ -76,6 +76,15 @@ struct _qemuMonitorCallbacks {
>                              const char *path,
>                              char **secret,
>                              size_t *secretLen);
> +
> +    int (*domainShutdown)(qemuMonitorPtr mon,
> +                          virDomainObjPtr vm);
> +    int (*domainReset)(qemuMonitorPtr mon,
> +                       virDomainObjPtr vm);
> +    int (*domainPowerdown)(qemuMonitorPtr mon,
> +                           virDomainObjPtr vm);
> +    int (*domainStop)(qemuMonitorPtr mon,
> +                      virDomainObjPtr vm);
>  };
>  
>  
> @@ -106,6 +115,10 @@ int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
>                               char **secret,
>                               size_t *secretLen);
>  
> +int qemuMonitorEmitShutdown(qemuMonitorPtr mon);
> +int qemuMonitorEmitReset(qemuMonitorPtr mon);
> +int qemuMonitorEmitPowerdown(qemuMonitorPtr mon);
> +int qemuMonitorEmitStop(qemuMonitorPtr mon);
>  
>  int qemuMonitorStartCPUs(qemuMonitorPtr mon,
>                           virConnectPtr conn);

  ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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