## GVirConnection GVirConnection |

## Synopsis

    struct              GVirNodeInfo;
    struct              GVirConnection;
    struct              GVirConnectionClass;
    GVirConnection *    gvir_connection_new                 (const char *uri);
    gboolean            gvir_connection_open                (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);
    gboolean            gvir_connection_open_read_only      (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gvir_connection_open_async          (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gvir_connection_open_finish         (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);
    void                gvir_connection_open_read_only_async
                                                            (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gvir_connection_open_read_only_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);
    gboolean            gvir_connection_is_open             (GVirConnection *conn);
    gboolean            gvir_connection_is_read_only        (GVirConnection *conn);
    void                gvir_connection_close               (GVirConnection *conn);
    gboolean            gvir_connection_fetch_domains       (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gvir_connection_fetch_domains_async (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gvir_connection_fetch_domains_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);
    const gchar *       gvir_connection_get_uri             (GVirConnection *conn);
    gchar *             gvir_connection_get_hypervisor_name (GVirConnection *conn,
                                                             GError **err);
    gulong              gvir_connection_get_version         (GVirConnection *conn,
                                                             GError **err);
    GList *             gvir_connection_get_domains         (GVirConnection *conn);
    GVirDomain *        gvir_connection_get_domain          (GVirConnection *conn,
                                                             const gchar *uuid);
    GVirDomain *        gvir_connection_find_domain_by_id   (GVirConnection *conn,
                                                             gint id);
    GVirDomain *        gvir_connection_find_domain_by_name (GVirConnection *conn,
                                                             const gchar *name);
    GVirDomain *        gvir_connection_create_domain       (GVirConnection *conn,
                                                             GVirConfigDomain *conf,
                                                             GError **err);
    GVirDomain *        gvir_connection_start_domain        (GVirConnection *conn,
                                                             GVirConfigDomain *conf,
                                                             guint flags,
                                                             GError **err);
    GList *             gvir_connection_get_interfaces      (GVirConnection *conn);
    GVirInterface *     gvir_connection_get_interface       (GVirConnection *conn,
                                                             const gchar *name);
    GVirInterface *     gvir_connection_find_interface_by_mac
                                                            (GVirConnection *conn,
                                                             const gchar *macaddr);
    GList *             gvir_connection_get_networks        (GVirConnection *conn);
    GVirNetwork *       gvir_connection_get_network         (GVirConnection *conn,
                                                             const gchar *uuid);
    GVirNetwork *       gvir_connection_find_network_by_name
                                                            (GVirConnection *conn,
                                                             const gchar *name);
    GList *             gvir_connection_get_network_filters (GVirConnection *conn);
    GVirNetworkFilter * gvir_connection_get_network_filter  (GVirConnection *conn,
                                                             const gchar *uuid);
    GVirNetworkFilter * gvir_connection_find_network_filter_by_name
                                                            (GVirConnection *conn,
                                                             const gchar *name);
    GList *             gvir_connection_get_node_devices    (GVirConnection *conn);
    GVirNodeDevice *    gvir_connection_get_node_device     (GVirConnection *conn,
                                                             const gchar *name);
    GList *             gvir_connection_get_secrets         (GVirConnection *conn);
    GVirSecret *        gvir_connection_get_secret          (GVirConnection *conn,
                                                             const gchar *uuid);
    gboolean            gvir_connection_fetch_storage_pools (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);
    void                gvir_connection_fetch_storage_pools_async
                                                            (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gvir_connection_fetch_storage_pools_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);
    GList *             gvir_connection_get_storage_pools   (GVirConnection *conn);
    GVirStoragePool *   gvir_connection_get_storage_pool    (GVirConnection *conn,
                                                             const gchar *uuid);
    GVirStoragePool *   gvir_connection_find_storage_pool_by_name
                                                            (GVirConnection *conn,
                                                             const gchar *name);
    GVirStoragePool *   gvir_connection_create_storage_pool (GVirConnection *conn,
                                                             GVirConfigStoragePool *conf,
                                                             guint flags,
                                                             GError **err);
    GVirStream *        gvir_connection_get_stream          (GVirConnection *conn,
                                                             guint flags);
    GVirNodeInfo *      gvir_connection_get_node_info       (GVirConnection *conn,
                                                             GError **err);
    GVirConfigCapabilities * gvir_connection_get_capabilities
                                                            (GVirConnection *conn,
                                                             GError **err);
    void                gvir_connection_get_capabilities_async
                                                            (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GVirConfigCapabilities * gvir_connection_get_capabilities_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);
    gboolean            gvir_connection_restore_domain_from_file
                                                            (GVirConnection *conn,
                                                             gchar *filename,
                                                             GVirConfigDomain *custom_conf,
                                                             guint flags,
                                                             GError **err);
    void                gvir_connection_restore_domain_from_file_async
                                                            (GVirConnection *conn,
                                                             gchar *filename,
                                                             GVirConfigDomain *custom_conf,
                                                             guint flags,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            gvir_connection_restore_domain_from_file_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

## Object Hierarchy

      GBoxed
       +----GVirNodeInfo

      GObject
       +----GVirConnection

## Properties

      "handle"                   GVirConnectionHandle*  : Read / Write / Construct Only
      "uri"                      gchar*                : Read / Write / Construct Only

## Signals

      "connection-closed"                              : Run First
      "connection-opened"                              : Run First
      "domain-added"                                   : Run First
      "domain-removed"                                 : Run First

## Description

## Details

### struct GVirNodeInfo

    struct GVirNodeInfo {
        gchar model[32]; /* string indicating the CPU model */
        gulong memory;   /* memory size in kilobytes */
        guint cpus;      /* the number of active CPUs */
        guint mhz;       /* expected CPU frequency */
        guint nodes;     /* the number of NUMA cell, 1 for unusual NUMA topologies or uniform memo */
        guint sockets;   /* number of CPU sockets per node if nodes > 1, total number of CPU socke */
        guint cores;     /* number of cores per socket */
        guint threads;   /* number of threads per core */
    };

### struct GVirConnection

    struct GVirConnection;

### struct GVirConnectionClass

    struct GVirConnectionClass {
        GObjectClass parent_class;

        /* signals */
        void (*connection_opened)(GVirConnection *conn);
        void (*connection_closed)(GVirConnection *conn);

        void (*domain_added)(GVirConnection *conn, GVirDomain *dom);
        void (*domain_removed)(GVirConnection *conn, GVirDomain *dom);

        GVirStream *(*stream_new)(GVirConnection *conn, gpointer handle);

        gpointer padding[20];
    };

### gvir_connection_new ()

    GVirConnection *    gvir_connection_new                 (const char *uri);

### gvir_connection_open ()

    gboolean            gvir_connection_open                (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]

### gvir_connection_open_read_only ()

    gboolean            gvir_connection_open_read_only      (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);

### gvir_connection_open_async ()

    void                gvir_connection_open_async          (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]
`callback` : | completion callback. [scope async]
`user_data` : | opaque data for callback. [closure]

### gvir_connection_open_finish ()

    gboolean            gvir_connection_open_finish         (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

`conn` : | a GVirConnection
`result` : | async method result. [transfer none]

### gvir_connection_open_read_only_async ()

    void                gvir_connection_open_read_only_async
                                                            (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]
`callback` : | completion callback. [scope async]
`user_data` : | opaque data for callback. [closure]

### gvir_connection_open_read_only_finish ()

    gboolean            gvir_connection_open_read_only_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

`conn` : | a GVirConnection
`result` : | async method result. [transfer none]

### gvir_connection_is_open ()

    gboolean            gvir_connection_is_open             (GVirConnection *conn);

### gvir_connection_is_read_only ()

    gboolean            gvir_connection_is_read_only        (GVirConnection *conn);

### gvir_connection_close ()

    void                gvir_connection_close               (GVirConnection *conn);

### gvir_connection_fetch_domains ()

    gboolean            gvir_connection_fetch_domains       (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]

### gvir_connection_fetch_domains_async ()

    void                gvir_connection_fetch_domains_async (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]
`callback` : | completion callback. [scope async]
`user_data` : | opaque data for callback. [closure]

### gvir_connection_fetch_domains_finish ()

    gboolean            gvir_connection_fetch_domains_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

`conn` : | a GVirConnection
`result` : | async method result. [transfer none]

### gvir_connection_get_uri ()

    const gchar *       gvir_connection_get_uri             (GVirConnection *conn);

### gvir_connection_get_hypervisor_name ()

    gchar *             gvir_connection_get_hypervisor_name (GVirConnection *conn,
                                                             GError **err);

Get name of current hypervisor used.

`conn` : | a GVirConnection
`err` : | return location for any GError
Returns : | new string that should be freed when no longer needed, or NULL upon error.

### gvir_connection_get_version ()

    gulong              gvir_connection_get_version         (GVirConnection *conn,
                                                             GError **err);

Get version of current hypervisor used.

`conn` : | a GVirConnection
`err` : | return location for any GError
Returns : | version on success, 0 otherwise and `err` set.

### gvir_connection_get_domains ()

    GList *             gvir_connection_get_domains         (GVirConnection *conn);

Gets a list of the domains available through `conn`.

`conn` : | a GVirConnection
Returns : | List of GVirDomain. The returned list should be freed with `g_list_free()`, after its elements have been unreffed with `g_object_unref()`. [element-type LibvirtGObject.Domain][transfer full]

### gvir_connection_get_domain ()

    GVirDomain *        gvir_connection_get_domain          (GVirConnection *conn,
                                                             const gchar *uuid);

`conn` : | a GVirConnection
`uuid` : | uuid string of the requested domain
Returns : | the GVirDomain, or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_find_domain_by_id ()

    GVirDomain *        gvir_connection_find_domain_by_id   (GVirConnection *conn,
                                                             gint id);

`conn` : | a GVirConnection
`id` : | id of the requested domain
Returns : | the GVirDomain, or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_find_domain_by_name ()

    GVirDomain *        gvir_connection_find_domain_by_name (GVirConnection *conn,
                                                             const gchar *name);

`conn` : | a GVirConnection
`name` : | name of the requested domain
Returns : | the GVirDomain, or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_create_domain ()

    GVirDomain *        gvir_connection_create_domain       (GVirConnection *conn,
                                                             GVirConfigDomain *conf,
                                                             GError **err);

Create the configuration file for a new persistent domain. The returned domain will initially be in the shutoff state.

`conn` : | a GVirConnection on which to create the domain
`conf` : | the configuration for the new domain
Returns : | the newly created domain, or NULL if an error occurred. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_start_domain ()

    GVirDomain *        gvir_connection_start_domain        (GVirConnection *conn,
                                                             GVirConfigDomain *conf,
                                                             guint flags,
                                                             GError **err);

Start a new transient domain without persistent configuration. The returned domain will initially be running.

`conn` : | a GVirConnection on which to create the domain
`conf` : | the configuration for the new domain
Returns : | the newly created domain, or NULL if an error occurred. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_get_interfaces ()

    GList *             gvir_connection_get_interfaces      (GVirConnection *conn);

### gvir_connection_get_interface ()

    GVirInterface *     gvir_connection_get_interface       (GVirConnection *conn,
                                                             const gchar *name);

### gvir_connection_find_interface_by_mac ()

    GVirInterface *     gvir_connection_find_interface_by_mac
                                                            (GVirConnection *conn,
                                                             const gchar *macaddr);

### gvir_connection_get_networks ()

    GList *             gvir_connection_get_networks        (GVirConnection *conn);

### gvir_connection_get_network ()

    GVirNetwork *       gvir_connection_get_network         (GVirConnection *conn,
                                                             const gchar *uuid);

### gvir_connection_find_network_by_name ()

    GVirNetwork *       gvir_connection_find_network_by_name
                                                            (GVirConnection *conn,
                                                             const gchar *name);

### gvir_connection_get_network_filters ()

    GList *             gvir_connection_get_network_filters (GVirConnection *conn);

### gvir_connection_get_network_filter ()

    GVirNetworkFilter * gvir_connection_get_network_filter  (GVirConnection *conn,
                                                             const gchar *uuid);

### gvir_connection_find_network_filter_by_name ()

    GVirNetworkFilter * gvir_connection_find_network_filter_by_name
                                                            (GVirConnection *conn,
                                                             const gchar *name);

### gvir_connection_get_node_devices ()

    GList *             gvir_connection_get_node_devices    (GVirConnection *conn);

### gvir_connection_get_node_device ()

    GVirNodeDevice *    gvir_connection_get_node_device     (GVirConnection *conn,
                                                             const gchar *name);

### gvir_connection_get_secrets ()

    GList *             gvir_connection_get_secrets         (GVirConnection *conn);

### gvir_connection_get_secret ()

    GVirSecret *        gvir_connection_get_secret          (GVirConnection *conn,
                                                             const gchar *uuid);

### gvir_connection_fetch_storage_pools ()

    gboolean            gvir_connection_fetch_storage_pools (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GError **err);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]

### gvir_connection_fetch_storage_pools_async ()

    void                gvir_connection_fetch_storage_pools_async
                                                            (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]
`callback` : | completion callback. [scope async]
`user_data` : | opaque data for callback. [closure]

### gvir_connection_fetch_storage_pools_finish ()

    gboolean            gvir_connection_fetch_storage_pools_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

`conn` : | a GVirConnection
`result` : | async method result. [transfer none]

### gvir_connection_get_storage_pools ()

    GList *             gvir_connection_get_storage_pools   (GVirConnection *conn);

Gets a list of the storage pools available through `conn`.

`conn` : | a GVirConnection
Returns : | List of GVirStoragePool. The returned list should be freed with `g_list_free()`, after its elements have been unreffed with `g_object_unref()`. [element-type LibvirtGObject.StoragePool][transfer full]

### gvir_connection_get_storage_pool ()

    GVirStoragePool *   gvir_connection_get_storage_pool    (GVirConnection *conn,
                                                             const gchar *uuid);

`conn` : | a GVirConnection
`uuid` : | uuid string of the requested storage pool
Returns : | the GVirStoragePool, or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_find_storage_pool_by_name ()

    GVirStoragePool *   gvir_connection_find_storage_pool_by_name
                                                            (GVirConnection *conn,
                                                             const gchar *name);

`conn` : | a GVirConnection
`name` : | name of the requested storage pool
Returns : | the GVirStoragePool, or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_create_storage_pool ()

    GVirStoragePool *   gvir_connection_create_storage_pool (GVirConnection *conn,
                                                             GVirConfigStoragePool *conf,
                                                             guint flags,
                                                             GError **err);

`conn` : | a GVirConnection on which to create the pool
`conf` : | the configuration for the new storage pool
`flags` : | the flags
`err` : | return location for any GError
Returns : | the newly created storage pool, or NULL if an error occurred. The returned list should be freed with `g_list_free()`, after its elements have been unreffed with `g_object_unref()`. [transfer full]

### gvir_connection_get_stream ()

    GVirStream *        gvir_connection_get_stream          (GVirConnection *conn,
                                                             guint flags);

`conn` : | a GVirConnection
`flags` : | flags to use for the stream
Returns : | a GVirStream stream, or NULL.The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_get_node_info ()

    GVirNodeInfo *      gvir_connection_get_node_info       (GVirConnection *conn,
                                                             GError **err);

`conn` : | a GVirConnection
`err` : | return location for any GError
Returns : | the info, or NULL if an error occurred. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_get_capabilities ()

    GVirConfigCapabilities * gvir_connection_get_capabilities
                                                            (GVirConnection *conn,
                                                             GError **err);

`conn` : | a GVirConnection
`err` : | return location for any GError
Returns : | a GVirConfigCapabilities or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_get_capabilities_async ()

    void                gvir_connection_get_capabilities_async
                                                            (GVirConnection *conn,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

`conn` : | a GVirConnection
`cancellable` : | cancellation object. [allow-none][transfer none]
`callback` : | completion callback. [scope async]
`user_data` : | opaque data for callback. [closure]

### gvir_connection_get_capabilities_finish ()

    GVirConfigCapabilities * gvir_connection_get_capabilities_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

`conn` : | a GVirConnection
`result` : | async method result. [transfer none]
Returns : | a GVirConfigCapabilities or NULL. The returned object should be unreffed with `g_object_unref()` when no longer needed. [transfer full]

### gvir_connection_restore_domain_from_file ()

    gboolean            gvir_connection_restore_domain_from_file
                                                            (GVirConnection *conn,
                                                             gchar *filename,
                                                             GVirConfigDomain *custom_conf,
                                                             guint flags,
                                                             GError **err);

Restores the domain saved with gvir_domain_save_to_file

`conn` : | a GVirConnection
`filename` : | path to input file
`custom_conf` : | configuration for domain or NULL. [allow-none]
`flags` : | the flags
Returns : | TRUE on success, FALSE otherwise

### gvir_connection_restore_domain_from_file_async ()

    void                gvir_connection_restore_domain_from_file_async
                                                            (GVirConnection *conn,
                                                             gchar *filename,
                                                             GVirConfigDomain *custom_conf,
                                                             guint flags,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronous variant of gvir_connection_restore_domain_from_file

`conn` : | a GVirConnection
`filename` : | path to input file
`custom_conf` : | configuration for domain. [allow-none]
`flags` : | the flags
`cancellable` : | cancellation object. [allow-none][transfer none]
`callback` : | completion callback. [scope async]
`user_data` : | opaque data for callback. [closure]

### gvir_connection_restore_domain_from_file_finish ()

    gboolean            gvir_connection_restore_domain_from_file_finish
                                                            (GVirConnection *conn,
                                                             GAsyncResult *result,
                                                             GError **err);

Finishes the operation started by gvir_restore_domain_from_file_async.

`conn` : | a GVirConnection
`result` : | async method result. [transfer none]
`err` : | Place-holder for possible errors
Returns : | TRUE if domain was restored successfully, FALSE otherwise.

## Property Details

### The `"handle"` property

      "handle"                   GVirConnectionHandle*  : Read / Write / Construct Only

The connection handle.

### The `"uri"` property

      "uri"                      gchar*                : Read / Write / Construct Only

The connection URI.

Default value: NULL

## Signal Details

### The `"connection-closed"` signal

    void                user_function                      (GVirConnection *gvirconnection,
                                                            gpointer        user_data)           : Run First

### The `"connection-opened"` signal

    void                user_function                      (GVirConnection *gvirconnection,
                                                            gpointer        user_data)           : Run First

### The `"domain-added"` signal

    void                user_function                      (GVirConnection *gvirconnection,
                                                            GVirDomain     *arg1,
                                                            gpointer        user_data)           : Run First

### The `"domain-removed"` signal

    void                user_function                      (GVirConnection *gvirconnection,
                                                            GVirDomain     *arg1,
                                                            gpointer        user_data)           : Run First