LibvirtGObject.Domain

g GObject.Object GObject.Object LibvirtGObject.Domain LibvirtGObject.Domain GObject.Object->LibvirtGObject.Domain

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

create_snapshot (custom_conf, flags)

create_snapshot_async (custom_conf, flags, cancellable, callback, *user_data)

create_snapshot_finish (result)

delete (flags)

fetch_snapshots (list_flags, cancellable)

fetch_snapshots_async (list_flags, cancellable, callback, *user_data)

fetch_snapshots_finish (res)

get_config (flags)

get_devices ()

get_has_current_snapshot (flags)

get_id ()

get_info ()

get_info_async (cancellable, callback, *user_data)

get_info_finish (result)

get_name ()

get_persistent ()

get_saved ()

get_snapshots ()

get_uuid ()

open_console (stream, devname, flags)

open_graphics (idx, fd, flags)

open_graphics_fd (idx, flags)

reboot (flags)

resume ()

resume_async (cancellable, callback, *user_data)

resume_finish (result)

save (flags)

save_async (flags, cancellable, callback, *user_data)

save_finish (result)

save_to_file (filename, custom_conf, flags)

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

save_to_file_finish (result)

screenshot (stream, monitor_id, flags)

set_config (conf)

set_time (date_time, flags)

set_time_async (date_time, flags, cancellable, callback, *user_data)

set_time_finish (result)

shutdown (flags)

start (flags)

start_async (flags, cancellable, callback, *user_data)

start_finish (result)

stop (flags)

suspend ()

update_device (device, flags)

wakeup (flags)

wakeup_async (flags, cancellable, callback, *user_data)

wakeup_finish (result)

Virtual Methods

Inherited:

GObject.Object (7)

do_pmsuspended ()

do_resumed ()

do_started ()

do_stopped ()

do_suspended ()

do_updated ()

Properties

Name

Type

Flags

Short Description

handle

r/w/co

The domain handle

persistent

bool

r

If domain is persistent

Signals

Inherited:

GObject.Object (1)

Name

Short Description

pmsuspended

resumed

started

stopped

suspended

updated

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class LibvirtGObject.Domain(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

LibvirtGObject.DomainClass

create_snapshot(custom_conf, flags)
Parameters:
Raises:

GLib.Error

Returns:

snapshot of domain. The returned object should be unreffed when no longer needed

Return type:

LibvirtGObject.DomainSnapshot

create_snapshot_async(custom_conf, flags, cancellable, callback, *user_data)
Parameters:
create_snapshot_finish(result)
Parameters:

result (Gio.AsyncResult) – Async method result

Raises:

GLib.Error

Returns:

The created snapshot

Return type:

LibvirtGObject.DomainSnapshot

delete(flags)
Parameters:

flags (int) – the flags

Raises:

GLib.Error

Return type:

bool

fetch_snapshots(list_flags, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

fetch_snapshots_async(list_flags, cancellable, callback, *user_data)
Parameters:
fetch_snapshots_finish(res)
Parameters:

res (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

get_config(flags)
Parameters:

flags (int) – the LibvirtGObject.DomainXMLFlags flags

Raises:

GLib.Error

Returns:

the config. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGConfig.Domain

get_devices()
Raises:

GLib.Error

Returns:

a newly allocated GLib.List of LibvirtGObject.DomainDevice.

Return type:

[LibvirtGObject.DomainDevice]

Gets the list of devices attached to self. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

get_has_current_snapshot(flags)
Parameters:

flags (int) – Unused, pass 0

Raises:

GLib.Error

Returns:

True on success, False otherwise.

has_current_snapshot:

Will be set to True if the given domain has a current snapshot and to False otherwise.

Return type:

(bool, has_current_snapshot: bool)

get_id()
Raises:

GLib.Error

Return type:

int

get_info()
Raises:

GLib.Error

Returns:

the info. The returned structure should be freed using GObject.boxed_free() with GVIR_TYPE_DOMAIN_INFO as the first argument when no longer needed.

Return type:

LibvirtGObject.DomainInfo

get_info_async(cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Domain.get_info.

get_info_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

the info. The returned object should be unreffed with GObject.Object.unref() when no longer needed.

Return type:

LibvirtGObject.DomainInfo

Finishes the operation started by LibvirtGObject.Domain.get_info_async.

get_name()
Return type:

str

get_persistent()
Returns:

True if domain is persistent, False otherwise.

Return type:

bool

get_saved()
Returns:

True if a stopped domain has a saved state to which it can be restored to using LibvirtGObject.Domain.start, False otherwise.

Return type:

bool

get_snapshots()
Returns:

A list of all the snapshots available for the given domain. The returned list should be freed with g_list_free(), after its elements have been unreffed with GObject.Object.unref().

Return type:

[LibvirtGObject.DomainSnapshot]

get_uuid()
Return type:

str

open_console(stream, devname, flags)
Parameters:
Raises:

GLib.Error

Returns:

True if the console was opened, False otherwise.

Return type:

bool

Open a text console for the domain self, connecting it to the stream stream. If devname is None, the default console will be opened, otherwise devname can be used to specify a non-default console device.

open_graphics(idx, fd, flags)
Parameters:
  • idx (int) – the graphics index

  • fd (int) – pre-opened socket pair

  • flags (int) – extra flags, currently unused

Raises:

GLib.Error

Returns:

True if the graphics connection was opened, False otherwise.

Return type:

bool

Open a connection to the local graphics display, connecting it to the socket pair file descriptor passed in as fd.

open_graphics_fd(idx, flags)
Parameters:
  • idx (int) – the graphics index

  • flags (int) – extra flags, currently unused

Raises:

GLib.Error

Returns:

An fd on success, -1 on failure.

Return type:

int

This will create a socket pair connected to the graphics backend of self. One end of the socket will be returned on success, and the other end is handed to the hypervisor. If self has multiple graphics backends configured, then idx will determine which one is opened, starting from idx 0.

New in version 0.2.0.

reboot(flags)
Parameters:

flags (int) – the LibvirtGObject.DomainRebootFlags flags

Raises:

GLib.Error

Return type:

bool

resume()
Raises:

GLib.Error

Returns:

True on success

Return type:

bool

resume_async(cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Domain.resume.

resume_finish(result)
Parameters:

result (Gio.AsyncResult) –

Raises:

GLib.Error

Return type:

bool

save(flags)
Parameters:

flags (int) – extra flags, currently unused

Raises:

GLib.Error

Returns:

True if domain was saved successfully, False otherwise.

Return type:

bool

Saves the state of the domain on disk and stops it. Use LibvirtGObject.Domain.start to restore the saved state of the domain. A saved domain can be restored even after shutdown/reboot of host machine.

save_async(flags, cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Domain.save.

save_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

True if domain was saved successfully, False otherwise.

Return type:

bool

Finishes the operation started by LibvirtGObject.Domain.save_async.

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

GLib.Error

Returns:

True on success, False otherwise

Return type:

bool

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

Asynchronous variant of LibvirtGObject.Domain.save_to_file

save_to_file_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

True if domain was saved successfully, False otherwise.

Return type:

bool

Finishes the operation started by LibvirtGObject.Domain.save_to_file_async.

screenshot(stream, monitor_id, flags)
Parameters:
  • stream (LibvirtGObject.Stream) – stream to use as output

  • monitor_id (int) – monitor ID to take screenshot from

  • flags (int) – extra flags, currently unused

Raises:

GLib.Error

Returns:

a newly allocated string containing the mime-type of the image format, or None upon error.

Return type:

str

set_config(conf)
Parameters:

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

Raises:

GLib.Error

Returns:

True on success, False if an error occurred.

Return type:

bool

Resets configuration of an existing domain.

Note: If domain is already running, the new configuration will not take affect until domain reboots.

set_time(date_time, flags)
Parameters:
Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

This function tries to set guest time to the given value. The passed time must in UTC.

If date_time is None, the time is reset using the domain’s RTC.

Please note that some hypervisors may require guest agent to be configured and running in order for this function to work.

set_time_async(date_time, flags, cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Domain.set_time.

set_time_finish(result)
Parameters:

result (Gio.AsyncResult) – async method result

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

Finishes the operation started by LibvirtGObject.Domain.set_time_async.

shutdown(flags)
Parameters:

flags (int) – the LibvirtGObject.DomainShutdownFlags flags

Raises:

GLib.Error

Return type:

bool

start(flags)
Parameters:

flags (int) – the flags

Raises:

GLib.Error

Return type:

bool

start_async(flags, cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Domain.start.

start_finish(result)
Parameters:

result (Gio.AsyncResult) –

Raises:

GLib.Error

Return type:

bool

stop(flags)
Parameters:

flags (int) – the flags

Raises:

GLib.Error

Return type:

bool

suspend()
Raises:

GLib.Error

Returns:

True if domain was suspended successfully, False otherwise.

Return type:

bool

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 LibvirtGObject.Domain.resume() to reactivate the domain.

update_device(device, flags)
Parameters:
Raises:

GLib.Error

Returns:

True if device was updated successfully, False otherwise.

Return type:

bool

Update the configuration of a device.

wakeup(flags)
Parameters:

flags (int) – placeholder for flags, pass 0

Raises:

GLib.Error

Returns:

True on success

Return type:

bool

wakeup_async(flags, cancellable, callback, *user_data)
Parameters:

Asynchronous variant of LibvirtGObject.Domain.wakeup.

wakeup_finish(result)
Parameters:

result (Gio.AsyncResult) –

Raises:

GLib.Error

Return type:

bool

do_pmsuspended() virtual
do_resumed() virtual
do_started() virtual
do_stopped() virtual
do_suspended() virtual
do_updated() virtual

Signal Details

LibvirtGObject.Domain.signals.pmsuspended(domain)
Signal Name:

pmsuspended

Flags:

RUN_LAST, NO_RECURSE, DETAILED, NO_HOOKS

Parameters:

domain (LibvirtGObject.Domain) – The object which received the signal

LibvirtGObject.Domain.signals.resumed(domain)
Signal Name:

resumed

Flags:

RUN_LAST, NO_RECURSE, DETAILED, NO_HOOKS

Parameters:

domain (LibvirtGObject.Domain) – The object which received the signal

LibvirtGObject.Domain.signals.started(domain)
Signal Name:

started

Flags:

RUN_LAST, NO_RECURSE, DETAILED, NO_HOOKS

Parameters:

domain (LibvirtGObject.Domain) – The object which received the signal

LibvirtGObject.Domain.signals.stopped(domain)
Signal Name:

stopped

Flags:

RUN_LAST, NO_RECURSE, DETAILED, NO_HOOKS

Parameters:

domain (LibvirtGObject.Domain) – The object which received the signal

LibvirtGObject.Domain.signals.suspended(domain)
Signal Name:

suspended

Flags:

RUN_LAST, NO_RECURSE, DETAILED, NO_HOOKS

Parameters:

domain (LibvirtGObject.Domain) – The object which received the signal

LibvirtGObject.Domain.signals.updated(domain)
Signal Name:

updated

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

domain (LibvirtGObject.Domain) – The object which received the signal

Property Details

LibvirtGObject.Domain.props.handle
Name:

handle

Type:

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The domain handle

LibvirtGObject.Domain.props.persistent
Name:

persistent

Type:

bool

Default Value:

True

Flags:

READABLE

If domain is persistent