Module virterror from libvirt

Provides the interfaces of the libvirt library to handle errors raised while using the library.

Table of Contents

Types

typedef struct _virError virError
typedef enum virErrorDomain
typedef enum virErrorLevel
typedef enum virErrorNumber
typedef virError * virErrorPtr

Functions

int	virConnCopyLastError		(virConnectPtr conn, 
virErrorPtr to) virErrorPtr virConnGetLastError (virConnectPtr conn) void virConnResetLastError (virConnectPtr conn) void virConnSetErrorFunc (virConnectPtr conn,
void * userData,
virErrorFunc handler) int virCopyLastError (virErrorPtr to) void virDefaultErrorFunc (virErrorPtr err) typedef virErrorFunc void virErrorFunc (void * userData,
virErrorPtr error) void virFreeError (virErrorPtr err) virErrorPtr virGetLastError (void) void virResetError (virErrorPtr err) void virResetLastError (void) virErrorPtr virSaveLastError (void) void virSetErrorFunc (void * userData,
virErrorFunc handler)

Description

Types

virError

struct virError{
intcode : The error code, a virErrorNumber
intdomain : What part of the library raised this error
char *message : human-readable informative error message
virErrorLevellevel : how consequent is the error
virConnectPtrconn : connection if available, deprecated see note above
virDomainPtrdom : domain if available, deprecated see note above
char *str1 : extra string information
char *str2 : extra string information
char *str3 : extra string information
intint1 : extra number information
intint2 : extra number information
virNetworkPtrnet : network if available, deprecated see note above
}

virErrorDomain

enum virErrorDomain {
VIR_FROM_NONE = 0
VIR_FROM_XEN = 1 : Error at Xen hypervisor layer
VIR_FROM_XEND = 2 : Error at connection with xend daemon
VIR_FROM_XENSTORE = 3 : Error at connection with xen store
VIR_FROM_SEXPR = 4 : Error in the S-Expression code
VIR_FROM_XML = 5 : Error in the XML code
VIR_FROM_DOM = 6 : Error when operating on a domain
VIR_FROM_RPC = 7 : Error in the XML-RPC code
VIR_FROM_PROXY = 8 : Error in the proxy code; unused since 0.8.6
VIR_FROM_CONF = 9 : Error in the configuration file handling
VIR_FROM_QEMU = 10 : Error at the QEMU daemon
VIR_FROM_NET = 11 : Error when operating on a network
VIR_FROM_TEST = 12 : Error from test driver
VIR_FROM_REMOTE = 13 : Error from remote driver
VIR_FROM_OPENVZ = 14 : Error from OpenVZ driver
VIR_FROM_XENXM = 15 : Error at Xen XM layer
VIR_FROM_STATS_LINUX = 16 : Error in the Linux Stats code
VIR_FROM_LXC = 17 : Error from Linux Container driver
VIR_FROM_STORAGE = 18 : Error from storage driver
VIR_FROM_NETWORK = 19 : Error from network config
VIR_FROM_DOMAIN = 20 : Error from domain config
VIR_FROM_UML = 21 : Error at the UML driver
VIR_FROM_NODEDEV = 22 : Error from node device monitor
VIR_FROM_XEN_INOTIFY = 23 : Error from xen inotify layer
VIR_FROM_SECURITY = 24 : Error from security framework
VIR_FROM_VBOX = 25 : Error from VirtualBox driver
VIR_FROM_INTERFACE = 26 : Error when operating on an interface
VIR_FROM_ONE = 27 : Error from OpenNebula driver
VIR_FROM_ESX = 28 : Error from ESX driver
VIR_FROM_PHYP = 29 : Error from IBM power hypervisor
VIR_FROM_SECRET = 30 : Error from secret storage
VIR_FROM_CPU = 31 : Error from CPU driver
VIR_FROM_XENAPI = 32 : Error from XenAPI
VIR_FROM_NWFILTER = 33 : Error from network filter driver
VIR_FROM_HOOK = 34 : Error from Synchronous hooks
VIR_FROM_DOMAIN_SNAPSHOT = 35 : Error from domain snapshot
VIR_FROM_AUDIT = 36 : Error from auditing subsystem
VIR_FROM_SYSINFO = 37 : Error from sysinfo/SMBIOS
}

virErrorLevel

enum virErrorLevel {
VIR_ERR_NONE = 0
VIR_ERR_WARNING = 1 : A simple warning
VIR_ERR_ERROR = 2 : An error
}

virErrorNumber

enum virErrorNumber {
VIR_ERR_OK = 0
VIR_ERR_INTERNAL_ERROR = 1 : internal error
VIR_ERR_NO_MEMORY = 2 : memory allocation failure
VIR_ERR_NO_SUPPORT = 3 : no support for this function
VIR_ERR_UNKNOWN_HOST = 4 : could not resolve hostname
VIR_ERR_NO_CONNECT = 5 : can't connect to hypervisor
VIR_ERR_INVALID_CONN = 6 : invalid connection object
VIR_ERR_INVALID_DOMAIN = 7 : invalid domain object
VIR_ERR_INVALID_ARG = 8 : invalid function argument
VIR_ERR_OPERATION_FAILED = 9 : a command to hypervisor failed
VIR_ERR_GET_FAILED = 10 : a HTTP GET command to failed
VIR_ERR_POST_FAILED = 11 : a HTTP POST command to failed
VIR_ERR_HTTP_ERROR = 12 : unexpected HTTP error code
VIR_ERR_SEXPR_SERIAL = 13 : failure to serialize an S-Expr
VIR_ERR_NO_XEN = 14 : could not open Xen hypervisor control
VIR_ERR_XEN_CALL = 15 : failure doing an hypervisor call
VIR_ERR_OS_TYPE = 16 : unknown OS type
VIR_ERR_NO_KERNEL = 17 : missing kernel information
VIR_ERR_NO_ROOT = 18 : missing root device information
VIR_ERR_NO_SOURCE = 19 : missing source device information
VIR_ERR_NO_TARGET = 20 : missing target device information
VIR_ERR_NO_NAME = 21 : missing domain name information
VIR_ERR_NO_OS = 22 : missing domain OS information
VIR_ERR_NO_DEVICE = 23 : missing domain devices information
VIR_ERR_NO_XENSTORE = 24 : could not open Xen Store control
VIR_ERR_DRIVER_FULL = 25 : too many drivers registered
VIR_ERR_CALL_FAILED = 26 : not supported by the drivers (DEPRECATED)
VIR_ERR_XML_ERROR = 27 : an XML description is not well formed or broken
VIR_ERR_DOM_EXIST = 28 : the domain already exist
VIR_ERR_OPERATION_DENIED = 29 : operation forbidden on read-only connections
VIR_ERR_OPEN_FAILED = 30 : failed to open a conf file
VIR_ERR_READ_FAILED = 31 : failed to read a conf file
VIR_ERR_PARSE_FAILED = 32 : failed to parse a conf file
VIR_ERR_CONF_SYNTAX = 33 : failed to parse the syntax of a conf file
VIR_ERR_WRITE_FAILED = 34 : failed to write a conf file
VIR_ERR_XML_DETAIL = 35 : detail of an XML error
VIR_ERR_INVALID_NETWORK = 36 : invalid network object
VIR_ERR_NETWORK_EXIST = 37 : the network already exist
VIR_ERR_SYSTEM_ERROR = 38 : general system call failure
VIR_ERR_RPC = 39 : some sort of RPC error
VIR_ERR_GNUTLS_ERROR = 40 : error from a GNUTLS call
VIR_WAR_NO_NETWORK = 41 : failed to start network
VIR_ERR_NO_DOMAIN = 42 : domain not found or unexpectedly disappeared
VIR_ERR_NO_NETWORK = 43 : network not found
VIR_ERR_INVALID_MAC = 44 : invalid MAC address
VIR_ERR_AUTH_FAILED = 45 : authentication failed
VIR_ERR_INVALID_STORAGE_POOL = 46 : invalid storage pool object
VIR_ERR_INVALID_STORAGE_VOL = 47 : invalid storage vol object
VIR_WAR_NO_STORAGE = 48 : failed to start storage
VIR_ERR_NO_STORAGE_POOL = 49 : storage pool not found
VIR_ERR_NO_STORAGE_VOL = 50 : storage pool not found
VIR_WAR_NO_NODE = 51 : failed to start node driver
VIR_ERR_INVALID_NODE_DEVICE = 52 : invalid node device object
VIR_ERR_NO_NODE_DEVICE = 53 : node device not found
VIR_ERR_NO_SECURITY_MODEL = 54 : security model not found
VIR_ERR_OPERATION_INVALID = 55 : operation is not applicable at this time
VIR_WAR_NO_INTERFACE = 56 : failed to start interface driver
VIR_ERR_NO_INTERFACE = 57 : interface driver not running
VIR_ERR_INVALID_INTERFACE = 58 : invalid interface object
VIR_ERR_MULTIPLE_INTERFACES = 59 : more than one matching interface found
VIR_WAR_NO_NWFILTER = 60 : failed to start nwfilter driver
VIR_ERR_INVALID_NWFILTER = 61 : invalid nwfilter object
VIR_ERR_NO_NWFILTER = 62 : nw filter pool not found
VIR_ERR_BUILD_FIREWALL = 63 : nw filter pool not found
VIR_WAR_NO_SECRET = 64 : failed to start secret storage
VIR_ERR_INVALID_SECRET = 65 : invalid secret
VIR_ERR_NO_SECRET = 66 : secret not found
VIR_ERR_CONFIG_UNSUPPORTED = 67 : unsupported configuration construct
VIR_ERR_OPERATION_TIMEOUT = 68 : timeout occurred during operation
VIR_ERR_MIGRATE_PERSIST_FAILED = 69 : a migration worked, but making the VM persist on the dest host failed
VIR_ERR_HOOK_SCRIPT_FAILED = 70 : a synchronous hook script failed
VIR_ERR_INVALID_DOMAIN_SNAPSHOT = 71 : invalid domain snapshot
VIR_ERR_NO_DOMAIN_SNAPSHOT = 72 : domain snapshot not found
}

Functions

virConnCopyLastError

int	virConnCopyLastError		(virConnectPtr conn, 
virErrorPtr to)

Copy the content of the last error caught on that connection This method is not protected against access from multiple threads. In a multi-threaded application, always use the global virGetLastError() API which is backed by thread local storage. If the connection object was discovered to be invalid by an API call, then the error will be reported against the global error object. Since 0.6.0, all errors reported in the per-connection object are also duplicated in the global error object. As such an application can always use virGetLastError(). This method remains for backwards compatability. One will need to free the result with virResetError()

conn:pointer to the hypervisor connection
to:target to receive the copy
Returns:0 if no error was found and the error code otherwise and -1 in case of parameter error.

virConnGetLastError

virErrorPtr	virConnGetLastError	(virConnectPtr conn)

Provide a pointer to the last error caught on that connection This method is not protected against access from multiple threads. In a multi-threaded application, always use the global virGetLastError() API which is backed by thread local storage. If the connection object was discovered to be invalid by an API call, then the error will be reported against the global error object. Since 0.6.0, all errors reported in the per-connection object are also duplicated in the global error object. As such an application can always use virGetLastError(). This method remains for backwards compatability.

conn:pointer to the hypervisor connection
Returns:a pointer to the last error or NULL if none occurred.

virConnResetLastError

void	virConnResetLastError		(virConnectPtr conn)

The error object is kept in thread local storage, so separate threads can safely access this concurrently. Reset the last error caught on that connection

conn:pointer to the hypervisor connection

virConnSetErrorFunc

void	virConnSetErrorFunc		(virConnectPtr conn, 
void * userData,
virErrorFunc handler)

Set a connection error handling function, if @handler is NULL it will reset to default which is to pass error back to the global library handler.

conn:pointer to the hypervisor connection
userData:pointer to the user data provided in the handler callback
handler:the function to get called in case of error or NULL

virCopyLastError

int	virCopyLastError		(virErrorPtr to)

Copy the content of the last error caught at the library level The error object is kept in thread local storage, so separate threads can safely access this concurrently. One will need to free the result with virResetError()

to:target to receive the copy
Returns:0 if no error was found and the error code otherwise and -1 in case of parameter error.

virDefaultErrorFunc

void	virDefaultErrorFunc		(virErrorPtr err)

Default routine reporting an error to stderr.

err:pointer to the error.

virErrorFunc

typedef void	(*virErrorFunc		)	(void * userData, 
virErrorPtr error)

Signature of a function to use when there is an error raised by the library.

userData:user provided data for the error callback
error:the error being raised.

virFreeError

void	virFreeError			(virErrorPtr err)

Resets and frees the given error.

err:error to free

virGetLastError

virErrorPtr	virGetLastError		(void)

Provide a pointer to the last error caught at the library level The error object is kept in thread local storage, so separate threads can safely access this concurrently.

Returns:a pointer to the last error or NULL if none occurred.

virResetError

void	virResetError			(virErrorPtr err)

Reset the error being pointed to

err:pointer to the virError to clean up

virResetLastError

void	virResetLastError		(void)

Reset the last error caught at the library level. The error object is kept in thread local storage, so separate threads can safely access this concurrently, only resetting their own error object.

virSaveLastError

virErrorPtr	virSaveLastError	(void)

Save the last error into a new error object.

Returns:a pointer to the copied error or NULL if allocation failed. It is the caller's responsibility to free the error with virFreeError().

virSetErrorFunc

void	virSetErrorFunc			(void * userData, 
virErrorFunc handler)

Set a library global error handling function, if @handler is NULL, it will reset to default printing on stderr. The error raised there are those for which no handler at the connection level could caught.

userData:pointer to the user data provided in the handler callback
handler:the function to get called in case of error or NULL

Module libvirt from libvirt

Provides the interfaces of the libvirt library to handle virtualized domains

Table of Contents

Macros

#define LIBVIR_VERSION_NUMBER
#define VIR_COPY_CPUMAP
#define VIR_CPU_MAPLEN
#define VIR_CPU_USABLE
#define VIR_DOMAIN_EVENT_CALLBACK
#define VIR_DOMAIN_SCHED_FIELD_LENGTH
#define VIR_GET_CPUMAP
#define VIR_NODEINFO_MAXCPUS
#define VIR_SECURITY_DOI_BUFLEN
#define VIR_SECURITY_LABEL_BUFLEN
#define VIR_SECURITY_MODEL_BUFLEN
#define VIR_UNUSE_CPU
#define VIR_USE_CPU
#define VIR_UUID_BUFLEN
#define VIR_UUID_STRING_BUFLEN

Types

typedef enum virCPUCompareResult
typedef struct _virConnect virConnect
typedef struct _virConnectAuth virConnectAuth
typedef virConnectAuth * virConnectAuthPtr
typedef struct _virConnectCredential virConnectCredential
typedef virConnectCredential * virConnectCredentialPtr
typedef enum virConnectCredentialType
typedef enum virConnectFlags
typedef virConnect * virConnectPtr
typedef struct _virDomain virDomain
typedef struct _virDomainBlockInfo virDomainBlockInfo
typedef virDomainBlockInfo * virDomainBlockInfoPtr
typedef virDomainBlockStatsStruct * virDomainBlockStatsPtr
typedef struct _virDomainBlockStats virDomainBlockStatsStruct
typedef enum virDomainCoreDumpFlags
typedef enum virDomainCreateFlags
typedef enum virDomainDeviceModifyFlags
typedef enum virDomainEventDefinedDetailType
typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress
typedef virDomainEventGraphicsAddress * virDomainEventGraphicsAddressPtr
typedef enum virDomainEventGraphicsAddressType
typedef enum virDomainEventGraphicsPhase
typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject
typedef struct _virDomainEventGraphicsSubjectIdentity virDomainEventGraphicsSubjectIdentity
typedef virDomainEventGraphicsSubjectIdentity * virDomainEventGraphicsSubjectIdentityPtr
typedef virDomainEventGraphicsSubject * virDomainEventGraphicsSubjectPtr
typedef enum virDomainEventID
typedef enum virDomainEventIOErrorAction
typedef enum virDomainEventResumedDetailType
typedef enum virDomainEventStartedDetailType
typedef enum virDomainEventStoppedDetailType
typedef enum virDomainEventSuspendedDetailType
typedef enum virDomainEventType
typedef enum virDomainEventUndefinedDetailType
typedef enum virDomainEventWatchdogAction
typedef struct _virDomainInfo virDomainInfo
typedef virDomainInfo * virDomainInfoPtr
typedef virDomainInterfaceStatsStruct * virDomainInterfaceStatsPtr
typedef struct _virDomainInterfaceStats virDomainInterfaceStatsStruct
typedef struct _virDomainJobInfo virDomainJobInfo
typedef virDomainJobInfo * virDomainJobInfoPtr
typedef enum virDomainJobType
typedef enum virDomainMemoryFlags
typedef virDomainMemoryStatStruct * virDomainMemoryStatPtr
typedef struct _virDomainMemoryStat virDomainMemoryStatStruct
typedef enum virDomainMemoryStatTags
typedef enum virDomainMigrateFlags
typedef virDomain * virDomainPtr
typedef struct _virDomainSnapshot virDomainSnapshot
typedef enum virDomainSnapshotDeleteFlags
typedef virDomainSnapshot * virDomainSnapshotPtr
typedef enum virDomainState
typedef enum virDomainXMLFlags
typedef enum virEventHandleType
typedef struct _virInterface virInterface
typedef virInterface * virInterfacePtr
typedef enum virInterfaceXMLFlags
typedef struct _virNWFilter virNWFilter
typedef virNWFilter * virNWFilterPtr
typedef struct _virNetwork virNetwork
typedef virNetwork * virNetworkPtr
typedef struct _virNodeDevice virNodeDevice
typedef virNodeDevice * virNodeDevicePtr
typedef struct _virNodeInfo virNodeInfo
typedef virNodeInfo * virNodeInfoPtr
typedef struct _virSchedParameter virSchedParameter
typedef virSchedParameter * virSchedParameterPtr
typedef enum virSchedParameterType
typedef struct _virSecret virSecret
typedef virSecret * virSecretPtr
typedef enum virSecretUsageType
typedef struct _virSecurityLabel virSecurityLabel
typedef virSecurityLabel * virSecurityLabelPtr
typedef struct _virSecurityModel virSecurityModel
typedef virSecurityModel * virSecurityModelPtr
typedef struct _virStoragePool virStoragePool
typedef enum virStoragePoolBuildFlags
typedef enum virStoragePoolDeleteFlags
typedef struct _virStoragePoolInfo virStoragePoolInfo
typedef virStoragePoolInfo * virStoragePoolInfoPtr
typedef virStoragePool * virStoragePoolPtr
typedef enum virStoragePoolState
typedef struct _virStorageVol virStorageVol
typedef enum virStorageVolDeleteFlags
typedef struct _virStorageVolInfo virStorageVolInfo
typedef virStorageVolInfo * virStorageVolInfoPtr
typedef virStorageVol * virStorageVolPtr
typedef enum virStorageVolType
typedef struct _virStream virStream
typedef enum virStreamEventType
typedef enum virStreamFlags
typedef virStream * virStreamPtr
typedef struct _virVcpuInfo virVcpuInfo
typedef virVcpuInfo * virVcpuInfoPtr
typedef enum virVcpuState

Functions

typedef virConnectAuthCallbackPtr
int	virConnectAuthCallbackPtr	(virConnectCredentialPtr cred, 
unsigned int ncred,
void * cbdata) char * virConnectBaselineCPU (virConnectPtr conn,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags) int virConnectClose (virConnectPtr conn) int virConnectCompareCPU (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) typedef virConnectDomainEventCallback int virConnectDomainEventCallback (virConnectPtr conn,
virDomainPtr dom,
int event,
int detail,
void * opaque) int virConnectDomainEventDeregister (virConnectPtr conn,
virConnectDomainEventCallback cb) int virConnectDomainEventDeregisterAny (virConnectPtr conn,
int callbackID) typedef virConnectDomainEventGenericCallback void virConnectDomainEventGenericCallback (virConnectPtr conn,
virDomainPtr dom,
void * opaque) typedef virConnectDomainEventGraphicsCallback void virConnectDomainEventGraphicsCallback (virConnectPtr conn,
virDomainPtr dom,
int phase,
virDomainEventGraphicsAddressPtr local,
virDomainEventGraphicsAddressPtr remote,
const char * authScheme,
virDomainEventGraphicsSubjectPtr subject,
void * opaque) typedef virConnectDomainEventIOErrorCallback void virConnectDomainEventIOErrorCallback (virConnectPtr conn,
virDomainPtr dom,
const char * srcPath,
const char * devAlias,
int action,
void * opaque) typedef virConnectDomainEventIOErrorReasonCallback void virConnectDomainEventIOErrorReasonCallback (virConnectPtr conn,
virDomainPtr dom,
const char * srcPath,
const char * devAlias,
int action,
const char * reason,
void * opaque) typedef virConnectDomainEventRTCChangeCallback void virConnectDomainEventRTCChangeCallback (virConnectPtr conn,
virDomainPtr dom,
long long utcoffset,
void * opaque) int virConnectDomainEventRegister (virConnectPtr conn,
virConnectDomainEventCallback cb,
void * opaque,
virFreeCallback freecb) int virConnectDomainEventRegisterAny (virConnectPtr conn,
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
void * opaque,
virFreeCallback freecb) typedef virConnectDomainEventWatchdogCallback void virConnectDomainEventWatchdogCallback (virConnectPtr conn,
virDomainPtr dom,
int action,
void * opaque) char * virConnectDomainXMLFromNative (virConnectPtr conn,
const char * nativeFormat,
const char * nativeConfig,
unsigned int flags) char * virConnectDomainXMLToNative (virConnectPtr conn,
const char * nativeFormat,
const char * domainXml,
unsigned int flags) char * virConnectFindStoragePoolSources (virConnectPtr conn,
const char * type,
const char * srcSpec,
unsigned int flags) char * virConnectGetCapabilities (virConnectPtr conn) char * virConnectGetHostname (virConnectPtr conn) int virConnectGetLibVersion (virConnectPtr conn,
unsigned long * libVer) int virConnectGetMaxVcpus (virConnectPtr conn,
const char * type) const char * virConnectGetType (virConnectPtr conn) char * virConnectGetURI (virConnectPtr conn) int virConnectGetVersion (virConnectPtr conn,
unsigned long * hvVer) int virConnectIsEncrypted (virConnectPtr conn) int virConnectIsSecure (virConnectPtr conn) int virConnectListDefinedDomains (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDefinedInterfaces (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDefinedNetworks (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDefinedStoragePools (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDomains (virConnectPtr conn,
int * ids,
int maxids) int virConnectListInterfaces (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListNWFilters (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListNetworks (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListSecrets (virConnectPtr conn,
char ** uuids,
int maxuuids) int virConnectListStoragePools (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectNumOfDefinedDomains (virConnectPtr conn) int virConnectNumOfDefinedInterfaces (virConnectPtr conn) int virConnectNumOfDefinedNetworks (virConnectPtr conn) int virConnectNumOfDefinedStoragePools (virConnectPtr conn) int virConnectNumOfDomains (virConnectPtr conn) int virConnectNumOfInterfaces (virConnectPtr conn) int virConnectNumOfNWFilters (virConnectPtr conn) int virConnectNumOfNetworks (virConnectPtr conn) int virConnectNumOfSecrets (virConnectPtr conn) int virConnectNumOfStoragePools (virConnectPtr conn) virConnectPtr virConnectOpen (const char * name) virConnectPtr virConnectOpenAuth (const char * name,
virConnectAuthPtr auth,
int flags) virConnectPtr virConnectOpenReadOnly (const char * name) int virConnectRef (virConnectPtr conn) int virDomainAbortJob (virDomainPtr domain) int virDomainAttachDevice (virDomainPtr domain,
const char * xml) int virDomainAttachDeviceFlags (virDomainPtr domain,
const char * xml,
unsigned int flags) int virDomainBlockPeek (virDomainPtr dom,
const char * path,
unsigned long long offset,
size_t size,
void * buffer,
unsigned int flags) int virDomainBlockStats (virDomainPtr dom,
const char * path,
virDomainBlockStatsPtr stats,
size_t size) int virDomainCoreDump (virDomainPtr domain,
const char * to,
int flags) int virDomainCreate (virDomainPtr domain) virDomainPtr virDomainCreateLinux (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) int virDomainCreateWithFlags (virDomainPtr domain,
unsigned int flags) virDomainPtr virDomainCreateXML (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) virDomainPtr virDomainDefineXML (virConnectPtr conn,
const char * xml) int virDomainDestroy (virDomainPtr domain) int virDomainDetachDevice (virDomainPtr domain,
const char * xml) int virDomainDetachDeviceFlags (virDomainPtr domain,
const char * xml,
unsigned int flags) int virDomainFree (virDomainPtr domain) int virDomainGetAutostart (virDomainPtr domain,
int * autostart) int virDomainGetBlockInfo (virDomainPtr domain,
const char * path,
virDomainBlockInfoPtr info,
unsigned int flags) virConnectPtr virDomainGetConnect (virDomainPtr dom) unsigned int virDomainGetID (virDomainPtr domain) int virDomainGetInfo (virDomainPtr domain,
virDomainInfoPtr info) int virDomainGetJobInfo (virDomainPtr domain,
virDomainJobInfoPtr info) unsigned long virDomainGetMaxMemory (virDomainPtr domain) int virDomainGetMaxVcpus (virDomainPtr domain) const char * virDomainGetName (virDomainPtr domain) char * virDomainGetOSType (virDomainPtr domain) int virDomainGetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
int * nparams) char * virDomainGetSchedulerType (virDomainPtr domain,
int * nparams) int virDomainGetSecurityLabel (virDomainPtr domain,
virSecurityLabelPtr seclabel) int virDomainGetUUID (virDomainPtr domain,
unsigned char * uuid) int virDomainGetUUIDString (virDomainPtr domain,
char * buf) int virDomainGetVcpus (virDomainPtr domain,
virVcpuInfoPtr info,
int maxinfo,
unsigned char * cpumaps,
int maplen) char * virDomainGetXMLDesc (virDomainPtr domain,
int flags) int virDomainHasCurrentSnapshot (virDomainPtr domain,
unsigned int flags) int virDomainHasManagedSaveImage (virDomainPtr dom,
unsigned int flags) int virDomainInterfaceStats (virDomainPtr dom,
const char * path,
virDomainInterfaceStatsPtr stats,
size_t size) int virDomainIsActive (virDomainPtr dom) int virDomainIsPersistent (virDomainPtr dom) virDomainPtr virDomainLookupByID (virConnectPtr conn,
int id) virDomainPtr virDomainLookupByName (virConnectPtr conn,
const char * name) virDomainPtr virDomainLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virDomainManagedSave (virDomainPtr dom,
unsigned int flags) int virDomainManagedSaveRemove (virDomainPtr dom,
unsigned int flags) int virDomainMemoryPeek (virDomainPtr dom,
unsigned long long start,
size_t size,
void * buffer,
unsigned int flags) int virDomainMemoryStats (virDomainPtr dom,
virDomainMemoryStatPtr stats,
unsigned int nr_stats,
unsigned int flags) virDomainPtr virDomainMigrate (virDomainPtr domain,
virConnectPtr dconn,
unsigned long flags,
const char * dname,
const char * uri,
unsigned long bandwidth) int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
unsigned long long downtime,
unsigned int flags) int virDomainMigrateToURI (virDomainPtr domain,
const char * duri,
unsigned long flags,
const char * dname,
unsigned long bandwidth) int virDomainPinVcpu (virDomainPtr domain,
unsigned int vcpu,
unsigned char * cpumap,
int maplen) int virDomainReboot (virDomainPtr domain,
unsigned int flags) int virDomainRef (virDomainPtr domain) int virDomainRestore (virConnectPtr conn,
const char * from) int virDomainResume (virDomainPtr domain) int virDomainRevertToSnapshot (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSave (virDomainPtr domain,
const char * to) int virDomainSetAutostart (virDomainPtr domain,
int autostart) int virDomainSetMaxMemory (virDomainPtr domain,
unsigned long memory) int virDomainSetMemory (virDomainPtr domain,
unsigned long memory) int virDomainSetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
int nparams) int virDomainSetVcpus (virDomainPtr domain,
unsigned int nvcpus) int virDomainShutdown (virDomainPtr domain) virDomainSnapshotPtr virDomainSnapshotCreateXML (virDomainPtr domain,
const char * xmlDesc,
unsigned int flags) virDomainSnapshotPtr virDomainSnapshotCurrent (virDomainPtr domain,
unsigned int flags) int virDomainSnapshotDelete (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotFree (virDomainSnapshotPtr snapshot) char * virDomainSnapshotGetXMLDesc (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotListNames (virDomainPtr domain,
char ** names,
int nameslen,
unsigned int flags) virDomainSnapshotPtr virDomainSnapshotLookupByName (virDomainPtr domain,
const char * name,
unsigned int flags) int virDomainSnapshotNum (virDomainPtr domain,
unsigned int flags) int virDomainSuspend (virDomainPtr domain) int virDomainUndefine (virDomainPtr domain) int virDomainUpdateDeviceFlags (virDomainPtr domain,
const char * xml,
unsigned int flags) typedef virEventAddHandleFunc int virEventAddHandleFunc (int fd,
int event,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff) typedef virEventAddTimeoutFunc int virEventAddTimeoutFunc (int timeout,
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff) typedef virEventHandleCallback void virEventHandleCallback (int watch,
int fd,
int events,
void * opaque) void virEventRegisterImpl (virEventAddHandleFunc addHandle,
virEventUpdateHandleFunc updateHandle,
virEventRemoveHandleFunc removeHandle,
virEventAddTimeoutFunc addTimeout,
virEventUpdateTimeoutFunc updateTimeout,
virEventRemoveTimeoutFunc removeTimeout) typedef virEventRemoveHandleFunc int virEventRemoveHandleFunc (int watch) typedef virEventRemoveTimeoutFunc int virEventRemoveTimeoutFunc (int timer) typedef virEventTimeoutCallback void virEventTimeoutCallback (int timer,
void * opaque) typedef virEventUpdateHandleFunc void virEventUpdateHandleFunc (int watch,
int event) typedef virEventUpdateTimeoutFunc void virEventUpdateTimeoutFunc (int timer,
int timeout) typedef virFreeCallback void virFreeCallback (void * opaque) int virGetVersion (unsigned long * libVer,
const char * type,
unsigned long * typeVer) int virInitialize (void) int virInterfaceCreate (virInterfacePtr iface,
unsigned int flags) virInterfacePtr virInterfaceDefineXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virInterfaceDestroy (virInterfacePtr iface,
unsigned int flags) int virInterfaceFree (virInterfacePtr iface) virConnectPtr virInterfaceGetConnect (virInterfacePtr iface) const char * virInterfaceGetMACString (virInterfacePtr iface) const char * virInterfaceGetName (virInterfacePtr iface) char * virInterfaceGetXMLDesc (virInterfacePtr iface,
unsigned int flags) int virInterfaceIsActive (virInterfacePtr iface) virInterfacePtr virInterfaceLookupByMACString (virConnectPtr conn,
const char * macstr) virInterfacePtr virInterfaceLookupByName (virConnectPtr conn,
const char * name) int virInterfaceRef (virInterfacePtr iface) int virInterfaceUndefine (virInterfacePtr iface) virNWFilterPtr virNWFilterDefineXML (virConnectPtr conn,
const char * xmlDesc) int virNWFilterFree (virNWFilterPtr nwfilter) const char * virNWFilterGetName (virNWFilterPtr nwfilter) int virNWFilterGetUUID (virNWFilterPtr nwfilter,
unsigned char * uuid) int virNWFilterGetUUIDString (virNWFilterPtr nwfilter,
char * buf) char * virNWFilterGetXMLDesc (virNWFilterPtr nwfilter,
int flags) virNWFilterPtr virNWFilterLookupByName (virConnectPtr conn,
const char * name) virNWFilterPtr virNWFilterLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virNWFilterPtr virNWFilterLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virNWFilterRef (virNWFilterPtr nwfilter) int virNWFilterUndefine (virNWFilterPtr nwfilter) int virNetworkCreate (virNetworkPtr network) virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
const char * xmlDesc) virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
const char * xml) int virNetworkDestroy (virNetworkPtr network) int virNetworkFree (virNetworkPtr network) int virNetworkGetAutostart (virNetworkPtr network,
int * autostart) char * virNetworkGetBridgeName (virNetworkPtr network) virConnectPtr virNetworkGetConnect (virNetworkPtr net) const char * virNetworkGetName (virNetworkPtr network) int virNetworkGetUUID (virNetworkPtr network,
unsigned char * uuid) int virNetworkGetUUIDString (virNetworkPtr network,
char * buf) char * virNetworkGetXMLDesc (virNetworkPtr network,
int flags) int virNetworkIsActive (virNetworkPtr net) int virNetworkIsPersistent (virNetworkPtr net) virNetworkPtr virNetworkLookupByName (virConnectPtr conn,
const char * name) virNetworkPtr virNetworkLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virNetworkPtr virNetworkLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virNetworkRef (virNetworkPtr network) int virNetworkSetAutostart (virNetworkPtr network,
int autostart) int virNetworkUndefine (virNetworkPtr network) virNodeDevicePtr virNodeDeviceCreateXML (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) int virNodeDeviceDestroy (virNodeDevicePtr dev) int virNodeDeviceDettach (virNodeDevicePtr dev) int virNodeDeviceFree (virNodeDevicePtr dev) const char * virNodeDeviceGetName (virNodeDevicePtr dev) const char * virNodeDeviceGetParent (virNodeDevicePtr dev) char * virNodeDeviceGetXMLDesc (virNodeDevicePtr dev,
unsigned int flags) int virNodeDeviceListCaps (virNodeDevicePtr dev,
char ** const names,
int maxnames) virNodeDevicePtr virNodeDeviceLookupByName (virConnectPtr conn,
const char * name) int virNodeDeviceNumOfCaps (virNodeDevicePtr dev) int virNodeDeviceReAttach (virNodeDevicePtr dev) int virNodeDeviceRef (virNodeDevicePtr dev) int virNodeDeviceReset (virNodeDevicePtr dev) int virNodeGetCellsFreeMemory (virConnectPtr conn,
unsigned long long * freeMems,
int startCell,
int maxCells) unsigned long long virNodeGetFreeMemory (virConnectPtr conn) int virNodeGetInfo (virConnectPtr conn,
virNodeInfoPtr info) int virNodeGetSecurityModel (virConnectPtr conn,
virSecurityModelPtr secmodel) int virNodeListDevices (virConnectPtr conn,
const char * cap,
char ** const names,
int maxnames,
unsigned int flags) int virNodeNumOfDevices (virConnectPtr conn,
const char * cap,
unsigned int flags) virSecretPtr virSecretDefineXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virSecretFree (virSecretPtr secret) virConnectPtr virSecretGetConnect (virSecretPtr secret) int virSecretGetUUID (virSecretPtr secret,
unsigned char * uuid) int virSecretGetUUIDString (virSecretPtr secret,
char * buf) const char * virSecretGetUsageID (virSecretPtr secret) int virSecretGetUsageType (virSecretPtr secret) unsigned char * virSecretGetValue (virSecretPtr secret,
size_t * value_size,
unsigned int flags) char * virSecretGetXMLDesc (virSecretPtr secret,
unsigned int flags) virSecretPtr virSecretLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virSecretPtr virSecretLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) virSecretPtr virSecretLookupByUsage (virConnectPtr conn,
int usageType,
const char * usageID) int virSecretRef (virSecretPtr secret) int virSecretSetValue (virSecretPtr secret,
const unsigned char * value,
size_t value_size,
unsigned int flags) int virSecretUndefine (virSecretPtr secret) int virStoragePoolBuild (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolCreate (virStoragePoolPtr pool,
unsigned int flags) virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virStoragePoolDelete (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolDestroy (virStoragePoolPtr pool) int virStoragePoolFree (virStoragePoolPtr pool) int virStoragePoolGetAutostart (virStoragePoolPtr pool,
int * autostart) virConnectPtr virStoragePoolGetConnect (virStoragePoolPtr pool) int virStoragePoolGetInfo (virStoragePoolPtr pool,
virStoragePoolInfoPtr info) const char * virStoragePoolGetName (virStoragePoolPtr pool) int virStoragePoolGetUUID (virStoragePoolPtr pool,
unsigned char * uuid) int virStoragePoolGetUUIDString (virStoragePoolPtr pool,
char * buf) char * virStoragePoolGetXMLDesc (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolIsActive (virStoragePoolPtr pool) int virStoragePoolIsPersistent (virStoragePoolPtr pool) int virStoragePoolListVolumes (virStoragePoolPtr pool,
char ** const names,
int maxnames) virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn,
const char * name) virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) int virStoragePoolRef (virStoragePoolPtr pool) int virStoragePoolRefresh (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolSetAutostart (virStoragePoolPtr pool,
int autostart) int virStoragePoolUndefine (virStoragePoolPtr pool) virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool,
const char * xmldesc,
unsigned int flags) virStorageVolPtr virStorageVolCreateXMLFrom (virStoragePoolPtr pool,
const char * xmldesc,
virStorageVolPtr clonevol,
unsigned int flags) int virStorageVolDelete (virStorageVolPtr vol,
unsigned int flags) int virStorageVolFree (virStorageVolPtr vol) virConnectPtr virStorageVolGetConnect (virStorageVolPtr vol) int virStorageVolGetInfo (virStorageVolPtr vol,
virStorageVolInfoPtr info) const char * virStorageVolGetKey (virStorageVolPtr vol) const char * virStorageVolGetName (virStorageVolPtr vol) char * virStorageVolGetPath (virStorageVolPtr vol) char * virStorageVolGetXMLDesc (virStorageVolPtr vol,
unsigned int flags) virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn,
const char * key) virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool,
const char * name) virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn,
const char * path) int virStorageVolRef (virStorageVolPtr vol) int virStorageVolWipe (virStorageVolPtr vol,
unsigned int flags) int virStreamAbort (virStreamPtr stream) int virStreamEventAddCallback (virStreamPtr stream,
int events,
virStreamEventCallback cb,
void * opaque,
virFreeCallback ff) typedef virStreamEventCallback void virStreamEventCallback (virStreamPtr stream,
int events,
void * opaque) int virStreamEventRemoveCallback (virStreamPtr stream) int virStreamEventUpdateCallback (virStreamPtr stream,
int events) int virStreamFinish (virStreamPtr stream) int virStreamFree (virStreamPtr stream) virStreamPtr virStreamNew (virConnectPtr conn,
unsigned int flags) int virStreamRecv (virStreamPtr stream,
char * data,
size_t nbytes) int virStreamRecvAll (virStreamPtr stream,
virStreamSinkFunc handler,
void * opaque) int virStreamRef (virStreamPtr stream) int virStreamSend (virStreamPtr stream,
const char * data,
size_t nbytes) int virStreamSendAll (virStreamPtr stream,
virStreamSourceFunc handler,
void * opaque) typedef virStreamSinkFunc int virStreamSinkFunc (virStreamPtr st,
const char * data,
size_t nbytes,
void * opaque) typedef virStreamSourceFunc int virStreamSourceFunc (virStreamPtr st,
char * data,
size_t nbytes,
void * opaque)

Description

Macros

LIBVIR_VERSION_NUMBER

#define LIBVIR_VERSION_NUMBER

Macro providing the version of the library as version * 1,000,000 + minor * 1000 + micro

VIR_COPY_CPUMAP

#define VIR_COPY_CPUMAP

This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_COPY_CPUMAP macro extract the cpumap of the specified vcpu from cpumaps array and copy it into cpumap to be used later by virDomainPinVcpu() API.

VIR_CPU_MAPLEN

#define VIR_CPU_MAPLEN

This macro is to be used in conjunction with virDomainPinVcpu() API. It returns the length (in bytes) required to store the complete CPU map between a single virtual & all physical CPUs of a domain.

VIR_CPU_USABLE

#define VIR_CPU_USABLE

This macro is to be used in conjunction with virDomainGetVcpus() API. VIR_CPU_USABLE macro returns a non zero value (true) if the cpu is usable by the vcpu, and 0 otherwise.

VIR_DOMAIN_EVENT_CALLBACK

#define VIR_DOMAIN_EVENT_CALLBACK

Used to cast the event specific callback into the generic one for use for virDomainEventRegister

VIR_DOMAIN_SCHED_FIELD_LENGTH

#define VIR_DOMAIN_SCHED_FIELD_LENGTH

Macro providing the field length of virSchedParameter

VIR_GET_CPUMAP

#define VIR_GET_CPUMAP

This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_GET_CPUMAP macro returns a pointer to the cpumap of the specified vcpu from cpumaps array.

VIR_NODEINFO_MAXCPUS

#define VIR_NODEINFO_MAXCPUS

This macro is to calculate the total number of CPUs supported but not necessary active in the host.

VIR_SECURITY_DOI_BUFLEN

#define VIR_SECURITY_DOI_BUFLEN

Macro providing the maximum length of the virSecurityModel doi string.

VIR_SECURITY_LABEL_BUFLEN

#define VIR_SECURITY_LABEL_BUFLEN

Macro providing the maximum length of the virSecurityLabel label string. Note that this value is based on that used by Labeled NFS.

VIR_SECURITY_MODEL_BUFLEN

#define VIR_SECURITY_MODEL_BUFLEN

Macro providing the maximum length of the virSecurityModel model string.

VIR_UNUSE_CPU

#define VIR_UNUSE_CPU

This macro is to be used in conjunction with virDomainPinVcpu() API. USE_CPU macro reset the bit (CPU not usable) of the related cpu in cpumap.

VIR_USE_CPU

#define VIR_USE_CPU

This macro is to be used in conjunction with virDomainPinVcpu() API. USE_CPU macro set the bit (CPU usable) of the related cpu in cpumap.

VIR_UUID_BUFLEN

#define VIR_UUID_BUFLEN

This macro provides the length of the buffer required for virDomainGetUUID()

VIR_UUID_STRING_BUFLEN

#define VIR_UUID_STRING_BUFLEN

This macro provides the length of the buffer required for virDomainGetUUIDString()

Types

virCPUCompareResult

virConnect

struct virConnect{
The content of this structure is not made public by the API
}

virConnectAuth

struct virConnectAuth{
int *credtype : List of supported virConnectCredentialType values
unsigned intncredtype
virConnectAuthCallbackPtrcb : Callback used to collect credentials
void *cbdata
}

virConnectCredential

struct virConnectCredential{
inttype : One of virConnectCredentialType constants
const char *prompt : Prompt to show to user
const char *challenge : Additional challenge to show
const char *defresult : Optional default result
char *result : Result to be filled with user response (or defresult)
unsigned intresultlen : Length of the result
}

virConnectCredentialType

enum virConnectCredentialType {
VIR_CRED_USERNAME = 1 : Identity to act as
VIR_CRED_AUTHNAME = 2 : Identify to authorize as
VIR_CRED_LANGUAGE = 3 : RFC 1766 languages, comma separated
VIR_CRED_CNONCE = 4 : client supplies a nonce
VIR_CRED_PASSPHRASE = 5 : Passphrase secret
VIR_CRED_ECHOPROMPT = 6 : Challenge response
VIR_CRED_NOECHOPROMPT = 7 : Challenge response
VIR_CRED_REALM = 8 : Authentication realm
VIR_CRED_EXTERNAL = 9 : Externally managed credential More may be added - expect the unexpected
}

virConnectFlags

enum virConnectFlags {
VIR_CONNECT_RO = 1 : A readonly connection
}

virDomain

struct virDomain{
The content of this structure is not made public by the API
}

virDomainBlockInfo

struct virDomainBlockInfo{
unsigned long longcapacity : logical size in bytes of the block device backing image
unsigned long longallocation : highest allocated extent in bytes of the block device backing image
unsigned long longphysical : physical size in bytes of the container of the backing image
}

virDomainBlockStatsStruct

struct virDomainBlockStatsStruct{
long longrd_req : number of read requests
long longrd_bytes : number of read bytes
long longwr_req : number of write requests
long longwr_bytes : number of written bytes
long longerrs : In Xen this returns the mysterious 'oo_req'.
}

virDomainCoreDumpFlags

enum virDomainCoreDumpFlags {
VIR_DUMP_CRASH = 1 : crash after dump
VIR_DUMP_LIVE = 2 : live dump
}

virDomainCreateFlags

enum virDomainCreateFlags {
VIR_DOMAIN_NONE = 0 : Default behavior
VIR_DOMAIN_START_PAUSED = 1 : Launch guest in paused state
}

virDomainDeviceModifyFlags

enum virDomainDeviceModifyFlags {
VIR_DOMAIN_DEVICE_MODIFY_CURRENT = 0 : Modify device allocation based on current domain state
VIR_DOMAIN_DEVICE_MODIFY_LIVE = 1 : Modify live device allocation
VIR_DOMAIN_DEVICE_MODIFY_CONFIG = 2 : Modify persisted device allocation
}

virDomainEventDefinedDetailType

enum virDomainEventDefinedDetailType {
VIR_DOMAIN_EVENT_DEFINED_ADDED = 0 : Newly created config file
VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1 : Changed config file
}

virDomainEventGraphicsAddress

struct virDomainEventGraphicsAddress{
intfamily : Address family, virDomainEventGraphicsAddressType
const char *node : Address of node (eg IP address)
const char *service : Service name/number (eg TCP port)
}

virDomainEventGraphicsAddressType

enum virDomainEventGraphicsAddressType {
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4 = 1 : IPv4 address
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6 = 2 : IPv6 address
}

virDomainEventGraphicsPhase

enum virDomainEventGraphicsPhase {
VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0 : Initial socket connection established
VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE = 1 : Authentication & setup completed
VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT = 2 : Final socket disconnection
}

virDomainEventGraphicsSubject

struct virDomainEventGraphicsSubject{
intnidentity : Number of identities in arra
virDomainEventGraphicsSubjectIdentityPtridentities : Array of identities for subject
}

virDomainEventGraphicsSubjectIdentity

struct virDomainEventGraphicsSubjectIdentity{
const char *type : Type of identity
const char *name : Identity value
}

virDomainEventID

virDomainEventIOErrorAction

enum virDomainEventIOErrorAction {
VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0 : No action, IO error ignored
VIR_DOMAIN_EVENT_IO_ERROR_PAUSE = 1 : Guest CPUs are pausde
VIR_DOMAIN_EVENT_IO_ERROR_REPORT = 2 : IO error reported to guest OS
}

virDomainEventResumedDetailType

enum virDomainEventResumedDetailType {
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0 : Normal resume due to admin unpause
VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1 : Resumed for completion of migration
}

virDomainEventStartedDetailType

enum virDomainEventStartedDetailType {
VIR_DOMAIN_EVENT_STARTED_BOOTED = 0 : Normal startup from boot
VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1 : Incoming migration from another host
VIR_DOMAIN_EVENT_STARTED_RESTORED = 2 : Restored from a state file
VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = 3 : Restored from snapshot
}

virDomainEventStoppedDetailType

enum virDomainEventStoppedDetailType {
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN = 0 : Normal shutdown
VIR_DOMAIN_EVENT_STOPPED_DESTROYED = 1 : Forced poweroff from host
VIR_DOMAIN_EVENT_STOPPED_CRASHED = 2 : Guest crashed
VIR_DOMAIN_EVENT_STOPPED_MIGRATED = 3 : Migrated off to another host
VIR_DOMAIN_EVENT_STOPPED_SAVED = 4 : Saved to a state file
VIR_DOMAIN_EVENT_STOPPED_FAILED = 5 : Host emulator/mgmt failed
VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT = 6 : offline snapshot loaded
}

virDomainEventSuspendedDetailType

enum virDomainEventSuspendedDetailType {
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0 : Normal suspend due to admin pause
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1 : Suspended for offline migration
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR = 2 : Suspended due to a disk I/O error
VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG = 3 : Suspended due to a watchdog firing
}

virDomainEventType

virDomainEventUndefinedDetailType

enum virDomainEventUndefinedDetailType {
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED = 0 : Deleted the config file
}

virDomainEventWatchdogAction

enum virDomainEventWatchdogAction {
VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0 : No action, watchdog ignored
VIR_DOMAIN_EVENT_WATCHDOG_PAUSE = 1 : Guest CPUs are paused
VIR_DOMAIN_EVENT_WATCHDOG_RESET = 2 : Guest CPUs are reset
VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF = 3 : Guest is forcably powered off
VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN = 4 : Guest is requested to gracefully shutdown
VIR_DOMAIN_EVENT_WATCHDOG_DEBUG = 5 : No action, a debug message logged
}

virDomainInfo

struct virDomainInfo{
unsigned charstate : the running state, one of virDomainState
unsigned longmaxMem : the maximum memory in KBytes allowed
unsigned longmemory : the memory in KBytes used by the domain
unsigned shortnrVirtCpu : the number of virtual CPUs for the domain
unsigned long longcpuTime : the CPU time used in nanoseconds
}

virDomainInterfaceStatsStruct

struct virDomainInterfaceStatsStruct{
long longrx_bytes
long longrx_packets
long longrx_errs
long longrx_drop
long longtx_bytes
long longtx_packets
long longtx_errs
long longtx_drop
}

virDomainJobInfo

struct virDomainJobInfo{
inttype : Time is measured in mill-seconds
unsigned long longtimeElapsed : Always set
unsigned long longtimeRemaining : Only for VIR_DOMAIN_JOB_BOUNDED Data is measured in bytes unless otherwise specified * and is measuring the job as a whole * * For VIR_DOMAIN_JOB_UNBOUNDED, dataTotal may be less * than the final sum of dataProcessed + dataRemaining * in the event that the hypervisor has to repeat some * data eg due to dirtied pages during migration * * For VIR_DOMAIN_JOB_BOUNDED, dataTotal shall always * equal sum of dataProcessed + dataRemaining *
unsigned long longdataTotal
unsigned long longdataProcessed
unsigned long longdataRemaining : As above, but only tracking guest memory progress
unsigned long longmemTotal
unsigned long longmemProcessed
unsigned long longmemRemaining : As above, but only tracking guest disk file progress
unsigned long longfileTotal
unsigned long longfileProcessed
unsigned long longfileRemaining
}

virDomainJobType

enum virDomainJobType {
VIR_DOMAIN_JOB_NONE = 0 : No job is active
VIR_DOMAIN_JOB_BOUNDED = 1 : Job with a finite completion time
VIR_DOMAIN_JOB_UNBOUNDED = 2 : Job without a finite completion time
VIR_DOMAIN_JOB_COMPLETED = 3 : Job has finished, but isn't cleaned up
VIR_DOMAIN_JOB_FAILED = 4 : Job hit error, but isn't cleaned up
VIR_DOMAIN_JOB_CANCELLED = 5 : Job was aborted, but isn't cleaned up
}

virDomainMemoryFlags

enum virDomainMemoryFlags {
VIR_MEMORY_VIRTUAL = 1 : addresses are virtual addresses
VIR_MEMORY_PHYSICAL = 2 : addresses are physical addresses
}

virDomainMemoryStatStruct

struct virDomainMemoryStatStruct{
inttag
unsigned long longval
}

virDomainMemoryStatTags

enum virDomainMemoryStatTags {
VIR_DOMAIN_MEMORY_STAT_SWAP_IN = 0 : The total amount of memory written out to swap space (in kB).
VIR_DOMAIN_MEMORY_STAT_SWAP_OUT = 1 : * Page faults occur when a process makes a valid access to virtual memory * that is not available. When servicing the page fault, if disk IO is * required, it is considered a major fault. If not, it is a minor fault. * These are expressed as the number of faults that have occurred. *
VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT = 2
VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT = 3 : * The amount of memory left completely unused by the system. Memory that * is available but used for reclaimable caches should NOT be reported as * free. This value is expressed in kB. *
VIR_DOMAIN_MEMORY_STAT_UNUSED = 4 : * The total amount of usable memory as seen by the domain. This value * may be less than the amount of memory assigned to the domain if a * balloon driver is in use or if the guest OS does not initialize all * assigned pages. This value is expressed in kB. *
VIR_DOMAIN_MEMORY_STAT_AVAILABLE = 5 : * The number of statistics supported by this version of the interface. * To add new statistics, add them to the enum and increase this value. *
VIR_DOMAIN_MEMORY_STAT_NR = 6
}

virDomainMigrateFlags

enum virDomainMigrateFlags {
VIR_MIGRATE_LIVE = 1 : live migration
VIR_MIGRATE_PEER2PEER = 2 : direct source -> dest host control channel Note the less-common spelling that we're stuck with: VIR_MIGRATE_TUNNELLED should be VIR_MIGRATE_TUNNELED
VIR_MIGRATE_TUNNELLED = 4 : tunnel migration data over libvirtd connection
VIR_MIGRATE_PERSIST_DEST = 8 : persist the VM on the destination
VIR_MIGRATE_UNDEFINE_SOURCE = 16 : undefine the VM on the source
VIR_MIGRATE_PAUSED = 32 : pause on remote side
VIR_MIGRATE_NON_SHARED_DISK = 64 : migration with non-shared storage with full disk copy
VIR_MIGRATE_NON_SHARED_INC = 128 : migration with non-shared storage with incremental copy (same base image shared between source and destination)
}

virDomainSnapshot

struct virDomainSnapshot{
The content of this structure is not made public by the API
}

virDomainSnapshotDeleteFlags

enum virDomainSnapshotDeleteFlags {
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN = 1
}

virDomainState

enum virDomainState {
VIR_DOMAIN_NOSTATE = 0 : no state
VIR_DOMAIN_RUNNING = 1 : the domain is running
VIR_DOMAIN_BLOCKED = 2 : the domain is blocked on resource
VIR_DOMAIN_PAUSED = 3 : the domain is paused by user
VIR_DOMAIN_SHUTDOWN = 4 : the domain is being shut down
VIR_DOMAIN_SHUTOFF = 5 : the domain is shut off
VIR_DOMAIN_CRASHED = 6 : the domain is crashed
}

virDomainXMLFlags

enum virDomainXMLFlags {
VIR_DOMAIN_XML_SECURE = 1 : dump security sensitive information too
VIR_DOMAIN_XML_INACTIVE = 2 : dump inactive domain information
VIR_DOMAIN_XML_UPDATE_CPU = 4 : update guest CPU requirements according to host CPU
}

virEventHandleType

virInterface

struct virInterface{
The content of this structure is not made public by the API
}

virInterfaceXMLFlags

enum virInterfaceXMLFlags {
VIR_INTERFACE_XML_INACTIVE = 1 : dump inactive interface information
}

virNWFilter

struct virNWFilter{
The content of this structure is not made public by the API
}

virNetwork

struct virNetwork{
The content of this structure is not made public by the API
}

virNodeDevice

struct virNodeDevice{
The content of this structure is not made public by the API
}

virNodeInfo

struct virNodeInfo{
charmodel[32]model : string indicating the CPU model
unsigned longmemory : memory size in kilobytes
unsigned intcpus : the number of active CPUs
unsigned intmhz : expected CPU frequency
unsigned intnodes : the number of NUMA cell, 1 for unusual NUMA topologies or uniform memory access; check capabilities XML for the actual NUMA topology
unsigned intsockets : number of CPU sockets per node if nodes == 1, total number of CPU sockets otherwise
unsigned intcores : number of cores per socket
unsigned intthreads : number of threads per core
}

virSchedParameter

struct virSchedParameter{
charfield[VIR_DOMAIN_SCHED_FIELD_LENGTH]field : parameter name
inttype : parameter type
}

virSchedParameterType

enum virSchedParameterType {
VIR_DOMAIN_SCHED_FIELD_INT = 1 : integer case
VIR_DOMAIN_SCHED_FIELD_UINT = 2 : unsigned integer case
VIR_DOMAIN_SCHED_FIELD_LLONG = 3 : long long case
VIR_DOMAIN_SCHED_FIELD_ULLONG = 4 : unsigned long long case
VIR_DOMAIN_SCHED_FIELD_DOUBLE = 5 : double case
VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6 : boolean(character) case
}

virSecret

struct virSecret{
The content of this structure is not made public by the API
}

virSecretUsageType

enum virSecretUsageType {
VIR_SECRET_USAGE_TYPE_NONE = 0
VIR_SECRET_USAGE_TYPE_VOLUME = 1 : Expect more owner types later...
}

virSecurityLabel

struct virSecurityLabel{
The content of this structure is not made public by the API
}

virSecurityModel

struct virSecurityModel{
The content of this structure is not made public by the API
}

virStoragePool

struct virStoragePool{
The content of this structure is not made public by the API
}

virStoragePoolBuildFlags

enum virStoragePoolBuildFlags {
VIR_STORAGE_POOL_BUILD_NEW = 0 : Regular build from scratch
VIR_STORAGE_POOL_BUILD_REPAIR = 1 : Repair / reinitialize
VIR_STORAGE_POOL_BUILD_RESIZE = 2 : Extend existing pool
}

virStoragePoolDeleteFlags

enum virStoragePoolDeleteFlags {
VIR_STORAGE_POOL_DELETE_NORMAL = 0 : Delete metadata only (fast)
VIR_STORAGE_POOL_DELETE_ZEROED = 1 : Clear all data to zeros (slow)
}

virStoragePoolInfo

struct virStoragePoolInfo{
intstate : virStoragePoolState flags
unsigned long longcapacity : Logical size bytes
unsigned long longallocation : Current allocation bytes
unsigned long longavailable : Remaining free space bytes
}

virStoragePoolState

enum virStoragePoolState {
VIR_STORAGE_POOL_INACTIVE = 0 : Not running
VIR_STORAGE_POOL_BUILDING = 1 : Initializing pool, not available
VIR_STORAGE_POOL_RUNNING = 2 : Running normally
VIR_STORAGE_POOL_DEGRADED = 3 : Running degraded
VIR_STORAGE_POOL_INACCESSIBLE = 4 : Running, but not accessible
}

virStorageVol

struct virStorageVol{
The content of this structure is not made public by the API
}

virStorageVolDeleteFlags

enum virStorageVolDeleteFlags {
VIR_STORAGE_VOL_DELETE_NORMAL = 0 : Delete metadata only (fast)
VIR_STORAGE_VOL_DELETE_ZEROED = 1 : Clear all data to zeros (slow)
}

virStorageVolInfo

struct virStorageVolInfo{
inttype : virStorageVolType flags
unsigned long longcapacity : Logical size bytes
unsigned long longallocation : Current allocation bytes
}

virStorageVolType

enum virStorageVolType {
VIR_STORAGE_VOL_FILE = 0 : Regular file based volumes
VIR_STORAGE_VOL_BLOCK = 1 : Block based volumes
}

virStream

struct virStream{
The content of this structure is not made public by the API
}

virStreamEventType

virStreamFlags

enum virStreamFlags {
VIR_STREAM_NONBLOCK = 1
}

virVcpuInfo

struct virVcpuInfo{
unsigned intnumber : virtual CPU number
intstate : value from virVcpuState
unsigned long longcpuTime : CPU time used, in nanoseconds
intcpu : real CPU number, or -1 if offline
}

virVcpuState

enum virVcpuState {
VIR_VCPU_OFFLINE = 0 : the virtual CPU is offline
VIR_VCPU_RUNNING = 1 : the virtual CPU is running
VIR_VCPU_BLOCKED = 2 : the virtual CPU is blocked on resource
}

Functions

virConnectAuthCallbackPtr

typedef int	(*virConnectAuthCallbackPtr)	(virConnectCredentialPtr cred, 
unsigned int ncred,
void * cbdata)

cred:
ncred:
cbdata:
Returns:

virConnectBaselineCPU

char *	virConnectBaselineCPU		(virConnectPtr conn, 
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags)

Computes the most feature-rich CPU which is compatible with all given host CPUs.

conn:virConnect connection
xmlCPUs:array of XML descriptions of host CPUs
ncpus:number of CPUs in xmlCPUs
flags:fine-tuning flags, currently unused, pass 0.
Returns:XML description of the computed CPU or NULL on error.

virConnectClose

int	virConnectClose			(virConnectPtr conn)

This function closes the connection to the Hypervisor. This should not be called if further interaction with the Hypervisor are needed especially if there is running domain which need further monitoring by the application.

conn:pointer to the hypervisor connection
Returns:0 in case of success or -1 in case of error.

virConnectCompareCPU

int	virConnectCompareCPU		(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)

Compares the given CPU description with the host CPU

conn:virConnect connection
xmlDesc:XML describing the CPU to compare with host CPU
flags:currently unused, pass 0
Returns:comparison result according to enum virCPUCompareResult

virConnectDomainEventCallback

typedef int	(*virConnectDomainEventCallback)	(virConnectPtr conn, 
virDomainPtr dom,
int event,
int detail,
void * opaque)

A callback function to be registered, and called when a domain event occurs

conn:virConnect connection
dom:The domain on which the event occured
event:The specfic virDomainEventType which occured
detail:event specific detail information
opaque:opaque user data
Returns:

virConnectDomainEventDeregister

int	virConnectDomainEventDeregister	(virConnectPtr conn, 
virConnectDomainEventCallback cb)

Removes a callback previously registered with the virConnectDomainEventRegister funtion. Use of this method is no longer recommended. Instead applications should try virConnectDomainEventUnregisterAny which has a more flexible API contract

conn:pointer to the connection
cb:callback to the function handling domain events
Returns:0 on success, -1 on failure

virConnectDomainEventDeregisterAny

int	virConnectDomainEventDeregisterAny	(virConnectPtr conn, 
int callbackID)

Removes an event callback. The callbackID parameter should be the vaule obtained from a previous virDomainEventRegisterAny method.

conn:pointer to the connection
callbackID:the callback identifier
Returns:0 on success, -1 on failure

virConnectDomainEventGenericCallback

typedef void	(*virConnectDomainEventGenericCallback)	(virConnectPtr conn, 
virDomainPtr dom,
void * opaque)

conn:
dom:
opaque:

virConnectDomainEventGraphicsCallback

typedef void	(*virConnectDomainEventGraphicsCallback)	(virConnectPtr conn, 
virDomainPtr dom,
int phase,
virDomainEventGraphicsAddressPtr local,
virDomainEventGraphicsAddressPtr remote,
const char * authScheme,
virDomainEventGraphicsSubjectPtr subject,
void * opaque)

The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_GRAPHICS with virConnectDomainEventRegisterAny()

conn:connection object
dom:domain on which the event occurred
phase:the phase of the connection
local:the local server address
remote:the remote client address
authScheme:the authentication scheme activated
subject:the authenticated subject (user)
opaque:application specified data

virConnectDomainEventIOErrorCallback

typedef void	(*virConnectDomainEventIOErrorCallback)	(virConnectPtr conn, 
virDomainPtr dom,
const char * srcPath,
const char * devAlias,
int action,
void * opaque)

conn:
dom:
srcPath:
devAlias:
action:
opaque:

virConnectDomainEventIOErrorReasonCallback

typedef void	(*virConnectDomainEventIOErrorReasonCallback)	(virConnectPtr conn, 
virDomainPtr dom,
const char * srcPath,
const char * devAlias,
int action,
const char * reason,
void * opaque)

conn:
dom:
srcPath:
devAlias:
action:
reason:
opaque:

virConnectDomainEventRTCChangeCallback

typedef void	(*virConnectDomainEventRTCChangeCallback)	(virConnectPtr conn, 
virDomainPtr dom,
long long utcoffset,
void * opaque)

The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_RTC_CHANGE with virConnectDomainEventRegisterAny()

conn:connection object
dom:domain on which the event occurred
utcoffset:the new RTC offset from UTC, measured in seconds
opaque:application specified data

virConnectDomainEventRegister

int	virConnectDomainEventRegister	(virConnectPtr conn, 
virConnectDomainEventCallback cb,
void * opaque,
virFreeCallback freecb)

Adds a callback to receive notifications of domain lifecycle events occurring on a connection Use of this method is no longer recommended. Instead applications should try virConnectDomainEventRegisterAny which has a more flexible API contract The virDomainPtr object handle passed into the callback upon delivery of an event is only valid for the duration of execution of the callback. If the callback wishes to keep the domain object after the callback

conn:pointer to the connection
cb:callback to the function handling domain events
opaque:opaque data to pass on to the callback
freecb:optional function to deallocate opaque when not used anymore
Returns:it shall take a reference to it, by calling virDomainRef. The reference can be released once the object is no longer required by calling virDomainFree. Returns 0 on success, -1 on failure

virConnectDomainEventRegisterAny

int	virConnectDomainEventRegisterAny	(virConnectPtr conn, 
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
void * opaque,
virFreeCallback freecb)

Adds a callback to receive notifications of arbitrary domain events occurring on a domain. If dom is NULL, then events will be monitored for any domain. If dom is non-NULL, then only the specific domain will be monitored Most types of event have a callback providing a custom set of parameters for the event. When registering an event, it is thus neccessary to use the VIR_DOMAIN_EVENT_CALLBACK() macro to cast the supplied function pointer to match the signature of this method. The virDomainPtr object handle passed into the callback upon delivery of an event is only valid for the duration of execution of the callback. If the callback wishes to keep the domain object after the callback

conn:pointer to the connection
dom:pointer to the domain
eventID:the event type to receive
cb:callback to the function handling domain events
opaque:opaque data to pass on to the callback
freecb:optional function to deallocate opaque when not used anymore
Returns:it shall take a reference to it, by calling virDomainRef. The reference can be released once the object is no longer required by calling virDomainFree. The return value from this method is a positive integer identifier for the callback. To unregister a callback, this callback ID should be passed to the virDomainEventUnregisterAny method Returns a callback identifier on success, -1 on failure

virConnectDomainEventWatchdogCallback

typedef void	(*virConnectDomainEventWatchdogCallback)	(virConnectPtr conn, 
virDomainPtr dom,
int action,
void * opaque)

The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_WATCHDOG with virConnectDomainEventRegisterAny()

conn:connection object
dom:domain on which the event occurred
action:action that is to be taken due to watchdog firing
opaque:application specified data

virConnectDomainXMLFromNative

char *	virConnectDomainXMLFromNative	(virConnectPtr conn, 
const char * nativeFormat,
const char * nativeConfig,
unsigned int flags)

Reads native configuration data describing a domain, and generates libvirt domain XML. The format of the native data is hypervisor dependant.

conn:a connection object
nativeFormat:configuration format importing from
nativeConfig:the configuration data to import
flags:currently unused, pass 0
Returns:a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virConnectDomainXMLToNative

char *	virConnectDomainXMLToNative	(virConnectPtr conn, 
const char * nativeFormat,
const char * domainXml,
unsigned int flags)

Reads a domain XML configuration document, and generates generates a native configuration file describing the domain. The format of the native data is hypervisor dependant.

conn:a connection object
nativeFormat:configuration format exporting to
domainXml:the domain configuration to export
flags:currently unused, pass 0
Returns:a 0 terminated UTF-8 encoded native config datafile, or NULL in case of error. the caller must free() the returned value.

virConnectFindStoragePoolSources

char *	virConnectFindStoragePoolSources	(virConnectPtr conn, 
const char * type,
const char * srcSpec,
unsigned int flags)

Talks to a storage backend and attempts to auto-discover the set of available storage pool sources. e.g. For iSCSI this would be a set of iSCSI targets. For NFS this would be a list of exported paths. The srcSpec (optional for some storage pool types, e.g. local ones) is an instance of the storage pool's source element specifying where to look for the pools. srcSpec is not required for some types (e.g., those querying local storage resources only)

conn:pointer to hypervisor connection
type:type of storage pool sources to discover
srcSpec:XML document specifying discovery source
flags:flags for discovery (unused, pass 0)
Returns:an xml document consisting of a SourceList element containing a source document appropriate to the given pool type for each discovered source.

virConnectGetCapabilities

char *	virConnectGetCapabilities	(virConnectPtr conn)

Provides capabilities of the hypervisor / driver.

conn:pointer to the hypervisor connection
Returns:NULL in case of error, or an XML string defining the capabilities. The client must free the returned string after use.

virConnectGetHostname

char *	virConnectGetHostname		(virConnectPtr conn)

This returns the system hostname on which the hypervisor is running (the result of the gethostname system call). If we are connected to a remote system, then this returns the hostname of the remote system.

conn:pointer to a hypervisor connection
Returns:the hostname which must be freed by the caller, or NULL if there was an error.

virConnectGetLibVersion

int	virConnectGetLibVersion		(virConnectPtr conn, 
unsigned long * libVer)

Provides @libVer, which is the version of libvirt used by the daemon running on the @conn host

conn:pointer to the hypervisor connection
libVer:returns the libvirt library version used on the connection (OUT)
Returns:-1 in case of failure, 0 otherwise, and values for @libVer have the format major * 1,000,000 + minor * 1,000 + release.

virConnectGetMaxVcpus

int	virConnectGetMaxVcpus		(virConnectPtr conn, 
const char * type)

Provides the maximum number of virtual CPUs supported for a guest VM of a specific type. The 'type' parameter here corresponds to the 'type' attribute in the <domain> element of the XML.

conn:pointer to the hypervisor connection
type:value of the 'type' attribute in the <domain> element
Returns:the maximum of virtual CPU or -1 in case of error.

virConnectGetType

const char *	virConnectGetType	(virConnectPtr conn)

Get the name of the Hypervisor software used.

conn:pointer to the hypervisor connection
Returns:NULL in case of error, a static zero terminated string otherwise. See also: http://www.redhat.com/archives/libvir-list/2007-February/msg00096.html

virConnectGetURI

char *	virConnectGetURI		(virConnectPtr conn)

This returns the URI (name) of the hypervisor connection. Normally this is the same as or similar to the string passed to the virConnectOpen/virConnectOpenReadOnly call, but the driver may make the URI canonical. If name == NULL was passed to virConnectOpen, then the driver will return a non-NULL URI which can be used to connect to the same hypervisor later.

conn:pointer to a hypervisor connection
Returns:the URI string which must be freed by the caller, or NULL if there was an error.

virConnectGetVersion

int	virConnectGetVersion		(virConnectPtr conn, 
unsigned long * hvVer)

Get the version level of the Hypervisor running. This may work only with hypervisor call, i.e. with privileged access to the hypervisor, not with a Read-Only connection.

conn:pointer to the hypervisor connection
hvVer:return value for the version of the running hypervisor (OUT)
Returns:-1 in case of error, 0 otherwise. if the version can't be extracted by lack of capacities returns 0 and @hvVer is 0, otherwise @hvVer value is major * 1,000,000 + minor * 1,000 + release

virConnectIsEncrypted

int	virConnectIsEncrypted		(virConnectPtr conn)

Determine if the connection to the hypervisor is encrypted

conn:pointer to the connection object
Returns:1 if encrypted, 0 if not encrypted, -1 on error

virConnectIsSecure

int	virConnectIsSecure		(virConnectPtr conn)

Determine if the connection to the hypervisor is secure A connection will be classed as secure if it is either encrypted, or running over a channel which is not exposed to eavesdropping (eg a UNIX domain socket, or pipe)

conn:pointer to the connection object
Returns:1 if secure, 0 if secure, -1 on error

virConnectListDefinedDomains

int	virConnectListDefinedDomains	(virConnectPtr conn, 
char ** const names,
int maxnames)

list the defined but inactive domains, stores the pointers to the names in @names

conn:pointer to the hypervisor connection
names:pointer to an array to store the names
maxnames:size of the array
Returns:the number of names provided in the array or -1 in case of error

virConnectListDefinedInterfaces

int	virConnectListDefinedInterfaces	(virConnectPtr conn, 
char ** const names,
int maxnames)

Collect the list of defined (inactive) physical host interfaces, and store their names in @names.

conn:pointer to the hypervisor connection
names:array to collect the list of names of interfaces
maxnames:size of @names
Returns:the number of interfaces found or -1 in case of error

virConnectListDefinedNetworks

int	virConnectListDefinedNetworks	(virConnectPtr conn, 
char ** const names,
int maxnames)

list the inactive networks, stores the pointers to the names in @names

conn:pointer to the hypervisor connection
names:pointer to an array to store the names
maxnames:size of the array
Returns:the number of names provided in the array or -1 in case of error

virConnectListDefinedStoragePools

int	virConnectListDefinedStoragePools	(virConnectPtr conn, 
char ** const names,
int maxnames)

Provides the list of names of inactive storage pools upto maxnames. If there are more than maxnames, the remaining names will be silently ignored.

conn:pointer to hypervisor connection
names:array of char * to fill with pool names (allocated by caller)
maxnames:size of the names array
Returns:0 on success, -1 on error

virConnectListDomains

int	virConnectListDomains		(virConnectPtr conn, 
int * ids,
int maxids)

Collect the list of active domains, and store their ID in @maxids

conn:pointer to the hypervisor connection
ids:array to collect the list of IDs of active domains
maxids:size of @ids
Returns:the number of domain found or -1 in case of error

virConnectListInterfaces

int	virConnectListInterfaces	(virConnectPtr conn, 
char ** const names,
int maxnames)

Collect the list of active physical host interfaces, and store their names in @names

conn:pointer to the hypervisor connection
names:array to collect the list of names of interfaces
maxnames:size of @names
Returns:the number of interfaces found or -1 in case of error

virConnectListNWFilters

int	virConnectListNWFilters		(virConnectPtr conn, 
char ** const names,
int maxnames)

Collect the list of network filters, and store their names in @names

conn:pointer to the hypervisor connection
names:array to collect the list of names of network filters
maxnames:size of @names
Returns:the number of network filters found or -1 in case of error

virConnectListNetworks

int	virConnectListNetworks		(virConnectPtr conn, 
char ** const names,
int maxnames)

Collect the list of active networks, and store their names in @names

conn:pointer to the hypervisor connection
names:array to collect the list of names of active networks
maxnames:size of @names
Returns:the number of networks found or -1 in case of error

virConnectListSecrets

int	virConnectListSecrets		(virConnectPtr conn, 
char ** uuids,
int maxuuids)

List UUIDs of defined secrets, store pointers to names in uuids.

conn:virConnect connection
uuids:Pointer to an array to store the UUIDs
maxuuids:size of the array.
Returns:the number of UUIDs provided in the array, or -1 on failure.

virConnectListStoragePools

int	virConnectListStoragePools	(virConnectPtr conn, 
char ** const names,
int maxnames)

Provides the list of names of active storage pools upto maxnames. If there are more than maxnames, the remaining names will be silently ignored.

conn:pointer to hypervisor connection
names:array of char * to fill with pool names (allocated by caller)
maxnames:size of the names array
Returns:0 on success, -1 on error

virConnectNumOfDefinedDomains

int	virConnectNumOfDefinedDomains	(virConnectPtr conn)

Provides the number of defined but inactive domains.

conn:pointer to the hypervisor connection
Returns:the number of domain found or -1 in case of error

virConnectNumOfDefinedInterfaces

int	virConnectNumOfDefinedInterfaces	(virConnectPtr conn)

Provides the number of defined (inactive) interfaces on the physical host.

conn:pointer to the hypervisor connection
Returns:the number of defined interface found or -1 in case of error

virConnectNumOfDefinedNetworks

int	virConnectNumOfDefinedNetworks	(virConnectPtr conn)

Provides the number of inactive networks.

conn:pointer to the hypervisor connection
Returns:the number of networks found or -1 in case of error

virConnectNumOfDefinedStoragePools

int	virConnectNumOfDefinedStoragePools	(virConnectPtr conn)

Provides the number of inactive storage pools

conn:pointer to hypervisor connection
Returns:the number of pools found, or -1 on error

virConnectNumOfDomains

int	virConnectNumOfDomains		(virConnectPtr conn)

Provides the number of active domains.

conn:pointer to the hypervisor connection
Returns:the number of domain found or -1 in case of error

virConnectNumOfInterfaces

int	virConnectNumOfInterfaces	(virConnectPtr conn)

Provides the number of active interfaces on the physical host.

conn:pointer to the hypervisor connection
Returns:the number of active interfaces found or -1 in case of error

virConnectNumOfNWFilters

int	virConnectNumOfNWFilters	(virConnectPtr conn)

Provides the number of nwfilters.

conn:pointer to the hypervisor connection
Returns:the number of nwfilters found or -1 in case of error

virConnectNumOfNetworks

int	virConnectNumOfNetworks		(virConnectPtr conn)

Provides the number of active networks.

conn:pointer to the hypervisor connection
Returns:the number of network found or -1 in case of error

virConnectNumOfSecrets

int	virConnectNumOfSecrets		(virConnectPtr conn)

Fetch number of currently defined secrets.

conn:virConnect connection
Returns:the number currently defined secrets.

virConnectNumOfStoragePools

int	virConnectNumOfStoragePools	(virConnectPtr conn)

Provides the number of active storage pools

conn:pointer to hypervisor connection
Returns:the number of pools found, or -1 on error

virConnectOpen

virConnectPtr	virConnectOpen		(const char * name)

This function should be called first to get a connection to the Hypervisor and xen store

name:URI of the hypervisor
Returns:a pointer to the hypervisor connection or NULL in case of error If @name is NULL then probing will be done to determine a suitable default driver to activate. This involves trying each hypervisor in turn until one successfully opens. If the LIBVIRT_DEFAULT_URI environment variable is set, then it will be used in preference to probing for a driver. If connecting to an unprivileged hypervisor driver which requires the libvirtd daemon to be active, it will automatically be launched if not already running. This can be prevented by setting the environment variable LIBVIRT_AUTOSTART=0 URIs are documented at http://libvirt.org/uri.html

virConnectOpenAuth

virConnectPtr	virConnectOpenAuth	(const char * name, 
virConnectAuthPtr auth,
int flags)

This function should be called first to get a connection to the Hypervisor. If necessary, authentication will be performed fetching credentials via the callback See virConnectOpen for notes about environment variables which can have an effect on opening drivers

name:URI of the hypervisor
auth:Authenticate callback parameters
flags:Open flags
Returns:a pointer to the hypervisor connection or NULL in case of error URIs are documented at http://libvirt.org/uri.html

virConnectOpenReadOnly

virConnectPtr	virConnectOpenReadOnly	(const char * name)

This function should be called first to get a restricted connection to the library functionalities. The set of APIs usable are then restricted on the available methods to control the domains. See virConnectOpen for notes about environment variables which can have an effect on opening drivers

name:URI of the hypervisor
Returns:a pointer to the hypervisor connection or NULL in case of error URIs are documented at http://libvirt.org/uri.html

virConnectRef

int	virConnectRef			(virConnectPtr conn)

Increment the reference count on the connection. For each additional call to this method, there shall be a corresponding call to virConnectClose to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a connection would increment the reference count.

conn:the connection to hold a reference on
Returns:0 in case of success, -1 in case of failure

virDomainAbortJob

int	virDomainAbortJob		(virDomainPtr domain)

Requests that the current background job be aborted at the soonest opportunity. This will block until the job has either completed, or aborted.

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

virDomainAttachDevice

int	virDomainAttachDevice		(virDomainPtr domain, 
const char * xml)

Create a virtual device attachment to backend. This function, having hotplug semantics, is only allowed on an active domain. For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.

domain:pointer to domain object
xml:pointer to XML description of one device
Returns:0 in case of success, -1 in case of failure.

virDomainAttachDeviceFlags

int	virDomainAttachDeviceFlags	(virDomainPtr domain, 
const char * xml,
unsigned int flags)

Attach a virtual device to a domain, using the flags parameter to control how the device is attached. VIR_DOMAIN_DEVICE_MODIFY_CURRENT specifies that the device allocation is made based on current domain state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be allocated to the active domain instance only and is not added to the persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG specifies that the device shall be allocated to the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation. For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.

domain:pointer to domain object
xml:pointer to XML description of one device
flags:an OR'ed set of virDomainDeviceModifyFlags
Returns:0 in case of success, -1 in case of failure.

virDomainBlockPeek

int	virDomainBlockPeek		(virDomainPtr dom, 
const char * path,
unsigned long long offset,
size_t size,
void * buffer,
unsigned int flags)

This function allows you to read the contents of a domain's disk device. Typical uses for this are to determine if the domain has written a Master Boot Record (indicating that the domain has completed installation), or to try to work out the state of the domain's filesystems. (Note that in the local case you might try to open the block device or file directly, but that won't work in the remote case, nor if you don't have sufficient permission. Hence the need for this call). 'path' must be a device or file corresponding to the domain. In other words it must be the precise string returned in a <disk><source dev='...'/></disk> from virDomainGetXMLDesc. 'offset' and 'size' represent an area which must lie entirely within the device or file. 'size' may be 0 to test if the call would succeed. 'buffer' is the return buffer and must be at least 'size' bytes. NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes.

dom:pointer to the domain object
path:path to the block device
offset:offset within block device
size:size to read
buffer:return buffer (must be at least size bytes)
flags:unused, always pass 0
Returns:0 in case of success or -1 in case of failure. really 64 bits

virDomainBlockStats

int	virDomainBlockStats		(virDomainPtr dom, 
const char * path,
virDomainBlockStatsPtr stats,
size_t size)

This function returns block device (disk) stats for block devices attached to the domain. The path parameter is the name of the block device. Get this by calling virDomainGetXMLDesc and finding the <target dev='...'> attribute within //domain/devices/disk. (For example, "xvda"). Domains may have more than one block device. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.

dom:pointer to the domain object
path:path to the block device
stats:block device stats (returned)
size:size of stats structure
Returns:0 in case of success or -1 in case of failure.

virDomainCoreDump

int	virDomainCoreDump		(virDomainPtr domain, 
const char * to,
int flags)

This method will dump the core of a domain on a given file for analysis. Note that for remote Xen Daemon the file path will be interpreted in the remote host.

domain:a domain object
to:path for the core file
flags:extra flags, currently unused
Returns:0 in case of success and -1 in case of failure.

virDomainCreate

int	virDomainCreate			(virDomainPtr domain)

Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools.

domain:pointer to a defined domain
Returns:0 in case of success, -1 in case of error

virDomainCreateLinux

virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)

Deprecated after 0.4.6. Renamed to virDomainCreateXML() providing identical functionality. This existing name will left indefinitely for API compatibility.

conn:pointer to the hypervisor connection
xmlDesc:string containing an XML description of the domain
flags:callers should always pass 0
Returns:a new domain object or NULL in case of failure

virDomainCreateWithFlags

int	virDomainCreateWithFlags	(virDomainPtr domain, 
unsigned int flags)

Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools.

domain:pointer to a defined domain
flags:bitwise-or of supported virDomainCreateFlags
Returns:0 in case of success, -1 in case of error

virDomainCreateXML

virDomainPtr	virDomainCreateXML	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)

Launch a new guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires privileged access to the hypervisor. The domain is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted (see virDomainDefineXML() to define persistent domains).

conn:pointer to the hypervisor connection
xmlDesc:string containing an XML description of the domain
flags:bitwise-or of supported virDomainCreateFlags
Returns:a new domain object or NULL in case of failure

virDomainDefineXML

virDomainPtr	virDomainDefineXML	(virConnectPtr conn, 
const char * xml)

Define a domain, but does not start it. This definition is persistent, until explicitly undefined with virDomainUndefine(). A previous definition for this domain would be overriden if it already exists.

conn:pointer to the hypervisor connection
xml:the XML description for the domain, preferably in UTF-8
Returns:NULL in case of error, a pointer to the domain otherwise

virDomainDestroy

int	virDomainDestroy		(virDomainPtr domain)

Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. This does not free the associated virDomainPtr object. This function may require privileged access

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

virDomainDetachDevice

int	virDomainDetachDevice		(virDomainPtr domain, 
const char * xml)

Destroy a virtual device attachment to backend. This function, having hot-unplug semantics, is only allowed on an active domain.

domain:pointer to domain object
xml:pointer to XML description of one device
Returns:0 in case of success, -1 in case of failure.

virDomainDetachDeviceFlags

int	virDomainDetachDeviceFlags	(virDomainPtr domain, 
const char * xml,
unsigned int flags)

Detach a virtual device from a domain, using the flags parameter to control how the device is detached. VIR_DOMAIN_DEVICE_MODIFY_CURRENT specifies that the device allocation is removed based on current domain state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be deallocated from the active domain instance only and is not from the persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG specifies that the device shall be deallocated from the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports removing the persisted device allocation.

domain:pointer to domain object
xml:pointer to XML description of one device
flags:an OR'ed set of virDomainDeviceModifyFlags
Returns:0 in case of success, -1 in case of failure.

virDomainFree

int	virDomainFree			(virDomainPtr domain)

Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

virDomainGetAutostart

int	virDomainGetAutostart		(virDomainPtr domain, 
int * autostart)

Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots.

domain:a domain object
autostart:the value returned
Returns:-1 in case of error, 0 in case of success

virDomainGetBlockInfo

int	virDomainGetBlockInfo		(virDomainPtr domain, 
const char * path,
virDomainBlockInfoPtr info,
unsigned int flags)

Extract information about a domain's block device.

domain:a domain object
path:path to the block device or file
info:pointer to a virDomainBlockInfo structure allocated by the user
flags:currently unused, pass zero
Returns:0 in case of success and -1 in case of failure.

virDomainGetConnect

virConnectPtr	virDomainGetConnect	(virDomainPtr dom)

Provides the connection pointer associated with a domain. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the domain object together.

dom:pointer to a domain
Returns:the virConnectPtr or NULL in case of failure.

virDomainGetID

unsigned int	virDomainGetID		(virDomainPtr domain)

Get the hypervisor ID number for the domain

domain:a domain object
Returns:the domain ID number or (unsigned int) -1 in case of error

virDomainGetInfo

int	virDomainGetInfo		(virDomainPtr domain, 
virDomainInfoPtr info)

Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.

domain:a domain object
info:pointer to a virDomainInfo structure allocated by the user
Returns:0 in case of success and -1 in case of failure.

virDomainGetJobInfo

int	virDomainGetJobInfo		(virDomainPtr domain, 
virDomainJobInfoPtr info)

Extract information about progress of a background job on a domain. Will return an error if the domain is not active.

domain:a domain object
info:pointer to a virDomainJobInfo structure allocated by the user
Returns:0 in case of success and -1 in case of failure.

virDomainGetMaxMemory

unsigned long	virDomainGetMaxMemory	(virDomainPtr domain)

Retrieve the maximum amount of physical memory allocated to a domain. If domain is NULL, then this get the amount of memory reserved to Domain0 i.e. the domain where the application runs.

domain:a domain object or NULL
Returns:the memory size in kilobytes or 0 in case of error.

virDomainGetMaxVcpus

int	virDomainGetMaxVcpus		(virDomainPtr domain)

Provides the maximum number of virtual CPUs supported for the guest VM. If the guest is inactive, this is basically the same as virConnectGetMaxVcpus. If the guest is running this will reflect the maximum number of virtual CPUs the guest was booted with.

domain:pointer to domain object
Returns:the maximum of virtual CPU or -1 in case of error.

virDomainGetName

const char *	virDomainGetName	(virDomainPtr domain)

Get the public name for that domain

domain:a domain object
Returns:a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the domain object.

virDomainGetOSType

char *	virDomainGetOSType		(virDomainPtr domain)

Get the type of domain operation system.

domain:a domain object
Returns:the new string or NULL in case of error, the string must be freed by the caller.

virDomainGetSchedulerParameters

int	virDomainGetSchedulerParameters	(virDomainPtr domain, 
virSchedParameterPtr params,
int * nparams)

Get the scheduler parameters, the @params array will be filled with the values.

domain:pointer to domain object
params:pointer to scheduler parameter object (return value)
nparams:pointer to number of scheduler parameter (this value should be same than the returned value nparams of virDomainGetSchedulerType)
Returns:-1 in case of error, 0 in case of success.

virDomainGetSchedulerType

char *	virDomainGetSchedulerType	(virDomainPtr domain, 
int * nparams)

Get the scheduler type.

domain:pointer to domain object
nparams:number of scheduler parameters(return value)
Returns:NULL in case of error. The caller must free the returned string.

virDomainGetSecurityLabel

int	virDomainGetSecurityLabel	(virDomainPtr domain, 
virSecurityLabelPtr seclabel)

Extract security label of an active domain. The 'label' field in the @seclabel argument will be initialized to the empty string if the domain is not running under a security model.

domain:a domain object
seclabel:pointer to a virSecurityLabel structure
Returns:0 in case of success, -1 in case of failure

virDomainGetUUID

int	virDomainGetUUID		(virDomainPtr domain, 
unsigned char * uuid)

Get the UUID for a domain

domain:a domain object
uuid:pointer to a VIR_UUID_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virDomainGetUUIDString

int	virDomainGetUUIDString		(virDomainPtr domain, 
char * buf)

Get the UUID for a domain as string. For more information about UUID see RFC4122.

domain:a domain object
buf:pointer to a VIR_UUID_STRING_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virDomainGetVcpus

int	virDomainGetVcpus		(virDomainPtr domain, 
virVcpuInfoPtr info,
int maxinfo,
unsigned char * cpumaps,
int maplen)

Extract information about virtual CPUs of domain, store it in info array and also in cpumaps if this pointer isn't NULL.

domain:pointer to domain object, or NULL for Domain0
info:pointer to an array of virVcpuInfo structures (OUT)
maxinfo:number of structures in info array
cpumaps:pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) If cpumaps is NULL, then no cpumap information is returned by the API. It's assumed there is <maxinfo> cpumap in cpumaps array. The memory allocated to cpumaps must be (maxinfo * maplen) bytes (ie: calloc(maxinfo, maplen)). One cpumap inside cpumaps has the format described in virDomainPinVcpu() API.
maplen:number of bytes in one cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...). Must be zero when cpumaps is NULL and positive when it is non-NULL.
Returns:the number of info filled in case of success, -1 in case of failure.

virDomainGetXMLDesc

char *	virDomainGetXMLDesc		(virDomainPtr domain, 
int flags)

Provide an XML description of the domain. The description may be reused later to relaunch the domain with virDomainCreateXML().

domain:a domain object
flags:an OR'ed set of virDomainXMLFlags
Returns:a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virDomainHasCurrentSnapshot

int	virDomainHasCurrentSnapshot	(virDomainPtr domain, 
unsigned int flags)

Determine if the domain has a current snapshot.

domain:pointer to the domain object
flags:unused flag parameters; callers should pass 0
Returns:1 if such snapshot exists, 0 if it doesn't, -1 on error.

virDomainHasManagedSaveImage

int	virDomainHasManagedSaveImage	(virDomainPtr dom, 
unsigned int flags)

Check if a domain has a managed save image as created by virDomainManagedSave(). Note that any running domain should not have such an image, as it should have been removed on restart.

dom:pointer to the domain
flags:optional flags currently unused
Returns:0 if no image is present, 1 if an image is present, and -1 in case of error

virDomainInterfaceStats

int	virDomainInterfaceStats		(virDomainPtr dom, 
const char * path,
virDomainInterfaceStatsPtr stats,
size_t size)

This function returns network interface stats for interfaces attached to the domain. The path parameter is the name of the network interface. Domains may have more than one network interface. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.

dom:pointer to the domain object
path:path to the interface
stats:network interface stats (returned)
size:size of stats structure
Returns:0 in case of success or -1 in case of failure.

virDomainIsActive

int	virDomainIsActive		(virDomainPtr dom)

Determine if the domain is currently running

dom:pointer to the domain object
Returns:1 if running, 0 if inactive, -1 on error

virDomainIsPersistent

int	virDomainIsPersistent		(virDomainPtr dom)

Determine if the domain has a persistent configuration which means it will still exist after shutting down

dom:pointer to the domain object
Returns:1 if persistent, 0 if transient, -1 on error

virDomainLookupByID

virDomainPtr	virDomainLookupByID	(virConnectPtr conn, 
int id)

Try to find a domain based on the hypervisor ID number Note that this won't work for inactive domains which have an ID of -1, in that case a lookup based on the Name or UUId need to be done instead.

conn:pointer to the hypervisor connection
id:the domain ID number
Returns:a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.

virDomainLookupByName

virDomainPtr	virDomainLookupByName	(virConnectPtr conn, 
const char * name)

Try to lookup a domain on the given hypervisor based on its name.

conn:pointer to the hypervisor connection
name:name for the domain
Returns:a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.

virDomainLookupByUUID

virDomainPtr	virDomainLookupByUUID	(virConnectPtr conn, 
const unsigned char * uuid)

Try to lookup a domain on the given hypervisor based on its UUID.

conn:pointer to the hypervisor connection
uuid:the raw UUID for the domain
Returns:a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.

virDomainLookupByUUIDString

virDomainPtr	virDomainLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)

Try to lookup a domain on the given hypervisor based on its UUID.

conn:pointer to the hypervisor connection
uuidstr:the string UUID for the domain
Returns:a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.

virDomainManagedSave

int	virDomainManagedSave		(virDomainPtr dom, 
unsigned int flags)

This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore. The difference from virDomainSave() is that libvirt is keeping track of the saved state itself, and will reuse it once the domain is being restarted (automatically or via an explicit libvirt call). As a result any running domain is sure to not have a managed saved image.

dom:pointer to the domain
flags:optional flags currently unused
Returns:0 in case of success or -1 in case of failure

virDomainManagedSaveRemove

int	virDomainManagedSaveRemove	(virDomainPtr dom, 
unsigned int flags)

Remove any managed save image for this domain.

dom:pointer to the domain
flags:optional flags currently unused
Returns:0 in case of success, and -1 in case of error

virDomainMemoryPeek

int	virDomainMemoryPeek		(virDomainPtr dom, 
unsigned long long start,
size_t size,
void * buffer,
unsigned int flags)

This function allows you to read the contents of a domain's memory. The memory which is read is controlled by the 'start', 'size' and 'flags' parameters. If 'flags' is VIR_MEMORY_VIRTUAL then the 'start' and 'size' parameters are interpreted as virtual memory addresses for whichever task happens to be running on the domain at the moment. Although this sounds haphazard it is in fact what you want in order to read Linux kernel state, because it ensures that pointers in the kernel image can be interpreted coherently. 'buffer' is the return buffer and must be at least 'size' bytes. 'size' may be 0 to test if the call would succeed. NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes.

dom:pointer to the domain object
start:start of memory to peek
size:size of memory to peek
buffer:return buffer (must be at least size bytes)
flags:flags, see below
Returns:0 in case of success or -1 in case of failure. really 64 bits

virDomainMemoryStats

int	virDomainMemoryStats		(virDomainPtr dom, 
virDomainMemoryStatPtr stats,
unsigned int nr_stats,
unsigned int flags)

This function provides memory statistics for the domain. Up to 'nr_stats' elements of 'stats' will be populated with memory statistics from the domain. Only statistics supported by the domain, the driver, and this version of libvirt will be returned. Memory Statistics: VIR_DOMAIN_MEMORY_STAT_SWAP_IN: The total amount of data read from swap space (in kb). VIR_DOMAIN_MEMORY_STAT_SWAP_OUT: The total amount of memory written out to swap space (in kb). VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT: The number of page faults that required disk IO to service. VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT: The number of page faults serviced without disk IO. VIR_DOMAIN_MEMORY_STAT_UNUSED: The amount of memory which is not being used for any purpose (in kb). VIR_DOMAIN_MEMORY_STAT_AVAILABLE: The total amount of memory available to the domain's OS (in kb).

dom:pointer to the domain object
stats:nr_stats-sized array of stat structures (returned)
nr_stats:number of memory statistics requested
flags:unused, always pass 0
Returns:The number of stats provided or -1 in case of failure.

virDomainMigrate

virDomainPtr	virDomainMigrate	(virDomainPtr domain, 
virConnectPtr dconn,
unsigned long flags,
const char * dname,
const char * uri,
unsigned long bandwidth)

Migrate the domain object from its current host to the destination host given by dconn (a connection to the destination host). Flags may be one of more of the following: VIR_MIGRATE_LIVE Do not pause the VM during migration VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain on the destination host. VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the domain on the source host. VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side. VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set. Applications using the VIR_MIGRATE_PEER2PEER flag will probably prefer to invoke virDomainMigrateToURI, avoiding the need to open connection to the destination host themselves. If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error. If the VIR_MIGRATE_PEER2PEER flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI. If the VIR_MIGRATE_PEER2PEER flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI. In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data. The maximum bandwidth (in Mbps) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0. To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features. There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.

domain:a domain object
dconn:destination host (a connection object)
flags:flags
dname:(optional) rename domain to this at destination
uri:(optional) dest hostname/URI as seen from the source host
bandwidth:(optional) specify migration bandwidth limit in Mbps
Returns:the new domain object if the migration was successful, or NULL in case of error. Note that the new domain object exists in the scope of the destination connection (dconn).

virDomainMigrateSetMaxDowntime

int	virDomainMigrateSetMaxDowntime	(virDomainPtr domain, 
unsigned long long downtime,
unsigned int flags)

Sets maximum tolerable time for which the domain is allowed to be paused at the end of live migration. It's supposed to be called while the domain is being live-migrated as a reaction to migration progress.

domain:a domain object
downtime:maximum tolerable downtime for live migration, in milliseconds
flags:fine-tuning flags, currently unused, use 0
Returns:0 in case of success, -1 otherwise.

virDomainMigrateToURI

int	virDomainMigrateToURI		(virDomainPtr domain, 
const char * duri,
unsigned long flags,
const char * dname,
unsigned long bandwidth)

Migrate the domain object from its current host to the destination host given by duri. Flags may be one of more of the following: VIR_MIGRATE_LIVE Do not pause the VM during migration VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain on the destination host. VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the domain on the source host. The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag. If the VIR_MIGRATE_PEER2PEER flag is NOT set, the duri parameter takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes. Not all hypervisors will support this mode of migration, so if the VIR_MIGRATE_PEER2PEER flag is not set, then it may be necessary to use the alternative virDomainMigrate API providing and explicit virConnectPtr for the destination host. If the VIR_MIGRATE_PEER2PEER flag IS set, the duri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set. If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned. The maximum bandwidth (in Mbps) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0. To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features. There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.

domain:a domain object
duri:mandatory URI for the destination host
flags:flags
dname:(optional) rename domain to this at destination
bandwidth:(optional) specify migration bandwidth limit in Mbps
Returns:0 if the migration succeeded, -1 upon error.

virDomainPinVcpu

int	virDomainPinVcpu		(virDomainPtr domain, 
unsigned int vcpu,
unsigned char * cpumap,
int maplen)

Dynamically change the real CPUs which can be allocated to a virtual CPU. This function requires privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.

domain:pointer to domain object, or NULL for Domain0
vcpu:virtual CPU number
cpumap:pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.
maplen:number of bytes in cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...). If maplen < size, missing bytes are set to zero. If maplen > size, failure code is returned.
Returns:0 in case of success, -1 in case of failure.

virDomainReboot

int	virDomainReboot			(virDomainPtr domain, 
unsigned int flags)

Reboot a domain, the domain object is still usable there after but the domain OS is being stopped for a restart. Note that the guest OS may ignore the request.

domain:a domain object
flags:extra flags for the reboot operation, not used yet
Returns:0 in case of success and -1 in case of failure.

virDomainRef

int	virDomainRef			(virDomainPtr domain)

Increment the reference count on the domain. For each additional call to this method, there shall be a corresponding call to virDomainFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a domain would increment the reference count.

domain:the domain to hold a reference on
Returns:0 in case of success and -1 in case of failure.

virDomainRestore

int	virDomainRestore		(virConnectPtr conn, 
const char * from)

This method will restore a domain saved to disk by virDomainSave().

conn:pointer to the hypervisor connection
from:path to the
Returns:0 in case of success and -1 in case of failure.

virDomainResume

int	virDomainResume			(virDomainPtr domain)

Resume a suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain(). This function may requires privileged access

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

virDomainRevertToSnapshot

int	virDomainRevertToSnapshot	(virDomainSnapshotPtr snapshot, 
unsigned int flags)

Revert the domain to a given snapshot.

snapshot:a domain snapshot object
flags:unused flag parameters; callers should pass 0
Returns:0 if the creation is successful, -1 on error.

virDomainSave

int	virDomainSave			(virDomainPtr domain, 
const char * to)

This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore (this may be a problem). Use virDomainRestore() to restore a domain after saving.

domain:a domain object
to:path for the output file
Returns:0 in case of success and -1 in case of failure.

virDomainSetAutostart

int	virDomainSetAutostart		(virDomainPtr domain, 
int autostart)

Configure the domain to be automatically started when the host machine boots.

domain:a domain object
autostart:whether the domain should be automatically started 0 or 1
Returns:-1 in case of error, 0 in case of success

virDomainSetMaxMemory

int	virDomainSetMaxMemory		(virDomainPtr domain, 
unsigned long memory)

Dynamically change the maximum amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function requires privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.

domain:a domain object or NULL
memory:the memory size in kilobytes
Returns:0 in case of success and -1 in case of failure.

virDomainSetMemory

int	virDomainSetMemory		(virDomainPtr domain, 
unsigned long memory)

Dynamically change the target amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function may requires privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.

domain:a domain object or NULL
memory:the memory size in kilobytes
Returns:0 in case of success and -1 in case of failure.

virDomainSetSchedulerParameters

int	virDomainSetSchedulerParameters	(virDomainPtr domain, 
virSchedParameterPtr params,
int nparams)

Change the scheduler parameters

domain:pointer to domain object
params:pointer to scheduler parameter objects
nparams:number of scheduler parameter (this value should be same or less than the returned value nparams of virDomainGetSchedulerType)
Returns:-1 in case of error, 0 in case of success.

virDomainSetVcpus

int	virDomainSetVcpus		(virDomainPtr domain, 
unsigned int nvcpus)

Dynamically change the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it or if growing the number is arbitrary limited. This function requires privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.

domain:pointer to domain object, or NULL for Domain0
nvcpus:the new number of virtual CPUs for this domain
Returns:0 in case of success, -1 in case of failure.

virDomainShutdown

int	virDomainShutdown		(virDomainPtr domain)

Shutdown a domain, the domain object is still usable there after but the domain OS is being stopped. Note that the guest OS may ignore the request. TODO: should we add an option for reboot, knowing it may not be doable in the general case ?

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

virDomainSnapshotCreateXML

virDomainSnapshotPtr	virDomainSnapshotCreateXML	(virDomainPtr domain, 
const char * xmlDesc,
unsigned int flags)

Creates a new snapshot of a domain based on the snapshot xml contained in xmlDesc.

domain:a domain object
xmlDesc:string containing an XML description of the domain
flags:unused flag parameters; callers should pass 0
Returns:an (opaque) virDomainSnapshotPtr on success, NULL on failure.

virDomainSnapshotCurrent

virDomainSnapshotPtr	virDomainSnapshotCurrent	(virDomainPtr domain, 
unsigned int flags)

Get the current snapshot for a domain, if any.

domain:a domain object
flags:unused flag parameters; callers should pass 0
Returns:a domain snapshot object or NULL in case of failure. If the current domain snapshot cannot be found, then the VIR_ERR_NO_DOMAIN_SNAPSHOT error is raised.

virDomainSnapshotDelete

int	virDomainSnapshotDelete		(virDomainSnapshotPtr snapshot, 
unsigned int flags)

Delete the snapshot. If @flags is 0, then just this snapshot is deleted, and changes from this snapshot are automatically merged into children snapshots. If flags is VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, then this snapshot and any children snapshots are deleted.

snapshot:a domain snapshot object
flags:flag parameters
Returns:0 if the snapshot was successfully deleted, -1 on error.

virDomainSnapshotFree

int	virDomainSnapshotFree		(virDomainSnapshotPtr snapshot)

Free the domain snapshot object. The snapshot itself is not modified. The data structure is freed and should not be used thereafter.

snapshot:a domain snapshot object
Returns:0 in case of success and -1 in case of failure.

virDomainSnapshotGetXMLDesc

char *	virDomainSnapshotGetXMLDesc	(virDomainSnapshotPtr snapshot, 
unsigned int flags)

Provide an XML description of the domain snapshot.

snapshot:a domain snapshot object
flags:unused flag parameters; callers should pass 0
Returns:a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virDomainSnapshotListNames

int	virDomainSnapshotListNames	(virDomainPtr domain, 
char ** names,
int nameslen,
unsigned int flags)

Collect the list of domain snapshots for the given domain, and store their names in @names. Caller is responsible for freeing each member of the array.

domain:a domain object
names:array to collect the list of names of snapshots
nameslen:size of @names
flags:unused flag parameters; callers should pass 0
Returns:the number of domain snapshots found or -1 in case of error.

virDomainSnapshotLookupByName

virDomainSnapshotPtr	virDomainSnapshotLookupByName	(virDomainPtr domain, 
const char * name,
unsigned int flags)

Try to lookup a domain snapshot based on its name.

domain:a domain object
name:name for the domain snapshot
flags:unused flag parameters; callers should pass 0
Returns:a domain snapshot object or NULL in case of failure. If the domain snapshot cannot be found, then the VIR_ERR_NO_DOMAIN_SNAPSHOT error is raised.

virDomainSnapshotNum

int	virDomainSnapshotNum		(virDomainPtr domain, 
unsigned int flags)

Provides the number of domain snapshots for this domain..

domain:a domain object
flags:unused flag parameters; callers should pass 0
Returns:the number of domain snapshost found or -1 in case of error.

virDomainSuspend

int	virDomainSuspend		(virDomainPtr domain)

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 virDomainResume() to reactivate the domain. This function may requires privileged access.

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

virDomainUndefine

int	virDomainUndefine		(virDomainPtr domain)

Undefine a domain but does not stop it if it is running

domain:pointer to a defined domain
Returns:0 in case of success, -1 in case of error

virDomainUpdateDeviceFlags

int	virDomainUpdateDeviceFlags	(virDomainPtr domain, 
const char * xml,
unsigned int flags)

Change a virtual device on a domain, using the flags parameter to control how the device is changed. VIR_DOMAIN_DEVICE_MODIFY_CURRENT specifies that the device change is made based on current domain state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be changed on the active domain instance only and is not added to the persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG specifies that the device shall be changed on the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation. This method is used for actions such changing CDROM/Floppy device media, altering the graphics configuration such as password, reconfiguring the NIC device backend connectivity, etc.

domain:pointer to domain object
xml:pointer to XML description of one device
flags:an OR'ed set of virDomainDeviceModifyFlags
Returns:0 in case of success, -1 in case of failure.

virEventAddHandleFunc

typedef int	(*virEventAddHandleFunc	)	(int fd, 
int event,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff)

Part of the EventImpl, this callback Adds a file handle callback to listen for specific events. The same file handle can be registered multiple times provided the requested event sets are non-overlapping If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose.

fd:file descriptor to listen on
event:bitset of events on which to fire the callback
cb:the callback to be called when an event occurrs
opaque:user data to pass to the callback
ff:the callback invoked to free opaque data blob
Returns:a handle watch number to be used for updating and unregistering for events

virEventAddTimeoutFunc

typedef int	(*virEventAddTimeoutFunc	)	(int timeout, 
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff)

Part of the EventImpl, this user-defined callback handles adding an event timeout. If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose.

timeout:The timeout to monitor
cb:the callback to call when timeout has expired
opaque:user data to pass to the callback
ff:the callback invoked to free opaque data blob
Returns:a timer value

virEventHandleCallback

typedef void	(*virEventHandleCallback	)	(int watch, 
int fd,
int events,
void * opaque)

Callback for receiving file handle events. The callback will be invoked once for each event which is pending.

watch:watch on which the event occurred
fd:file handle on which the event occurred
events:bitset of events from virEventHandleType constants
opaque:user data registered with handle

virEventRegisterImpl

void	virEventRegisterImpl		(virEventAddHandleFunc addHandle, 
virEventUpdateHandleFunc updateHandle,
virEventRemoveHandleFunc removeHandle,
virEventAddTimeoutFunc addTimeout,
virEventUpdateTimeoutFunc updateTimeout,
virEventRemoveTimeoutFunc removeTimeout)

addHandle:
updateHandle:
removeHandle:
addTimeout:
updateTimeout:
removeTimeout:

virEventRemoveHandleFunc

typedef int	(*virEventRemoveHandleFunc)	(int watch)

Part of the EventImpl, this user-provided callback is notified when an fd is no longer being listened on. If a virEventHandleFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data.

watch:file descriptor watch to stop listening on
Returns:

virEventRemoveTimeoutFunc

typedef int	(*virEventRemoveTimeoutFunc)	(int timer)

Part of the EventImpl, this user-defined callback removes a timer If a virEventTimeoutFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data.

timer:the timer to remove
Returns:0 on success, -1 on failure

virEventTimeoutCallback

typedef void	(*virEventTimeoutCallback	)	(int timer, 
void * opaque)

callback for receiving timer events

timer:timer id emitting the event
opaque:user data registered with handle

virEventUpdateHandleFunc

typedef void	(*virEventUpdateHandleFunc)	(int watch, 
int event)

Part of the EventImpl, this user-provided callback is notified when events to listen on change

watch:file descriptor watch to modify
event:new events to listen on

virEventUpdateTimeoutFunc

typedef void	(*virEventUpdateTimeoutFunc)	(int timer, 
int timeout)

Part of the EventImpl, this user-defined callback updates an event timeout.

timer:the timer to modify
timeout:the new timeout value

virFreeCallback

typedef void	(*virFreeCallback		)	(void * opaque)

opaque:

virGetVersion

int	virGetVersion			(unsigned long * libVer, 
const char * type,
unsigned long * typeVer)

Provides two information back, @libVer is the version of the library while @typeVer will be the version of the hypervisor type @type against which the library was compiled. If @type is NULL, "Xen" is assumed, if @type is unknown or not available, an error code will be returned and @typeVer will be 0.

libVer:return value for the library version (OUT)
type:the type of connection/driver looked at
typeVer:return value for the version of the hypervisor (OUT)
Returns:-1 in case of failure, 0 otherwise, and values for @libVer and @typeVer have the format major * 1,000,000 + minor * 1,000 + release.

virInitialize

int	virInitialize			(void)

Initialize the library. It's better to call this routine at startup in multithreaded applications to avoid potential race when initializing the library.

Returns:0 in case of success, -1 in case of error

virInterfaceCreate

int	virInterfaceCreate		(virInterfacePtr iface, 
unsigned int flags)

Activate an interface (ie call "ifup")

iface:pointer to a defined interface
flags:and OR'ed set of extraction flags, not used yet
Returns:0 in case of success, -1 in case of error

virInterfaceDefineXML

virInterfacePtr	virInterfaceDefineXML	(virConnectPtr conn, 
const char * xml,
unsigned int flags)

Define an interface (or modify existing interface configuration)

conn:pointer to the hypervisor connection
xml:the XML description for the interface, preferably in UTF-8
flags:and OR'ed set of extraction flags, not used yet
Returns:NULL in case of error, a pointer to the interface otherwise

virInterfaceDestroy

int	virInterfaceDestroy		(virInterfacePtr iface, 
unsigned int flags)

deactivate an interface (ie call "ifdown") This does not remove the interface from the config, and does not free the associated virInterfacePtr object.

iface:an interface object
flags:and OR'ed set of extraction flags, not used yet
Returns:0 in case of success and -1 in case of failure.

virInterfaceFree

int	virInterfaceFree		(virInterfacePtr iface)

Free the interface object. The interface itself is unaltered. The data structure is freed and should not be used thereafter.

iface:an interface object
Returns:0 in case of success and -1 in case of failure.

virInterfaceGetConnect

virConnectPtr	virInterfaceGetConnect	(virInterfacePtr iface)

Provides the connection pointer associated with an interface. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the interface object together.

iface:pointer to an interface
Returns:the virConnectPtr or NULL in case of failure.

virInterfaceGetMACString

const char *	virInterfaceGetMACString	(virInterfacePtr iface)

Get the MAC for an interface as string. For more information about MAC see RFC4122.

iface:an interface object
Returns:a pointer to the MAC address (in null-terminated ASCII format) or NULL, the string need not be deallocated its lifetime will be the same as the interface object.

virInterfaceGetName

const char *	virInterfaceGetName	(virInterfacePtr iface)

Get the public name for that interface

iface:an interface object
Returns:a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the interface object.

virInterfaceGetXMLDesc

char *	virInterfaceGetXMLDesc		(virInterfacePtr iface, 
unsigned int flags)

VIR_INTERFACE_XML_INACTIVE - return the static configuration, suitable for use redefining the interface via virInterfaceDefineXML() Provide an XML description of the interface. If VIR_INTERFACE_XML_INACTIVE is set, the description may be reused later to redefine the interface with virInterfaceDefineXML(). If it is not set, the ip address and netmask will be the current live setting of the interface, not the settings from the config files.

iface:an interface object
flags:an OR'ed set of extraction flags. Current valid bits:
Returns:a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virInterfaceIsActive

int	virInterfaceIsActive		(virInterfacePtr iface)

Determine if the interface is currently running

iface:pointer to the interface object
Returns:1 if running, 0 if inactive, -1 on error

virInterfaceLookupByMACString

virInterfacePtr	virInterfaceLookupByMACString	(virConnectPtr conn, 
const char * macstr)

Try to lookup an interface on the given hypervisor based on its MAC.

conn:pointer to the hypervisor connection
macstr:the MAC for the interface (null-terminated ASCII format)
Returns:a new interface object or NULL in case of failure. If the interface cannot be found, then VIR_ERR_NO_INTERFACE error is raised.

virInterfaceLookupByName

virInterfacePtr	virInterfaceLookupByName	(virConnectPtr conn, 
const char * name)

Try to lookup an interface on the given hypervisor based on its name.

conn:pointer to the hypervisor connection
name:name for the interface
Returns:a new interface object or NULL in case of failure. If the interface cannot be found, then VIR_ERR_NO_INTERFACE error is raised.

virInterfaceRef

int	virInterfaceRef			(virInterfacePtr iface)

Increment the reference count on the interface. For each additional call to this method, there shall be a corresponding call to virInterfaceFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using an interface would increment the reference count.

iface:the interface to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virInterfaceUndefine

int	virInterfaceUndefine		(virInterfacePtr iface)

Undefine an interface, ie remove it from the config. This does not free the associated virInterfacePtr object.

iface:pointer to a defined interface
Returns:0 in case of success, -1 in case of error

virNWFilterDefineXML

virNWFilterPtr	virNWFilterDefineXML	(virConnectPtr conn, 
const char * xmlDesc)

Define a new network filter, based on an XML description similar to the one returned by virNWFilterGetXMLDesc()

conn:pointer to the hypervisor connection
xmlDesc:an XML description of the nwfilter
Returns:a new nwfilter object or NULL in case of failure

virNWFilterFree

int	virNWFilterFree			(virNWFilterPtr nwfilter)

Free the nwfilter object. The running instance is kept alive. The data structure is freed and should not be used thereafter.

nwfilter:a nwfilter object
Returns:0 in case of success and -1 in case of failure.

virNWFilterGetName

const char *	virNWFilterGetName	(virNWFilterPtr nwfilter)

Get the public name for the network filter

nwfilter:a nwfilter object
Returns:a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the nwfilter object.

virNWFilterGetUUID

int	virNWFilterGetUUID		(virNWFilterPtr nwfilter, 
unsigned char * uuid)

Get the UUID for a network filter

nwfilter:a nwfilter object
uuid:pointer to a VIR_UUID_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virNWFilterGetUUIDString

int	virNWFilterGetUUIDString	(virNWFilterPtr nwfilter, 
char * buf)

Get the UUID for a network filter as string. For more information about UUID see RFC4122.

nwfilter:a nwfilter object
buf:pointer to a VIR_UUID_STRING_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virNWFilterGetXMLDesc

char *	virNWFilterGetXMLDesc		(virNWFilterPtr nwfilter, 
int flags)

Provide an XML description of the network filter. The description may be reused later to redefine the network filter with virNWFilterCreateXML().

nwfilter:a nwfilter object
flags:an OR'ed set of extraction flags, not used yet
Returns:a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virNWFilterLookupByName

virNWFilterPtr	virNWFilterLookupByName	(virConnectPtr conn, 
const char * name)

Try to lookup a network filter on the given hypervisor based on its name.

conn:pointer to the hypervisor connection
name:name for the network filter
Returns:a new nwfilter object or NULL in case of failure. If the network filter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.

virNWFilterLookupByUUID

virNWFilterPtr	virNWFilterLookupByUUID	(virConnectPtr conn, 
const unsigned char * uuid)

Try to lookup a network filter on the given hypervisor based on its UUID.

conn:pointer to the hypervisor connection
uuid:the raw UUID for the network filter
Returns:a new nwfilter object or NULL in case of failure. If the nwfdilter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.

virNWFilterLookupByUUIDString

virNWFilterPtr	virNWFilterLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)

Try to lookup an nwfilter on the given hypervisor based on its UUID.

conn:pointer to the hypervisor connection
uuidstr:the string UUID for the nwfilter
Returns:a new nwfilter object or NULL in case of failure. If the nwfilter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.

virNWFilterRef

int	virNWFilterRef			(virNWFilterPtr nwfilter)

Increment the reference count on the nwfilter. For each additional call to this method, there shall be a corresponding call to virNWFilterFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using an nwfilter would increment the reference count.

nwfilter:the nwfilter to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virNWFilterUndefine

int	virNWFilterUndefine		(virNWFilterPtr nwfilter)

Undefine the nwfilter object. This call will not succeed if a running VM is referencing the filter. This does not free the associated virNWFilterPtr object.

nwfilter:a nwfilter object
Returns:0 in case of success and -1 in case of failure.

virNetworkCreate

int	virNetworkCreate		(virNetworkPtr network)

Create and start a defined network. If the call succeed the network moves from the defined to the running networks pools.

network:pointer to a defined network
Returns:0 in case of success, -1 in case of error

virNetworkCreateXML

virNetworkPtr	virNetworkCreateXML	(virConnectPtr conn, 
const char * xmlDesc)

Create and start a new virtual network, based on an XML description similar to the one returned by virNetworkGetXMLDesc()

conn:pointer to the hypervisor connection
xmlDesc:an XML description of the network
Returns:a new network object or NULL in case of failure

virNetworkDefineXML

virNetworkPtr	virNetworkDefineXML	(virConnectPtr conn, 
const char * xml)

Define a network, but does not create it

conn:pointer to the hypervisor connection
xml:the XML description for the network, preferably in UTF-8
Returns:NULL in case of error, a pointer to the network otherwise

virNetworkDestroy

int	virNetworkDestroy		(virNetworkPtr network)

Destroy the network object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. This does not free the associated virNetworkPtr object. This function may require privileged access

network:a network object
Returns:0 in case of success and -1 in case of failure.

virNetworkFree

int	virNetworkFree			(virNetworkPtr network)

Free the network object. The running instance is kept alive. The data structure is freed and should not be used thereafter.

network:a network object
Returns:0 in case of success and -1 in case of failure.

virNetworkGetAutostart

int	virNetworkGetAutostart		(virNetworkPtr network, 
int * autostart)

Provides a boolean value indicating whether the network configured to be automatically started when the host machine boots.

network:a network object
autostart:the value returned
Returns:-1 in case of error, 0 in case of success

virNetworkGetBridgeName

char *	virNetworkGetBridgeName		(virNetworkPtr network)

Provides a bridge interface name to which a domain may connect a network interface in order to join the network.

network:a network object
Returns:a 0 terminated interface name, or NULL in case of error. the caller must free() the returned value.

virNetworkGetConnect

virConnectPtr	virNetworkGetConnect	(virNetworkPtr net)

Provides the connection pointer associated with a network. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the network object together.

net:pointer to a network
Returns:the virConnectPtr or NULL in case of failure.

virNetworkGetName

const char *	virNetworkGetName	(virNetworkPtr network)

Get the public name for that network

network:a network object
Returns:a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the network object.

virNetworkGetUUID

int	virNetworkGetUUID		(virNetworkPtr network, 
unsigned char * uuid)

Get the UUID for a network

network:a network object
uuid:pointer to a VIR_UUID_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virNetworkGetUUIDString

int	virNetworkGetUUIDString		(virNetworkPtr network, 
char * buf)

Get the UUID for a network as string. For more information about UUID see RFC4122.

network:a network object
buf:pointer to a VIR_UUID_STRING_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virNetworkGetXMLDesc

char *	virNetworkGetXMLDesc		(virNetworkPtr network, 
int flags)

Provide an XML description of the network. The description may be reused later to relaunch the network with virNetworkCreateXML().

network:a network object
flags:an OR'ed set of extraction flags, not used yet
Returns:a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.

virNetworkIsActive

int	virNetworkIsActive		(virNetworkPtr net)

Determine if the network is currently running

net:pointer to the network object
Returns:1 if running, 0 if inactive, -1 on error

virNetworkIsPersistent

int	virNetworkIsPersistent		(virNetworkPtr net)

Determine if the network has a persistent configuration which means it will still exist after shutting down

net:pointer to the network object
Returns:1 if persistent, 0 if transient, -1 on error

virNetworkLookupByName

virNetworkPtr	virNetworkLookupByName	(virConnectPtr conn, 
const char * name)

Try to lookup a network on the given hypervisor based on its name.

conn:pointer to the hypervisor connection
name:name for the network
Returns:a new network object or NULL in case of failure. If the network cannot be found, then VIR_ERR_NO_NETWORK error is raised.

virNetworkLookupByUUID

virNetworkPtr	virNetworkLookupByUUID	(virConnectPtr conn, 
const unsigned char * uuid)

Try to lookup a network on the given hypervisor based on its UUID.

conn:pointer to the hypervisor connection
uuid:the raw UUID for the network
Returns:a new network object or NULL in case of failure. If the network cannot be found, then VIR_ERR_NO_NETWORK error is raised.

virNetworkLookupByUUIDString

virNetworkPtr	virNetworkLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)

Try to lookup a network on the given hypervisor based on its UUID.

conn:pointer to the hypervisor connection
uuidstr:the string UUID for the network
Returns:a new network object or NULL in case of failure. If the network cannot be found, then VIR_ERR_NO_NETWORK error is raised.

virNetworkRef

int	virNetworkRef			(virNetworkPtr network)

Increment the reference count on the network. For each additional call to this method, there shall be a corresponding call to virNetworkFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a network would increment the reference count.

network:the network to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virNetworkSetAutostart

int	virNetworkSetAutostart		(virNetworkPtr network, 
int autostart)

Configure the network to be automatically started when the host machine boots.

network:a network object
autostart:whether the network should be automatically started 0 or 1
Returns:-1 in case of error, 0 in case of success

virNetworkUndefine

int	virNetworkUndefine		(virNetworkPtr network)

Undefine a network but does not stop it if it is running

network:pointer to a defined network
Returns:0 in case of success, -1 in case of error

virNodeDeviceCreateXML

virNodeDevicePtr	virNodeDeviceCreateXML	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)

Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.

conn:pointer to the hypervisor connection
xmlDesc:string containing an XML description of the device to be created
flags:callers should always pass 0
Returns:a node device object if successful, NULL in case of failure

virNodeDeviceDestroy

int	virNodeDeviceDestroy		(virNodeDevicePtr dev)

Destroy the device object. The virtual device is removed from the host operating system. This function may require privileged access

dev:a device object
Returns:0 in case of success and -1 in case of failure.

virNodeDeviceDettach

int	virNodeDeviceDettach		(virNodeDevicePtr dev)

Dettach the node device from the node itself so that it may be assigned to a guest domain. Depending on the hypervisor, this may involve operations such as unbinding any device drivers from the device, binding the device to a dummy device driver and resetting the device. If the device is currently in use by the node, this method may fail. Once the device is not assigned to any guest, it may be re-attached to the node using the virNodeDeviceReattach() method.

dev:pointer to the node device
Returns:0 in case of success, -1 in case of failure.

virNodeDeviceFree

int	virNodeDeviceFree		(virNodeDevicePtr dev)

Drops a reference to the node device, freeing it if this was the last reference.

dev:pointer to the node device
Returns:the 0 for success, -1 for error.

virNodeDeviceGetName

const char *	virNodeDeviceGetName	(virNodeDevicePtr dev)

Just return the device name

dev:the device
Returns:the device name or NULL in case of error

virNodeDeviceGetParent

const char *	virNodeDeviceGetParent	(virNodeDevicePtr dev)

Accessor for the parent of the device

dev:the device
Returns:the name of the device's parent, or NULL if the device has no parent.

virNodeDeviceGetXMLDesc

char *	virNodeDeviceGetXMLDesc		(virNodeDevicePtr dev, 
unsigned int flags)

Fetch an XML document describing all aspects of the device.

dev:pointer to the node device
flags:flags for XML generation (unused, pass 0)
Returns:the XML document, or NULL on error

virNodeDeviceListCaps

int	virNodeDeviceListCaps		(virNodeDevicePtr dev, 
char ** const names,
int maxnames)

Lists the names of the capabilities supported by the device.

dev:the device
names:array to collect the list of capability names
maxnames:size of @names
Returns:the number of capability names listed in @names.

virNodeDeviceLookupByName

virNodeDevicePtr	virNodeDeviceLookupByName	(virConnectPtr conn, 
const char * name)

Lookup a node device by its name.

conn:pointer to the hypervisor connection
name:unique device name
Returns:a virNodeDevicePtr if found, NULL otherwise.

virNodeDeviceNumOfCaps

int	virNodeDeviceNumOfCaps		(virNodeDevicePtr dev)

Accessor for the number of capabilities supported by the device.

dev:the device
Returns:the number of capabilities supported by the device.

virNodeDeviceReAttach

int	virNodeDeviceReAttach		(virNodeDevicePtr dev)

Re-attach a previously dettached node device to the node so that it may be used by the node again. Depending on the hypervisor, this may involve operations such as resetting the device, unbinding it from a dummy device driver and binding it to its appropriate driver. If the device is currently in use by a guest, this method may fail.

dev:pointer to the node device
Returns:0 in case of success, -1 in case of failure.

virNodeDeviceRef

int	virNodeDeviceRef		(virNodeDevicePtr dev)

Increment the reference count on the dev. For each additional call to this method, there shall be a corresponding call to virNodeDeviceFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a dev would increment the reference count.

dev:the dev to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virNodeDeviceReset

int	virNodeDeviceReset		(virNodeDevicePtr dev)

Reset a previously dettached node device to the node before or after assigning it to a guest. The exact reset semantics depends on the hypervisor and device type but, for example, KVM will attempt to reset PCI devices with a Function Level Reset, Secondary Bus Reset or a Power Management D-State reset. If the reset will affect other devices which are currently in use, this function may fail.

dev:pointer to the node device
Returns:0 in case of success, -1 in case of failure.

virNodeGetCellsFreeMemory

int	virNodeGetCellsFreeMemory	(virConnectPtr conn, 
unsigned long long * freeMems,
int startCell,
int maxCells)

This call returns the amount of free memory in one or more NUMA cells. The @freeMems array must be allocated by the caller and will be filled with the amount of free memory in bytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller.

conn:pointer to the hypervisor connection
freeMems:pointer to the array of unsigned long long
startCell:index of first cell to return freeMems info on.
maxCells:Maximum number of cells for which freeMems information can be returned.
Returns:the number of entries filled in freeMems, or -1 in case of error.

virNodeGetFreeMemory

unsigned long long	virNodeGetFreeMemory	(virConnectPtr conn)

provides the free memory available on the Node Note: most libvirt APIs provide memory sizes in kilobytes, but in this function the returned value is in bytes. Divide by 1024 as necessary.

conn:pointer to the hypervisor connection
Returns:the available free memory in bytes or 0 in case of error

virNodeGetInfo

int	virNodeGetInfo			(virConnectPtr conn, 
virNodeInfoPtr info)

Extract hardware information about the node.

conn:pointer to the hypervisor connection
info:pointer to a virNodeInfo structure allocated by the user
Returns:0 in case of success and -1 in case of failure.

virNodeGetSecurityModel

int	virNodeGetSecurityModel		(virConnectPtr conn, 
virSecurityModelPtr secmodel)

Extract the security model of a hypervisor. The 'model' field in the @secmodel argument may be initialized to the empty string if the driver has not activated a security model.

conn:a connection object
secmodel:pointer to a virSecurityModel structure
Returns:0 in case of success, -1 in case of failure

virNodeListDevices

int	virNodeListDevices		(virConnectPtr conn, 
const char * cap,
char ** const names,
int maxnames,
unsigned int flags)

Collect the list of node devices, and store their names in @names If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability

conn:pointer to the hypervisor connection
cap:capability name
names:array to collect the list of node device names
maxnames:size of @names
flags:flags (unused, pass 0)
Returns:the number of node devices found or -1 in case of error

virNodeNumOfDevices

int	virNodeNumOfDevices		(virConnectPtr conn, 
const char * cap,
unsigned int flags)

Provides the number of node devices. If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability

conn:pointer to the hypervisor connection
cap:capability name
flags:flags (unused, pass 0)
Returns:the number of node devices or -1 in case of error

virSecretDefineXML

virSecretPtr	virSecretDefineXML	(virConnectPtr conn, 
const char * xml,
unsigned int flags)

If XML specifies a UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded). Otherwise, creates a new secret with an automatically chosen UUID, and initializes its attributes from xml.

conn:virConnect connection
xml:XML describing the secret.
flags:flags, use 0 for now
Returns:a the secret on success, NULL on failure.

virSecretFree

int	virSecretFree			(virSecretPtr secret)

Release the secret handle. The underlying secret continues to exist.

secret:pointer to a secret
Returns:0 on success, or -1 on error

virSecretGetConnect

virConnectPtr	virSecretGetConnect	(virSecretPtr secret)

Provides the connection pointer associated with a secret. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the secret object together.

secret:A virSecret secret
Returns:the virConnectPtr or NULL in case of failure.

virSecretGetUUID

int	virSecretGetUUID		(virSecretPtr secret, 
unsigned char * uuid)

Fetches the UUID of the secret.

secret:A virSecret secret
uuid:buffer of VIR_UUID_BUFLEN bytes in size
Returns:0 on success with the uuid buffer being filled, or -1 upon failure.

virSecretGetUUIDString

int	virSecretGetUUIDString		(virSecretPtr secret, 
char * buf)

Get the UUID for a secret as string. For more information about UUID see RFC4122.

secret:a secret object
buf:pointer to a VIR_UUID_STRING_BUFLEN bytes array
Returns:-1 in case of error, 0 in case of success

virSecretGetUsageID

const char *	virSecretGetUsageID	(virSecretPtr secret)

Get the unique identifier of the object with which this secret is to be used. The format of the identifier is dependant on the usage type of the secret. For a secret with a usage type of VIR_SECRET_USAGE_TYPE_VOLUME the identifier will be a fully qualfied path name. The identifiers are intended to be unique within the set of all secrets sharing the same usage type. ie, there shall only ever be one secret for each volume path.

secret:a secret object
Returns:a string identifying the object using the secret, or NULL upon error

virSecretGetUsageType

int	virSecretGetUsageType		(virSecretPtr secret)

Get the type of object which uses this secret. The returned value is one of the constants defined in the virSecretUsageType enumeration. More values may be added to this enumeration in the future, so callers should expect to see usage types they do not explicitly know about.

secret:a secret object
Returns:a positive integer identifying the type of object, or -1 upon error.

virSecretGetValue

unsigned char *	virSecretGetValue	(virSecretPtr secret, 
size_t * value_size,
unsigned int flags)

Fetches the value of a secret.

secret:A virSecret connection
value_size:Place for storing size of the secret value
flags:flags, use 0 for now
Returns:the secret value on success, NULL on failure. The caller must free() the secret value.

virSecretGetXMLDesc

char *	virSecretGetXMLDesc		(virSecretPtr secret, 
unsigned int flags)

Fetches an XML document describing attributes of the secret.

secret:A virSecret secret
flags:flags, use 0 for now
Returns:the XML document on success, NULL on failure. The caller must free() the XML.

virSecretLookupByUUID

virSecretPtr	virSecretLookupByUUID	(virConnectPtr conn, 
const unsigned char * uuid)

Try to lookup a secret on the given hypervisor based on its UUID. Uses the 16 bytes of raw data to describe the UUID

conn:pointer to the hypervisor connection
uuid:the raw UUID for the secret
Returns:a new secret object or NULL in case of failure. If the secret cannot be found, then VIR_ERR_NO_SECRET error is raised.

virSecretLookupByUUIDString

virSecretPtr	virSecretLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)

Try to lookup a secret on the given hypervisor based on its UUID. Uses the printable string value to describe the UUID

conn:pointer to the hypervisor connection
uuidstr:the string UUID for the secret
Returns:a new secret object or NULL in case of failure. If the secret cannot be found, then VIR_ERR_NO_SECRET error is raised.

virSecretLookupByUsage

virSecretPtr	virSecretLookupByUsage	(virConnectPtr conn, 
int usageType,
const char * usageID)

Try to lookup a secret on the given hypervisor based on its usage The usageID is unique within the set of secrets sharing the same usageType value.

conn:pointer to the hypervisor connection
usageType:the type of secret usage
usageID:identifier of the object using the secret
Returns:a new secret object or NULL in case of failure. If the secret cannot be found, then VIR_ERR_NO_SECRET error is raised.

virSecretRef

int	virSecretRef			(virSecretPtr secret)

Increment the reference count on the secret. For each additional call to this method, there shall be a corresponding call to virSecretFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a secret would increment the reference count.

secret:the secret to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virSecretSetValue

int	virSecretSetValue		(virSecretPtr secret, 
const unsigned char * value,
size_t value_size,
unsigned int flags)

Sets the value of a secret.

secret:A virSecret secret
value:Value of the secret
value_size:Size of the value
flags:flags, use 0 for now
Returns:0 on success, -1 on failure.

virSecretUndefine

int	virSecretUndefine		(virSecretPtr secret)

Deletes the specified secret. This does not free the associated virSecretPtr object.

secret:A virSecret secret
Returns:0 on success, -1 on failure.

virStoragePoolBuild

int	virStoragePoolBuild		(virStoragePoolPtr pool, 
unsigned int flags)

Build the underlying storage pool

pool:pointer to storage pool
flags:future flags, use 0 for now
Returns:0 on success, or -1 upon failure

virStoragePoolCreate

int	virStoragePoolCreate		(virStoragePoolPtr pool, 
unsigned int flags)

Starts an inactive storage pool

pool:pointer to storage pool
flags:future flags, use 0 for now
Returns:0 on success, or -1 if it could not be started

virStoragePoolCreateXML

virStoragePoolPtr	virStoragePoolCreateXML	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)

Create a new storage based on its XML description. The pool is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted

conn:pointer to hypervisor connection
xmlDesc:XML description for new pool
flags:future flags, use 0 for now
Returns:a virStoragePoolPtr object, or NULL if creation failed

virStoragePoolDefineXML

virStoragePoolPtr	virStoragePoolDefineXML	(virConnectPtr conn, 
const char * xml,
unsigned int flags)

Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.

conn:pointer to hypervisor connection
xml:XML description for new pool
flags:future flags, use 0 for now
Returns:a virStoragePoolPtr object, or NULL if creation failed

virStoragePoolDelete

int	virStoragePoolDelete		(virStoragePoolPtr pool, 
unsigned int flags)

Delete the underlying pool resources. This is a non-recoverable operation. The virStoragePoolPtr object itself is not free'd.

pool:pointer to storage pool
flags:flags for obliteration process
Returns:0 on success, or -1 if it could not be obliterate

virStoragePoolDestroy

int	virStoragePoolDestroy		(virStoragePoolPtr pool)

Destroy an active storage pool. This will deactivate the pool on the host, but keep any persistent config associated with it. If it has a persistent config it can later be restarted with virStoragePoolCreate(). This does not free the associated virStoragePoolPtr object.

pool:pointer to storage pool
Returns:0 on success, or -1 if it could not be destroyed

virStoragePoolFree

int	virStoragePoolFree		(virStoragePoolPtr pool)

Free a storage pool object, releasing all memory associated with it. Does not change the state of the pool on the host.

pool:pointer to storage pool
Returns:0 on success, or -1 if it could not be free'd.

virStoragePoolGetAutostart

int	virStoragePoolGetAutostart	(virStoragePoolPtr pool, 
int * autostart)

Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot time

pool:pointer to storage pool
autostart:location in which to store autostart flag
Returns:0 on success, -1 on failure

virStoragePoolGetConnect

virConnectPtr	virStoragePoolGetConnect	(virStoragePoolPtr pool)

Provides the connection pointer associated with a storage pool. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the pool object together.

pool:pointer to a pool
Returns:the virConnectPtr or NULL in case of failure.

virStoragePoolGetInfo

int	virStoragePoolGetInfo		(virStoragePoolPtr pool, 
virStoragePoolInfoPtr info)

Get volatile information about the storage pool such as free space / usage summary

pool:pointer to storage pool
info:pointer at which to store info
Returns:0 on success, or -1 on failure.

virStoragePoolGetName

const char *	virStoragePoolGetName	(virStoragePoolPtr pool)

Fetch the locally unique name of the storage pool

pool:pointer to storage pool
Returns:the name of the pool, or NULL on error

virStoragePoolGetUUID

int	virStoragePoolGetUUID		(virStoragePoolPtr pool, 
unsigned char * uuid)

Fetch the globally unique ID of the storage pool

pool:pointer to storage pool
uuid:buffer of VIR_UUID_BUFLEN bytes in size
Returns:0 on success, or -1 on error;

virStoragePoolGetUUIDString

int	virStoragePoolGetUUIDString	(virStoragePoolPtr pool, 
char * buf)

Fetch the globally unique ID of the storage pool as a string

pool:pointer to storage pool
buf:buffer of VIR_UUID_STRING_BUFLEN bytes in size
Returns:0 on success, or -1 on error;

virStoragePoolGetXMLDesc

char *	virStoragePoolGetXMLDesc	(virStoragePoolPtr pool, 
unsigned int flags)

Fetch an XML document describing all aspects of the storage pool. This is suitable for later feeding back into the virStoragePoolCreateXML method.

pool:pointer to storage pool
flags:flags for XML format options (set of virDomainXMLFlags)
Returns:a XML document, or NULL on error

virStoragePoolIsActive

int	virStoragePoolIsActive		(virStoragePoolPtr pool)

Determine if the storage pool is currently running

pool:pointer to the storage pool object
Returns:1 if running, 0 if inactive, -1 on error

virStoragePoolIsPersistent

int	virStoragePoolIsPersistent	(virStoragePoolPtr pool)

Determine if the storage pool has a persistent configuration which means it will still exist after shutting down

pool:pointer to the storage pool object
Returns:1 if persistent, 0 if transient, -1 on error

virStoragePoolListVolumes

int	virStoragePoolListVolumes	(virStoragePoolPtr pool, 
char ** const names,
int maxnames)

Fetch list of storage volume names, limiting to at most maxnames.

pool:pointer to storage pool
names:array in which to storage volume names
maxnames:size of names array
Returns:the number of names fetched, or -1 on error

virStoragePoolLookupByName

virStoragePoolPtr	virStoragePoolLookupByName	(virConnectPtr conn, 
const char * name)

Fetch a storage pool based on its unique name

conn:pointer to hypervisor connection
name:name of pool to fetch
Returns:a virStoragePoolPtr object, or NULL if no matching pool is found

virStoragePoolLookupByUUID

virStoragePoolPtr	virStoragePoolLookupByUUID	(virConnectPtr conn, 
const unsigned char * uuid)

Fetch a storage pool based on its globally unique id

conn:pointer to hypervisor connection
uuid:globally unique id of pool to fetch
Returns:a virStoragePoolPtr object, or NULL if no matching pool is found

virStoragePoolLookupByUUIDString

virStoragePoolPtr	virStoragePoolLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)

Fetch a storage pool based on its globally unique id

conn:pointer to hypervisor connection
uuidstr:globally unique id of pool to fetch
Returns:a virStoragePoolPtr object, or NULL if no matching pool is found

virStoragePoolLookupByVolume

virStoragePoolPtr	virStoragePoolLookupByVolume	(virStorageVolPtr vol)

Fetch a storage pool which contains a particular volume

vol:pointer to storage volume
Returns:a virStoragePoolPtr object, or NULL if no matching pool is found

virStoragePoolNumOfVolumes

int	virStoragePoolNumOfVolumes	(virStoragePoolPtr pool)

Fetch the number of storage volumes within a pool

pool:pointer to storage pool
Returns:the number of storage pools, or -1 on failure

virStoragePoolRef

int	virStoragePoolRef		(virStoragePoolPtr pool)

Increment the reference count on the pool. For each additional call to this method, there shall be a corresponding call to virStoragePoolFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a pool would increment the reference count.

pool:the pool to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virStoragePoolRefresh

int	virStoragePoolRefresh		(virStoragePoolPtr pool, 
unsigned int flags)

Request that the pool refresh its list of volumes. This may involve communicating with a remote server, and/or initializing new devices at the OS layer

pool:pointer to storage pool
flags:flags to control refresh behaviour (currently unused, use 0)
Returns:0 if the volume list was refreshed, -1 on failure

virStoragePoolSetAutostart

int	virStoragePoolSetAutostart	(virStoragePoolPtr pool, 
int autostart)

Sets the autostart flag

pool:pointer to storage pool
autostart:new flag setting
Returns:0 on success, -1 on failure

virStoragePoolUndefine

int	virStoragePoolUndefine		(virStoragePoolPtr pool)

Undefine an inactive storage pool

pool:pointer to storage pool
Returns:0 on success, -1 on failure

virStorageVolCreateXML

virStorageVolPtr	virStorageVolCreateXML	(virStoragePoolPtr pool, 
const char * xmldesc,
unsigned int flags)

Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes

pool:pointer to storage pool
xmldesc:description of volume to create
flags:flags for creation (unused, pass 0)
Returns:the storage volume, or NULL on error

virStorageVolCreateXMLFrom

virStorageVolPtr	virStorageVolCreateXMLFrom	(virStoragePoolPtr pool, 
const char * xmldesc,
virStorageVolPtr clonevol,
unsigned int flags)

Create a storage volume in the parent pool, using the 'clonevol' volume as input. Information for the new volume (name, perms) are passed via a typical volume XML description.

pool:pointer to parent pool for the new volume
xmldesc:description of volume to create
clonevol:storage volume to use as input
flags:flags for creation (unused, pass 0)
Returns:the storage volume, or NULL on error

virStorageVolDelete

int	virStorageVolDelete		(virStorageVolPtr vol, 
unsigned int flags)

Delete the storage volume from the pool

vol:pointer to storage volume
flags:future flags, use 0 for now
Returns:0 on success, or -1 on error

virStorageVolFree

int	virStorageVolFree		(virStorageVolPtr vol)

Release the storage volume handle. The underlying storage volume continues to exist.

vol:pointer to storage volume
Returns:0 on success, or -1 on error

virStorageVolGetConnect

virConnectPtr	virStorageVolGetConnect	(virStorageVolPtr vol)

Provides the connection pointer associated with a storage volume. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the volume object together.

vol:pointer to a pool
Returns:the virConnectPtr or NULL in case of failure.

virStorageVolGetInfo

int	virStorageVolGetInfo		(virStorageVolPtr vol, 
virStorageVolInfoPtr info)

Fetches volatile information about the storage volume such as its current allocation

vol:pointer to storage volume
info:pointer at which to store info
Returns:0 on success, or -1 on failure

virStorageVolGetKey

const char *	virStorageVolGetKey	(virStorageVolPtr vol)

Fetch the storage volume key. This is globally unique, so the same volume will have the same key no matter what host it is accessed from

vol:pointer to storage volume
Returns:the volume key, or NULL on error

virStorageVolGetName

const char *	virStorageVolGetName	(virStorageVolPtr vol)

Fetch the storage volume name. This is unique within the scope of a pool

vol:pointer to storage volume
Returns:the volume name, or NULL on error

virStorageVolGetPath

char *	virStorageVolGetPath		(virStorageVolPtr vol)

Fetch the storage volume path. Depending on the pool configuration this is either persistent across hosts, or dynamically assigned at pool startup. Consult pool documentation for information on getting the persistent naming

vol:pointer to storage volume
Returns:the storage volume path, or NULL on error

virStorageVolGetXMLDesc

char *	virStorageVolGetXMLDesc		(virStorageVolPtr vol, 
unsigned int flags)

Fetch an XML document describing all aspects of the storage volume

vol:pointer to storage volume
flags:flags for XML generation (unused, pass 0)
Returns:the XML document, or NULL on error

virStorageVolLookupByKey

virStorageVolPtr	virStorageVolLookupByKey	(virConnectPtr conn, 
const char * key)

Fetch a pointer to a storage volume based on its globally unique key

conn:pointer to hypervisor connection
key:globally unique key
Returns:a storage volume, or NULL if not found / error

virStorageVolLookupByName

virStorageVolPtr	virStorageVolLookupByName	(virStoragePoolPtr pool, 
const char * name)

Fetch a pointer to a storage volume based on its name within a pool

pool:pointer to storage pool
name:name of storage volume
Returns:a storage volume, or NULL if not found / error

virStorageVolLookupByPath

virStorageVolPtr	virStorageVolLookupByPath	(virConnectPtr conn, 
const char * path)

Fetch a pointer to a storage volume based on its locally (host) unique path

conn:pointer to hypervisor connection
path:locally unique path
Returns:a storage volume, or NULL if not found / error

virStorageVolRef

int	virStorageVolRef		(virStorageVolPtr vol)

Increment the reference count on the vol. For each additional call to this method, there shall be a corresponding call to virStorageVolFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a vol would increment the reference count.

vol:the vol to hold a reference on
Returns:0 in case of success, -1 in case of failure.

virStorageVolWipe

int	virStorageVolWipe		(virStorageVolPtr vol, 
unsigned int flags)

Ensure data previously on a volume is not accessible to future reads

vol:pointer to storage volume
flags:future flags, use 0 for now
Returns:0 on success, or -1 on error

virStreamAbort

int	virStreamAbort			(virStreamPtr stream)

Request that the in progress data transfer be cancelled abnormally before the end of the stream has been reached. For output streams this can be used to inform the driver that the stream is being terminated early. For input streams this can be used to inform the driver that it should stop sending data.

stream:pointer to the stream object
Returns:0 on success, -1 upon error

virStreamEventAddCallback

int	virStreamEventAddCallback	(virStreamPtr stream, 
int events,
virStreamEventCallback cb,
void * opaque,
virFreeCallback ff)

Register a callback to be notified when a stream becomes writable, or readable. This is most commonly used in conjunction with non-blocking data streams to integrate into an event loop

stream:pointer to the stream object
events:set of events to monitor
cb:callback to invoke when an event occurs
opaque:application defined data
ff:callback to free @opaque data
Returns:0 on success, -1 upon error

virStreamEventCallback

typedef void	(*virStreamEventCallback	)	(virStreamPtr stream, 
int events,
void * opaque)

Callback for receiving stream events. The callback will be invoked once for each event which is pending.

stream:stream on which the event occurred
events:bitset of events from virEventHandleType constants
opaque:user data registered with handle

virStreamEventRemoveCallback

int	virStreamEventRemoveCallback	(virStreamPtr stream)

Remove an event callback from the stream

stream:pointer to the stream object
Returns:0 on success, -1 on error

virStreamEventUpdateCallback

int	virStreamEventUpdateCallback	(virStreamPtr stream, 
int events)

Changes the set of events to monitor for a stream. This allows for event notification to be changed without having to unregister & register the callback completely. This method is guarenteed to succeed if a callback is already registered

stream:pointer to the stream object
events:set of events to monitor
Returns:0 on success, -1 if no callback is registered

virStreamFinish

int	virStreamFinish			(virStreamPtr stream)

Indicate that there is no further data is to be transmitted on the stream. For output streams this should be called once all data has been written. For input streams this should be called once virStreamRecv returns end-of-file. This method is a synchronization point for all asynchronous errors, so if this returns a success code the application can be sure that all data has been successfully processed.

stream:pointer to the stream object
Returns:0 on success, -1 upon error

virStreamFree

int	virStreamFree			(virStreamPtr stream)

Decrement the reference count on a stream, releasing the stream object if the reference count has hit zero. There must not be an active data transfer in progress when releasing the stream. If a stream needs to be disposed of prior to end of stream being reached, then the virStreamAbort function should be called first.

stream:pointer to the stream object
Returns:0 upon success, or -1 on error

virStreamNew

virStreamPtr	virStreamNew		(virConnectPtr conn, 
unsigned int flags)

Creates a new stream object which can be used to perform streamed I/O with other public API function. When no longer needed, a stream object must be released with virStreamFree. If a data stream has been used, then the application must call virStreamFinish or virStreamAbort before free'ing to, in order to notify the driver of termination. If a non-blocking data stream is required passed VIR_STREAM_NONBLOCK for flags, otherwise pass 0.

conn:pointer to the connection
flags:control features of the stream
Returns:the new stream, or NULL upon error

virStreamRecv

int	virStreamRecv			(virStreamPtr stream, 
char * data,
size_t nbytes)

Write a series of bytes to the stream. This method may block the calling application for an arbitrary amount of time. Errors are not guaranteed to be reported synchronously with the call, but may instead be delayed until a subsequent call. An example using this with a hypothetical file download API looks like virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_WRONLY, 0600) virConnectDownloadFile(conn, "demo.iso", st); while (1) { char buf[1024]; int got = virStreamRecv(st, buf, 1024); if (got < 0) break; if (got == 0) { virStreamFinish(st); break; } int offset = 0; while (offset < got) { int sent = write(fd, buf+offset, got-offset) if (sent < 0) { virStreamAbort(st); goto done; } offset += sent; } } if (virStreamFinish(st) < 0) ... report an error .... done: virStreamFree(st); close(fd);

stream:pointer to the stream object
data:buffer to write to stream
nbytes:size of @data buffer
Returns:the number of bytes read, which may be less than requested. Returns 0 when the end of the stream is reached, at which time the caller should invoke virStreamFinish() to get confirmation of stream completion. Returns -1 upon error, at which time the stream will be marked as aborted, and the caller should now release the stream with virStreamFree. Returns -2 if there is no data pending to be read & the stream is marked as non-blocking.

virStreamRecvAll

int	virStreamRecvAll		(virStreamPtr stream, 
virStreamSinkFunc handler,
void * opaque)

Receive the entire data stream, sending the data to the requested data sink. This is simply a convenient alternative to virStreamRecv, for apps that do blocking-I/o. An example using this with a hypothetical file download API looks like int mysink(virStreamPtr st, const char *buf, int nbytes, void *opaque) { int *fd = opaque; return write(*fd, buf, nbytes); } virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_WRONLY) virConnectUploadFile(conn, st); if (virStreamRecvAll(st, mysink, &fd) < 0) { ...report an error ... goto done; } if (virStreamFinish(st) < 0) ...report an error... virStreamFree(st); close(fd);

stream:pointer to the stream object
handler:sink callback for writing data to application
opaque:application defined data
Returns:0 if all the data was successfully received. The caller should invoke virStreamFinish(st) to flush the stream upon success and then virStreamFree Returns -1 upon any error, with virStreamAbort() already having been called, so the caller need only call virStreamFree()

virStreamRef

int	virStreamRef			(virStreamPtr stream)

Increment the reference count on the stream. For each additional call to this method, there shall be a corresponding call to virStreamFree to release the reference count, once the caller no longer needs the reference to this object.

stream:pointer to the stream
Returns:0 in case of success, -1 in case of failure

virStreamSend

int	virStreamSend			(virStreamPtr stream, 
const char * data,
size_t nbytes)

Write a series of bytes to the stream. This method may block the calling application for an arbitrary amount of time. Once an application has finished sending data it should call virStreamFinish to wait for successful confirmation from the driver, or detect any error This method may not be used if a stream source has been registered Errors are not guaranteed to be reported synchronously with the call, but may instead be delayed until a subsequent call. An example using this with a hypothetical file upload API looks like virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_RDONLY) virConnectUploadFile(conn, "demo.iso", st); while (1) { char buf[1024]; int got = read(fd, buf, 1024); if (got < 0) { virStreamAbort(st); break; } if (got == 0) { virStreamFinish(st); break; } int offset = 0; while (offset < got) { int sent = virStreamSend(st, buf+offset, got-offset) if (sent < 0) { virStreamAbort(st); goto done; } offset += sent; } } if (virStreamFinish(st) < 0) ... report an error .... done: virStreamFree(st); close(fd);

stream:pointer to the stream object
data:buffer to write to stream
nbytes:size of @data buffer
Returns:the number of bytes written, which may be less than requested. Returns -1 upon error, at which time the stream will be marked as aborted, and the caller should now release the stream with virStreamFree. Returns -2 if the outgoing transmit buffers are full & the stream is marked as non-blocking.

virStreamSendAll

int	virStreamSendAll		(virStreamPtr stream, 
virStreamSourceFunc handler,
void * opaque)

Send the entire data stream, reading the data from the requested data source. This is simply a convenient alternative to virStreamSend, for apps that do blocking-I/o. An example using this with a hypothetical file upload API looks like int mysource(virStreamPtr st, char *buf, int nbytes, void *opaque) { int *fd = opaque; return read(*fd, buf, nbytes); } virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_RDONLY) virConnectUploadFile(conn, st); if (virStreamSendAll(st, mysource, &fd) < 0) { ...report an error ... goto done; } if (virStreamFinish(st) < 0) ...report an error... virStreamFree(st); close(fd);

stream:pointer to the stream object
handler:source callback for reading data from application
opaque:application defined data
Returns:0 if all the data was successfully sent. The caller should invoke virStreamFinish(st) to flush the stream upon success and then virStreamFree Returns -1 upon any error, with virStreamAbort() already having been called, so the caller need only call virStreamFree()

virStreamSinkFunc

typedef int	(*virStreamSinkFunc	)	(virStreamPtr st, 
const char * data,
size_t nbytes,
void * opaque)

The virStreamSinkFunc callback is used together with the virStreamRecvAll function for libvirt to provide the data that has been received. The callback will be invoked multiple times, providing data in small chunks. The application should consume up 'nbytes' from the 'data' array of data and then return the number actual number of bytes consumed. The callback will continue to be invoked until it indicates the end of the stream has been reached. A return value of -1 at any time will abort the receive operation

st:the stream object
data:preallocated array to be filled with data
nbytes:size of the data array
opaque:optional application provided data
Returns:the number of bytes consumed or -1 upon error

virStreamSourceFunc

typedef int	(*virStreamSourceFunc	)	(virStreamPtr st, 
char * data,
size_t nbytes,
void * opaque)

The virStreamSourceFunc callback is used together with the virStreamSendAll function for libvirt to obtain the data that is to be sent. The callback will be invoked multiple times, fetching data in small chunks. The application should fill the 'data' array with upto 'nbytes' of data and then return the number actual number of bytes. The callback will continue to be invoked until it indicates the end of the source has been reached by returning 0. A return value of -1 at any time will abort the send operation

st:the stream object
data:preallocated array to be filled with data
nbytes:size of the data array
opaque:optional application provided data
Returns:the number of bytes filled, 0 upon end of file, or -1 upon error

Reference Manual for libvirt

Table of Contents