LibvirtGObject.Connection

g GObject.Object GObject.Object LibvirtGObject.Connection LibvirtGObject.Connection GObject.Object->LibvirtGObject.Connection

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (uri)

close ()

create_domain (conf)

create_storage_pool (conf, flags)

fetch_domains (cancellable)

fetch_domains_async (cancellable, callback, *user_data)

fetch_domains_finish (result)

fetch_interfaces (cancellable)

fetch_interfaces_async (cancellable, callback, *user_data)

fetch_interfaces_finish (result)

fetch_networks (cancellable)

fetch_networks_async (cancellable, callback, *user_data)

fetch_networks_finish (result)

fetch_storage_pools (cancellable)

fetch_storage_pools_async (cancellable, callback, *user_data)

fetch_storage_pools_finish (result)

find_domain_by_id (id)

find_domain_by_name (name)

find_interface_by_mac (macaddr)

find_network_by_name (name)

find_storage_pool_by_name (name)

get_capabilities ()

get_capabilities_async (cancellable, callback, *user_data)

get_capabilities_finish (result)

get_domain (uuid)

get_domain_capabilities (emulatorbin, arch, machine, virttype, flags)

get_domain_capabilities_async (emulatorbin, arch, machine, virttype, flags, cancellable, callback, *user_data)

get_domain_capabilities_finish (result)

get_domains ()

get_hypervisor_name ()

get_interface (name)

get_interfaces ()

get_network (uuid)

get_networks ()

get_node_info ()

get_storage_pool (uuid)

get_storage_pools ()

get_stream (flags)

get_uri ()

get_version ()

is_open ()

is_read_only ()

open (cancellable)

open_async (cancellable, callback, *user_data)

open_finish (result)

open_read_only (cancellable)

open_read_only_async (cancellable, callback, *user_data)

open_read_only_finish (result)

restore_domain_from_file (filename, custom_conf, flags)

restore_domain_from_file_async (filename, custom_conf, flags, cancellable, callback, *user_data)

restore_domain_from_file_finish (result)

start_domain (conf, flags)

Virtual Methods

Inherited:

GObject.Object (7)

do_connection_closed ()

do_connection_opened ()

do_domain_added (dom)

do_domain_removed (dom)

Properties

Name

Type

Flags

Short Description

handle

r/w/co

The connection handle

uri

str

r/w/co

The connection URI

Signals

Inherited:

GObject.Object (1)

Name

Short Description

connection-closed

connection-opened

domain-added

domain-removed

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class LibvirtGObject.Connection(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

LibvirtGObject.ConnectionClass

classmethod new(uri)
Parameters:

uri (str) –

Return type:

LibvirtGObject.Connection

close()
create_domain(conf)
Parameters:

conf (LibvirtGConfig.Domain) – the configuration for the new domain

Raises:

GLib.Error

Returns:

the newly created domain, or None if an error occurred. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.Domain

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

create_storage_pool(conf, flags)
Parameters:
Raises:

GLib.Error

Returns:

the newly created storage pool, or None if an error occurred. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

Return type:

LibvirtGObject.StoragePool

fetch_domains(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – cancellation object

Raises:

GLib.Error

Return type:

bool

Use this method to fetch all domains managed by connection self. Use e.g. LibvirtGObject.Connection.find_domain_by_id or LibvirtGObject.Connection.get_domain afterwards to query the fetched domains.

fetch_domains_async(cancellable, callback, *user_data)
Parameters:
fetch_domains_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Return type:

bool

fetch_interfaces(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – cancellation object

Raises:

GLib.Error

Returns:

True on success, False otherwise and err is set.

Return type:

bool

Use this method to fetch information on all network interfaces managed by connection self on host machine. Use LibvirtGObject.Connection.get_interfaces or LibvirtGObject.Connection.get_interface afterwards to query the fetched interfaces.

fetch_interfaces_async(cancellable, callback, *user_data)
Parameters:
fetch_interfaces_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Return type:

bool

fetch_networks(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – cancellation object

Raises:

GLib.Error

Return type:

bool

Use this method to fetch all networks managed by connection self. Use e.g. LibvirtGObject.Connection.find_network_by_name or LibvirtGObject.Connection.get_networks afterwards to query the fetched domains.

fetch_networks_async(cancellable, callback, *user_data)
Parameters:
fetch_networks_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Return type:

bool

fetch_storage_pools(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – cancellation object

Raises:

GLib.Error

Return type:

bool

Use this method to fetch all storage pools managed by connection self. Use e.g. LibvirtGObject.Connection.find_storage_pool_by_name or LibvirtGObject.Connection.get_storage_pools afterwards to query the fetched pools.

fetch_storage_pools_async(cancellable, callback, *user_data)
Parameters:
fetch_storage_pools_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Return type:

bool

find_domain_by_id(id)
Parameters:

id (int) – id of the requested domain

Returns:

the LibvirtGObject.Domain, or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.Domain

find_domain_by_name(name)
Parameters:

name (str) – name of the requested domain

Returns:

the LibvirtGObject.Domain, or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.Domain

find_interface_by_mac(macaddr)
Parameters:

macaddr (str) – MAC address to lookup

Returns:

A new reference to a LibvirtGObject.Interface, or None if no interface exists with MAC address mac. The returned object must be unreffed using GObject.Object.unref() once used.

Return type:

LibvirtGObject.Interface

Get a particular interface which has MAC address mac.

find_network_by_name(name)
Parameters:

name (str) – name of the network to search for

Returns:

A new reference to a LibvirtGObject.Network, or None if no network exists with name name. The returned object must be unreffed using GObject.Object.unref() once used.

Return type:

LibvirtGObject.Network

Get a particular network which has name name.

find_storage_pool_by_name(name)
Parameters:

name (str) – name of the requested storage pool

Returns:

the LibvirtGObject.StoragePool, or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.StoragePool

get_capabilities()
Raises:

GLib.Error

Returns:

a LibvirtGConfig.Capabilities or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGConfig.Capabilities

get_capabilities_async(cancellable, callback, *user_data)
Parameters:
get_capabilities_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

a LibvirtGConfig.Capabilities or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGConfig.Capabilities

get_domain(uuid)
Parameters:

uuid (str) – uuid string of the requested domain

Returns:

the LibvirtGObject.Domain, or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.Domain

get_domain_capabilities(emulatorbin, arch, machine, virttype, flags)
Parameters:
  • emulatorbin (str or None) – path to emulator

  • arch (str or None) – domain architecture

  • machine (str or None) – machine type

  • virttype (str or None) – virtualization type

  • flags (int) – extra flags; not used yet, so callers should always pass 0

Raises:

GLib.Error

Returns:

a LibvirtGConfig.DomainCapabilities or None. The return object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGConfig.DomainCapabilities

get_domain_capabilities_async(emulatorbin, arch, machine, virttype, flags, cancellable, callback, *user_data)
Parameters:
  • emulatorbin (str or None) – path to emulator

  • arch (str or None) – domain architecture

  • machine (str or None) – machine type

  • virttype (str or None) – virtualization type

  • flags (int) – extra flags; not used yet, so callers should always pass 0

  • cancellable (Gio.Cancellable or None) – cancellation object

  • callback (Gio.AsyncReadyCallback or None) – completion callback

  • user_data (object or None) – opaque data for callback

get_domain_capabilities_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

a LibvirtGConfig.DomainCapabilities or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGConfig.DomainCapabilities

get_domains()
Returns:

List of LibvirtGObject.Domain. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

Return type:

[LibvirtGObject.Domain]

Gets a list of the domains available through self.

get_hypervisor_name()
Raises:

GLib.Error

Returns:

new string that should be freed when no longer needed, or None upon error.

Return type:

str

Get name of current hypervisor used.

get_interface(name)
Parameters:

name (str) – interface name to lookup

Returns:

A new reference to a LibvirtGObject.Interface, or None if no interface exists with name name. The returned object must be unreffed using GObject.Object.unref() once used.

Return type:

LibvirtGObject.Interface

Get a particular interface which has name name.

get_interfaces()
Returns:

List of LibvirtGObject.Interface. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

Return type:

[LibvirtGObject.Interface]

Get a list of all the network interfaces managed by connection self on host machine.

get_network(uuid)
Parameters:

uuid (str) – UUID of the network to lookup

Returns:

A new reference to a LibvirtGObject.Network, or None if no network exists with UUID uuid. The returned object must be unreffed using GObject.Object.unref() once used.

Return type:

LibvirtGObject.Network

Get a particular network which has UUID uuid.

get_networks()
Returns:

List of LibvirtGObject.Network. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

Return type:

[LibvirtGObject.Network]

Get a list of all the network networks available through self.

get_node_info()
Raises:

GLib.Error

Returns:

the info, or None if an error occurred. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.NodeInfo

get_storage_pool(uuid)
Parameters:

uuid (str) – uuid string of the requested storage pool

Returns:

the LibvirtGObject.StoragePool, or None. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.StoragePool

get_storage_pools()
Returns:

List of LibvirtGObject.StoragePool. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

Return type:

[LibvirtGObject.StoragePool]

Gets a list of the storage pools available through self.

get_stream(flags)
Parameters:

flags (int) – flags to use for the stream

Returns:

a LibvirtGObject.Stream stream, or None.The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.Stream

get_uri()
Return type:

str

get_version()
Raises:

GLib.Error

Returns:

version on success, 0 otherwise and err set.

Return type:

int

Get version of current hypervisor used.

is_open()
Return type:

bool

is_read_only()
Return type:

bool

open(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – cancellation object

Raises:

GLib.Error

Return type:

bool

open_async(cancellable, callback, *user_data)
Parameters:
open_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Return type:

bool

open_read_only(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) –

Raises:

GLib.Error

Return type:

bool

open_read_only_async(cancellable, callback, *user_data)
Parameters:
open_read_only_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Return type:

bool

restore_domain_from_file(filename, custom_conf, flags)
Parameters:
Raises:

GLib.Error

Returns:

True on success, False otherwise

Return type:

bool

Restores the domain saved with LibvirtGObject.Domain.save_to_file

restore_domain_from_file_async(filename, custom_conf, flags, cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Connection.restore_domain_from_file

restore_domain_from_file_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

True if domain was restored successfully, False otherwise.

Return type:

bool

Finishes the operation started by #gvir_restore_domain_from_file_async.

start_domain(conf, flags)
Parameters:
Raises:

GLib.Error

Returns:

the newly created domain, or None if an error occurred. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.Domain

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

do_connection_closed() virtual
do_connection_opened() virtual
do_domain_added(dom) virtual
Parameters:

dom (LibvirtGObject.Domain) –

do_domain_removed(dom) virtual
Parameters:

dom (LibvirtGObject.Domain) –

Signal Details

LibvirtGObject.Connection.signals.connection_closed(connection)
Signal Name:

connection-closed

Flags:

RUN_FIRST

Parameters:

connection (LibvirtGObject.Connection) – The object which received the signal

LibvirtGObject.Connection.signals.connection_opened(connection)
Signal Name:

connection-opened

Flags:

RUN_FIRST

Parameters:

connection (LibvirtGObject.Connection) – The object which received the signal

LibvirtGObject.Connection.signals.domain_added(connection, object)
Signal Name:

domain-added

Flags:

RUN_FIRST

Parameters:
LibvirtGObject.Connection.signals.domain_removed(connection, object)
Signal Name:

domain-removed

Flags:

RUN_FIRST

Parameters:

Property Details

LibvirtGObject.Connection.props.handle
Name:

handle

Type:

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The connection handle

LibvirtGObject.Connection.props.uri
Name:

uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The connection URI