Functions¶
|
|
|
|
|
|
|
Details¶
- LibvirtGLib.error_new_literal(domain, code, message)¶
- Parameters:
- Returns:
a new
GLib.Error
- Return type:
Creates a new
GLib.Error
; unlike gvir_error_new(), message is not a printf()-style format string. Use this function if message contains text you don’t have control over, that could include printf() escape sequences.
- LibvirtGLib.event_register()¶
Registers a libvirt event loop implementation that is backed by the default GMain context. If invoked more than once this method will be a no-op. Applications should, however, take care not to register any another non-GLib event loop with libvirt.
After invoking this method, it is mandatory to run the default GMain event loop. Typically this can be satisfied by invoking gtk_main or g_application_run in the application’s main thread. Failure to run the event loop will mean no libvirt events get dispatched, and the libvirt keepalive timer will kill off libvirt connections frequently.
- LibvirtGLib.init(argv)¶
- Parameters:
Address of the
argv parameter of main(), or
None
. Any options understood by GTK+ are stripped before return.- Returns:
Address of the
argv parameter of main(), or
None
. Any options understood by GTK+ are stripped before return.- Return type:
argv: [
str
]
Call this function before using any other Libvirt GLib functions in your applications. It will initialize everything needed to operate the toolkit and parses some standard command line options.
Although you are expected to pass the argc, argv parameters from main() to this function, it is possible to pass
None
if argv is not available or commandline handling is not required.argc and argv are adjusted accordingly so your own code will never see those standard arguments.
This method will also turn on debug logging of the library if the
LIBVIRT_GLIB_DEBUG
environment variable is set.This function will terminate your program if it was unable to initialize for some reason. If you want the program to fall back to an alternate mode of operation call
LibvirtGLib.init_check
instead.
- LibvirtGLib.init_check(argv)¶
- Parameters:
Address of the
argv parameter of main(), or
None
. Any options understood by GTK+ are stripped before return.- Raises:
- Returns:
True
if the library was successfully initialized,False
otherwise- argv:
Address of the
argv parameter of main(), or
None
. Any options understood by GTK+ are stripped before return.
- Return type:
This function does the same work as
LibvirtGLib.init
() with only a single change: It does not terminate the program if the Libvirt GLib library can’t be initialized. Instead it returnsFalse
on failure.This way the application can fall back to some other mode of operation.
- LibvirtGLib.set_error_literal(error, domain, code, message)¶
- Parameters:
error (
GLib.Error
) – pointer to error locationdomain (
int
) – error domaincode (
int
) – error codemessage (
str
) – error message
If error is
None
this does nothing. Otherwise it creates a newGLib.Error
and stores it in error; unlike gvir_set_error(), message is not a printf()-style format string. Use this function if message contains text you don’t have control over, that could include printf() escape sequences.