[libvirt] [libvirt-glib 1/2] API to suspend a domain
Christophe Fergeau
cfergeau at redhat.com
Fri Jan 6 07:30:49 UTC 2012
ACK
On Fri, Dec 23, 2011 at 09:58:22PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>
> ---
> libvirt-gobject/libvirt-gobject-domain.c | 30 ++++++++++++++++++++++++++++++
> libvirt-gobject/libvirt-gobject-domain.h | 3 +++
> libvirt-gobject/libvirt-gobject.sym | 1 +
> 3 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index 4301b14..e4963ed 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -678,3 +678,33 @@ gboolean gvir_domain_open_graphics(GVirDomain *dom,
> cleanup:
> return ret;
> }
> +
> +/**
> + * gir_domain_suspend:
> + * @dom: the domain to suspend
> + * @err: Place-holder for possible errors
> + *
> + * Suspends an active domain, the process is frozen without further access to
> + * CPU resources and I/O but the memory used by the domain at the hypervisor
> + * level will stay allocated. Use gvir_domain_resume() to reactivate the domain.
> + *
> + * Returns: TRUE if domain was suspended successfully, FALSE otherwise.
> + */
> +gboolean gvir_domain_suspend (GVirDomain *dom,
> + GError **err)
> +{
> + gboolean ret = FALSE;
> +
> + g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
> +
> + if (virDomainSuspend(dom->priv->handle) < 0) {
> + gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
> + 0,
> + "Unable to suspend domain");
> + goto cleanup;
> + }
> +
> + ret = TRUE;
> +cleanup:
> + return ret;
> +}
> diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
> index 6fcec8d..a5923f4 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.h
> +++ b/libvirt-gobject/libvirt-gobject-domain.h
> @@ -153,6 +153,9 @@ gboolean gvir_domain_open_graphics(GVirDomain *dom,
> unsigned int flags,
> GError **err);
>
> +gboolean gvir_domain_suspend (GVirDomain *dom,
> + GError **err);
> +
> G_END_DECLS
>
> #endif /* __LIBVIRT_GOBJECT_DOMAIN_H__ */
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index a523adc..526098d 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -51,6 +51,7 @@ LIBVIRT_GOBJECT_0.0.3 {
> gvir_domain_start;
> gvir_domain_resume;
> gvir_domain_stop;
> + gvir_domain_suspend;
> gvir_domain_delete;
> gvir_domain_open_console;
> gvir_domain_open_graphics;
> --
> 1.7.7.4
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120106/e05f22a2/attachment-0001.sig>
More information about the libvir-list
mailing list