| Libvirt-gobject Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | Signals | ||||
struct GVirDomain; struct GVirDomainClass; enum GVirDomainDeleteFlags; struct GVirDomainInfo; enum GVirDomainStartFlags; enum GVirDomainState; gboolean gvir_domain_delete (GVirDomain *dom,guint flags,GError **err); GVirConfigDomain * gvir_domain_get_config (GVirDomain *dom,guint flags,GError **err); GList * gvir_domain_get_devices (GVirDomain *domain,GError **err); gint gvir_domain_get_id (GVirDomain *dom,GError **err); GVirDomainInfo * gvir_domain_get_info (GVirDomain *dom,GError **err); void gvir_domain_get_info_async (GVirDomain *dom,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data); GVirDomainInfo * gvir_domain_get_info_finish (GVirDomain *dom,GAsyncResult *result,GError **err); const gchar * gvir_domain_get_name (GVirDomain *dom); gboolean gvir_domain_get_persistent (GVirDomain *dom); gboolean gvir_domain_get_saved (GVirDomain *dom); const gchar * gvir_domain_get_uuid (GVirDomain *dom); gboolean gvir_domain_open_console (GVirDomain *dom,GVirStream *stream,const gchar *devname,guint flags,GError **err); gboolean gvir_domain_open_graphics (GVirDomain *dom,guint idx,int fd,unsigned int flags,GError **err); gboolean gvir_domain_reboot (GVirDomain *dom,guint flags,GError **err); gboolean gvir_domain_resume (GVirDomain *dom,GError **err); gboolean gvir_domain_save (GVirDomain *dom,unsigned int flags,GError **err); void gvir_domain_save_async (GVirDomain *dom,unsigned int flags,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data); gboolean gvir_domain_save_finish (GVirDomain *dom,GAsyncResult *result,GError **err); gchar * gvir_domain_screenshot (GVirDomain *dom,GVirStream *stream,guint monitor_id,guint flags,GError **err); gboolean gvir_domain_set_config (GVirDomain *domain,GVirConfigDomain *conf,GError **err); gboolean gvir_domain_shutdown (GVirDomain *dom,guint flags,GError **err); gboolean gvir_domain_start (GVirDomain *dom,guint flags,GError **err); void gvir_domain_start_async (GVirDomain *dom,guint flags,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data); gboolean gvir_domain_start_finish (GVirDomain *dom,GAsyncResult *result,GError **err); gboolean gvir_domain_stop (GVirDomain *dom,guint flags,GError **err); gboolean gvir_domain_suspend (GVirDomain *dom,GError **err);
"resumed" :No Hooks"started" :No Hooks"stopped" :No Hooks"suspended" :No Hooks"updated" :No Hooks
struct GVirDomainClass {
GObjectClass parent_class;
/* signals */
void (*started)(GVirDomain *dom);
void (*stopped)(GVirDomain *dom);
void (*resumed)(GVirDomain *dom);
void (*updated)(GVirDomain *dom);
void (*suspended)(GVirDomain *dom);
gpointer padding[20];
};
typedef enum {
GVIR_DOMAIN_DELETE_NONE = 0,
GVIR_DOMAIN_DELETE_SAVED_STATE = VIR_DOMAIN_UNDEFINE_MANAGED_SAVE,
GVIR_DOMAIN_DELETE_SNAPSHOTS_METADATA = VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
} GVirDomainDeleteFlags;
struct GVirDomainInfo {
GVirDomainState state; /* the running state */
guint64 maxMem; /* the maximum memory in KBytes allowed */
guint64 memory; /* the memory in KBytes used by the domain */
guint16 nrVirtCpu; /* the number of virtual CPUs for the domain */
guint64 cpuTime; /* the CPU time used in nanoseconds */
};
typedef enum {
GVIR_DOMAIN_START_NONE = 0,
GVIR_DOMAIN_START_PAUSED = (1 << 0),
GVIR_DOMAIN_START_AUTODESTROY = (1 << 1),
GVIR_DOMAIN_START_BYPASS_CACHE = (1 << 2),
GVIR_DOMAIN_START_FORCE_BOOT = (1 << 3),
} GVirDomainStartFlags;
typedef enum {
GVIR_DOMAIN_STATE_NONE = 0, /* no state */
GVIR_DOMAIN_STATE_RUNNING = 1, /* the domain is running */
GVIR_DOMAIN_STATE_BLOCKED = 2, /* the domain is blocked on resource */
GVIR_DOMAIN_STATE_PAUSED = 3, /* the domain is paused by user */
GVIR_DOMAIN_STATE_SHUTDOWN= 4, /* the domain is being shut down */
GVIR_DOMAIN_STATE_SHUTOFF = 5, /* the domain is shut off */
GVIR_DOMAIN_STATE_CRASHED = 6 /* the domain is crashed */
} GVirDomainState;
gboolean gvir_domain_delete (GVirDomain *dom,guint flags,GError **err);
|
the domain |
|
the flags |
GVirConfigDomain * gvir_domain_get_config (GVirDomain *dom,guint flags,GError **err);
|
the domain |
|
the flags |
Returns : |
the config. The returned object should be
unreffed with g_object_unref() when no longer needed. [transfer full]
|
GList * gvir_domain_get_devices (GVirDomain *domain,GError **err);
Gets the list of devices attached to domain. The returned list should
be freed with g_list_free(), after its elements have been unreffed with
g_object_unref().
|
the domain |
|
place-holder for possible errors, or NULL |
Returns : |
a newly allocated GList of GVirDomainDevice. [element-type LibvirtGObject.DomainDevice][transfer full] |
GVirDomainInfo * gvir_domain_get_info (GVirDomain *dom,GError **err);
|
the domain |
Returns : |
the info. The returned object should be
unreffed with g_object_unref() when no longer needed. [transfer full]
|
void gvir_domain_get_info_async (GVirDomain *dom,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Asynchronous variant of gvir_domain_get_info.
|
the domain |
|
cancellation object. [allow-none][transfer none] |
|
completion callback. [scope async] |
|
opaque data for callback. [closure] |
GVirDomainInfo * gvir_domain_get_info_finish (GVirDomain *dom,GAsyncResult *result,GError **err);
Finishes the operation started by gvir_domain_get_info_async.
|
the domain |
|
async method result. [transfer none] |
|
Place-holder for possible errors |
Returns : |
the info. The returned object should be
unreffed with g_object_unref() when no longer needed. [transfer full]
|
gboolean gvir_domain_get_persistent (GVirDomain *dom);
|
the domain |
Returns : |
TRUE if domain is persistent, FALSE otherwise. |
gboolean gvir_domain_get_saved (GVirDomain *dom);
|
the domain |
Returns : |
TRUE if a stopped domain has a saved state to which it can be restored to using gvir_domain_start, FALSE otherwise. |
gboolean gvir_domain_open_console (GVirDomain *dom,GVirStream *stream,const gchar *devname,guint flags,GError **err);
Open a text console for the domain dom, connecting it to the
stream stream. If devname is NULL, the default console will
be opened, otherwise devname can be used to specify a non-default
console device.
|
the domain. [transfer none] |
|
the device name. [transfer none][allow-none] |
|
stream to use as output. [transfer none] |
|
extra flags, currently unused |
Returns : |
TRUE if the console was opened, FALSE otherwise. |
gboolean gvir_domain_open_graphics (GVirDomain *dom,guint idx,int fd,unsigned int flags,GError **err);
Open a connection to the local graphics display, connecting it to the
socket pair file descriptor passed in as fd.
|
the domain |
|
the graphics index |
|
pre-opened socket pair |
|
extra flags, currently unused |
Returns : |
TRUE if the graphics connection was opened, FALSE otherwise. |
gboolean gvir_domain_reboot (GVirDomain *dom,guint flags,GError **err);
|
the domain |
|
the flags |
gboolean gvir_domain_resume (GVirDomain *dom,GError **err);
|
the domain |
|
Place-holder for possible errors |
Returns : |
TRUE on success |
gboolean gvir_domain_save (GVirDomain *dom,unsigned int flags,GError **err);
Saves the state of the domain on disk and stops it. Use gvir_domain_start to restore the saved state of the domain. A saved domain can be restored even after shutdown/reboot of host machine.
|
the domain to save |
|
extra flags, currently unused |
|
Place-holder for possible errors |
Returns : |
TRUE if domain was saved successfully, FALSE otherwise. |
void gvir_domain_save_async (GVirDomain *dom,unsigned int flags,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Asynchronous variant of gvir_domain_save.
|
the domain to save |
|
extra flags, currently unused |
|
cancellation object. [allow-none][transfer none] |
|
completion callback. [scope async] |
|
opaque data for callback. [closure] |
gboolean gvir_domain_save_finish (GVirDomain *dom,GAsyncResult *result,GError **err);
Finishes the operation started by gvir_domain_save_async.
|
the domain to save |
|
async method result. [transfer none] |
|
Place-holder for possible errors |
Returns : |
TRUE if domain was saved successfully, FALSE otherwise. |
gchar * gvir_domain_screenshot (GVirDomain *dom,GVirStream *stream,guint monitor_id,guint flags,GError **err);
|
stream to use as output |
|
monitor ID to take screenshot from |
|
extra flags, currently unused |
Returns : |
a newly allocated string containing the mime-type of the image format, or NULL upon error. [transfer full] |
gboolean gvir_domain_set_config (GVirDomain *domain,GVirConfigDomain *conf,GError **err);
Resets configuration of an existing domain.
Note: If domain is already running, the new configuration will not take affect until domain reboots.
|
the domain |
|
the new configuration for the domain |
|
Place-holder for error or NULL. [allow-none] |
Returns : |
TRUE on success, FALSE if an error occurred. |
gboolean gvir_domain_shutdown (GVirDomain *dom,guint flags,GError **err);
|
the domain |
|
the flags |
gboolean gvir_domain_start (GVirDomain *dom,guint flags,GError **err);
|
the domain |
|
the flags |
void gvir_domain_start_async (GVirDomain *dom,guint flags,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Asynchronous variant of gvir_domain_start.
|
the domain |
|
the flags |
|
cancellation object. [allow-none][transfer none] |
|
completion callback. [scope async] |
|
opaque data for callback. [closure] |
gboolean gvir_domain_start_finish (GVirDomain *dom,GAsyncResult *result,GError **err);
gboolean gvir_domain_stop (GVirDomain *dom,guint flags,GError **err);
|
the domain |
|
the flags |
gboolean gvir_domain_suspend (GVirDomain *dom,GError **err);
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.
|
the domain to suspend |
|
Place-holder for possible errors |
Returns : |
TRUE if domain was suspended successfully, FALSE otherwise. |