## GVirConnection GVirConnection |

## Functions

GVirConnection * | gvir_connection_new ()
gboolean | gvir_connection_open ()
gboolean | gvir_connection_open_read_only ()
void | gvir_connection_open_async ()
gboolean | gvir_connection_open_finish ()
void | gvir_connection_open_read_only_async ()
gboolean | gvir_connection_open_read_only_finish ()
gboolean | gvir_connection_is_open ()
gboolean | gvir_connection_is_read_only ()
void | gvir_connection_close ()
gboolean | gvir_connection_fetch_domains ()
void | gvir_connection_fetch_domains_async ()
gboolean | gvir_connection_fetch_domains_finish ()
const gchar * | gvir_connection_get_uri ()
gchar * | gvir_connection_get_hypervisor_name ()
gulong | gvir_connection_get_version ()
GList * | gvir_connection_get_domains ()
GVirDomain * | gvir_connection_get_domain ()
GVirDomain * | gvir_connection_find_domain_by_id ()
GVirDomain * | gvir_connection_find_domain_by_name ()
GVirDomain * | gvir_connection_create_domain ()
GVirDomain * | gvir_connection_start_domain ()
GList * | gvir_connection_get_interfaces ()
GVirInterface * | gvir_connection_get_interface ()
GVirInterface * | gvir_connection_find_interface_by_mac ()
GList * | gvir_connection_get_networks ()
GVirNetwork * | gvir_connection_get_network ()
GVirNetwork * | gvir_connection_find_network_by_name ()
GList * | gvir_connection_get_network_filters ()
GVirNetworkFilter * | gvir_connection_get_network_filter ()
GVirNetworkFilter * | gvir_connection_find_network_filter_by_name ()
GList * | gvir_connection_get_node_devices ()
GVirNodeDevice * | gvir_connection_get_node_device ()
GList * | gvir_connection_get_secrets ()
GVirSecret * | gvir_connection_get_secret ()
gboolean | gvir_connection_fetch_storage_pools ()
void | gvir_connection_fetch_storage_pools_async ()
gboolean | gvir_connection_fetch_storage_pools_finish ()
GList * | gvir_connection_get_storage_pools ()
GVirStoragePool * | gvir_connection_get_storage_pool ()
GVirStoragePool * | gvir_connection_find_storage_pool_by_name ()
GVirStoragePool * | gvir_connection_create_storage_pool ()
GVirStream * | gvir_connection_get_stream ()
GVirNodeInfo * | gvir_connection_get_node_info ()
GVirConfigCapabilities * | gvir_connection_get_capabilities ()
void | gvir_connection_get_capabilities_async ()
GVirConfigCapabilities * | gvir_connection_get_capabilities_finish ()
gboolean | gvir_connection_restore_domain_from_file ()
void | gvir_connection_restore_domain_from_file_async ()
gboolean | gvir_connection_restore_domain_from_file_finish ()

## Properties

GVirConnectionHandle * | handle | Read / Write / Construct Only
gchar * | uri | Read / Write / Construct Only

## Signals

void | connection-closed | Run First
void | connection-opened | Run First
void | domain-added | Run First
void | domain-removed | Run First

## Object Hierarchy

        GBoxed
        ╰── GVirNodeInfo
        GObject
        ╰── GVirConnection

## Description

## Functions

### gvir_connection_new ()

    GVirConnection *
    gvir_connection_new (const char *uri);

### gvir_connection_open ()

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

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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.

#### Parameters

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.

#### Parameters

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` .

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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` .

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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

#### Parameters

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

#### Parameters

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.

#### Parameters

conn | a GVirConnection |
result | async method result. | [transfer none]
err | Place-holder for possible errors |

#### Returns

TRUE if domain was restored successfully, FALSE otherwise.

## Types and Values

## Property Details

### The `“handle”` property

      “handle”                   GVirConnectionHandle *

The connection handle.

Flags: Read / Write / Construct Only

### The `“uri”` property

      “uri”                      gchar *

The connection URI.

Flags: Read / Write / Construct Only

Default value: NULL

## Signal Details

### The `“connection-closed”` signal

    void
    user_function (GVirConnection *gvirconnection,
                   gpointer        user_data)

Flags: Run First

### The `“connection-opened”` signal

    void
    user_function (GVirConnection *gvirconnection,
                   gpointer        user_data)

Flags: Run First

### The `“domain-added”` signal

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

Flags: Run First

### The `“domain-removed”` signal

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

Flags: Run First