Module libvirt from libvirt

Provides the interfaces of the libvirt library to handle Xen domains from a process running in domain 0

Table of Contents

#define LIBVIR_VERSION_NUMBER
#define VIR_COPY_CPUMAP
#define VIR_CPU_MAPLEN
#define VIR_CPU_USABLE
#define VIR_DOMAIN_SCHED_FIELD_LENGTH
#define VIR_GET_CPUMAP
#define VIR_NODEINFO_MAXCPUS
#define VIR_UNUSE_CPU
#define VIR_USE_CPU
#define VIR_UUID_BUFLEN
#define VIR_UUID_STRING_BUFLEN
Structure virConnect
struct _virConnect The content of this structure is not made public by the API.
Typedef virConnect * virConnectPtr
Enum virDeviceMode
Structure virDomain
struct _virDomain The content of this structure is not made public by the API.
Enum virDomainCreateFlags
Structure virDomainInfo
struct _virDomainInfo
Typedef virDomainInfo * virDomainInfoPtr
Structure virDomainKernel
struct _virDomainKernel
Typedef virDomainKernel * virDomainKernelPtr
Typedef virDomain * virDomainPtr
Enum virDomainRestart
Enum virDomainState
Structure virNetwork
struct _virNetwork The content of this structure is not made public by the API.
Typedef virNetwork * virNetworkPtr
Structure virNodeInfo
struct _virNodeInfo
Typedef virNodeInfo * virNodeInfoPtr
Structure virSchedParameter
struct _virSchedParameter
Typedef virSchedParameter * virSchedParameterPtr
Enum virSchedParameterType
Structure virVcpuInfo
struct _virVcpuInfo
Typedef virVcpuInfo * virVcpuInfoPtr
Enum virVcpuState
int	virConnectClose			(virConnectPtr conn)
char *	virConnectGetCapabilities	(virConnectPtr conn)
int	virConnectGetMaxVcpus		(virConnectPtr conn, 
const char * type)
const char *	virConnectGetType	(virConnectPtr conn)
int	virConnectGetVersion		(virConnectPtr conn, 
unsigned long * hvVer)
int	virConnectListDefinedDomains	(virConnectPtr conn, 
char ** const names,
int maxnames)
int	virConnectListDefinedNetworks	(virConnectPtr conn, 
char ** const names,
int maxnames)
int	virConnectListDomains		(virConnectPtr conn, 
int * ids,
int maxids)
int	virConnectListNetworks		(virConnectPtr conn, 
char ** const names,
int maxnames)
int	virConnectNumOfDefinedDomains	(virConnectPtr conn)
int	virConnectNumOfDefinedNetworks	(virConnectPtr conn)
int	virConnectNumOfDomains		(virConnectPtr conn)
int	virConnectNumOfNetworks		(virConnectPtr conn)
virConnectPtr	virConnectOpen		(const char * name)
virConnectPtr	virConnectOpenReadOnly	(const char * name)
int	virDomainAttachDevice		(virDomainPtr domain, 
char * xml)
int	virDomainCoreDump		(virDomainPtr domain, 
const char * to,
int flags)
int	virDomainCreate			(virDomainPtr domain)
virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)
virDomainPtr	virDomainDefineXML	(virConnectPtr conn, 
const char * xml)
int	virDomainDestroy		(virDomainPtr domain)
int	virDomainDetachDevice		(virDomainPtr domain, 
char * xml)
int	virDomainFree			(virDomainPtr domain)
int	virDomainGetAutostart		(virDomainPtr domain, 
int * autostart)
unsigned int	virDomainGetID		(virDomainPtr domain)
int	virDomainGetInfo		(virDomainPtr domain, 
virDomainInfoPtr 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	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)
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	virDomainPinVcpu		(virDomainPtr domain, 
unsigned int vcpu,
unsigned char * cpumap,
int maplen)
int	virDomainReboot			(virDomainPtr domain, 
unsigned int flags)
int	virDomainRestore		(virConnectPtr conn, 
const char * from)
int	virDomainResume			(virDomainPtr domain)
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)
int	virDomainSuspend		(virDomainPtr domain)
int	virDomainUndefine		(virDomainPtr domain)
int	virGetVersion			(unsigned long * libVer, 
const char * type,
unsigned long * typeVer)
int	virInitialize			(void)
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)
const char *	virNetworkGetName	(virNetworkPtr network)
int	virNetworkGetUUID		(virNetworkPtr network, 
unsigned char * uuid)
int	virNetworkGetUUIDString		(virNetworkPtr network, 
char * buf)
char *	virNetworkGetXMLDesc		(virNetworkPtr network, 
int flags)
virNetworkPtr	virNetworkLookupByName	(virConnectPtr conn, 
const char * name)
virNetworkPtr	virNetworkLookupByUUID	(virConnectPtr conn, 
const unsigned char * uuid)
virNetworkPtr	virNetworkLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)
int	virNetworkSetAutostart		(virNetworkPtr network, 
int autostart)
int	virNetworkUndefine		(virNetworkPtr network)
int	virNodeGetInfo			(virConnectPtr conn, 
virNodeInfoPtr info)

Description

Macro: LIBVIR_VERSION_NUMBER

#define LIBVIR_VERSION_NUMBER

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

Macro: VIR_COPY_CPUMAP

#define VIR_COPY_CPUMAP

This macro is to be used in conjonction 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.

Macro: VIR_CPU_MAPLEN

#define VIR_CPU_MAPLEN

This macro is to be used in conjonction 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.

Macro: VIR_CPU_USABLE

#define VIR_CPU_USABLE

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

Macro: VIR_DOMAIN_SCHED_FIELD_LENGTH

#define VIR_DOMAIN_SCHED_FIELD_LENGTH

Macro providing the field length of virSchedParameter

Macro: VIR_GET_CPUMAP

#define VIR_GET_CPUMAP

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

Macro: VIR_NODEINFO_MAXCPUS

#define VIR_NODEINFO_MAXCPUS

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

Macro: VIR_UNUSE_CPU

#define VIR_UNUSE_CPU

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

Macro: VIR_USE_CPU

#define VIR_USE_CPU

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

Macro: VIR_UUID_BUFLEN

#define VIR_UUID_BUFLEN

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

Macro: VIR_UUID_STRING_BUFLEN

#define VIR_UUID_STRING_BUFLEN

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

Structure virConnect

Structure virConnect
struct _virConnect { The content of this structure is not made public by the API. }
a virConnectPtr is pointer to a virConnect private structure, this is the type used to reference a connection to the Xen Hypervisor in the API.

Enum virDeviceMode

Enum virDeviceMode {
    VIR_DEVICE_DEFAULT = 0 : Default mode
    VIR_DEVICE_RO = 1 : Access read-only
    VIR_DEVICE_RW = 2 : Access read-write
    VIR_DEVICE_RW_FORCE = 3 : Forced read-write even if already used
}

Structure virDomain

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

Enum virDomainCreateFlags

Enum virDomainCreateFlags {
    VIR_DOMAIN_NONE = 0
}

Structure virDomainInfo

Structure virDomainInfo
struct _virDomainInfo { unsigned char state : the running state, one of virDomainFlag unsigned long maxMem : the maximum memory in KBytes allowed unsigned long memory : the memory in KBytes used by the domain unsigned short nrVirtCpu : the number of virtual CPUs for the doma unsigned long long cpuTime : the CPU time used in nanoseconds }
a virDomainInfoPtr is a pointer to a virDomainInfo structure.

Structure virDomainKernel

Structure virDomainKernel
struct _virDomainKernel { const char * kernel : filename pointing to the kernel image const char * ramdisk : an optional init ramdisk const char * root : an optional root block device const char * extra : optional kernel command line parameters }
a virDomainKernelPtr is a pointer to a virDomainKernel structure. a virDomainPtr is pointer to a virDomain private structure, this is the type used to reference a Xen domain in the API.

Enum virDomainRestart

Enum virDomainRestart {
    VIR_DOMAIN_DESTROY = 1 : destroy the domain
    VIR_DOMAIN_RESTART = 2 : restart the domain
    VIR_DOMAIN_PRESERVE = 3 : keep as is, need manual destroy, for debug
    VIR_DOMAIN_RENAME_RESTART = 4 : restart under an new unique name
}

Enum 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
}

Structure virNetwork

Structure virNetwork
struct _virNetwork { The content of this structure is not made public by the API. }
a virNetworkPtr is pointer to a virNetwork private structure, this is the type used to reference a virtual network in the API.

Structure virNodeInfo

Structure virNodeInfo
struct _virNodeInfo { charmodel[32] model : string indicating the CPU model unsigned long memory : memory size in kilobytes unsigned int cpus : the number of active CPUs unsigned int mhz : expected CPU frequency unsigned int nodes : the number of NUMA cell, 1 for uniform unsigned int sockets : number of CPU socket per node unsigned int cores : number of core per socket unsigned int threads : number of threads per core }
a virNodeInfoPtr is a pointer to a virNodeInfo structure.

Structure virSchedParameter

Structure virSchedParameter
struct _virSchedParameter { charfield[VIR_DOMAIN_SCHED_FIELD_LENGTH] field : parameter name int type : parameter type }
a virSchedParameterPtr is a pointer to a virSchedParameter structure.

Enum 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
}

Structure virVcpuInfo

Structure virVcpuInfo
struct _virVcpuInfo { unsigned int number : virtual CPU number int state : value from virVcpuState unsigned long long cpuTime : CPU time used, in nanoseconds int cpu : real CPU number, or -1 if offline }

Enum 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
}

Function: 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.

Function: virConnectGetCapabilities

char *	virConnectGetCapabilities	(virConnectPtr conn)

Provides capabilities of the hypervisor / driver.

conn:pointer to the hypervisor connection
Returns:NULL in case of error, or a pointer to an opaque virCapabilities structure (virCapabilitiesPtr). The client must free the returned string after use.

Function: 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.

Function: 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.

Function: 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 priviledged 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

Function: virConnectListDefinedDomains

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

list the defined 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

Function: 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

Function: 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

Function: 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

Function: virConnectNumOfDefinedDomains

int	virConnectNumOfDefinedDomains	(virConnectPtr conn)

Provides the number of inactive domains.

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

Function: 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

Function: 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

Function: 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

Function: virConnectOpen

virConnectPtr	virConnectOpen		(const char * name)

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

name:optional argument currently unused, pass NULL
Returns:a pointer to the hypervisor connection or NULL in case of error

Function: virConnectOpenReadOnly

virConnectPtr	virConnectOpenReadOnly	(const char * name)

This function should be called first to get a restricted connection to the libbrary functionalities. The set of APIs usable are then restricted on the available methods to control the domains.

name:optional argument currently unused, pass NULL
Returns:a pointer to the hypervisor connection or NULL in case of error

Function: virDomainAttachDevice

int	virDomainAttachDevice		(virDomainPtr domain, 
char * xml)

Create a virtual device attachment to backend.

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

Function: 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.

Function: virDomainCreate

int	virDomainCreate			(virDomainPtr domain)

launch a defined domain. If the call succeed 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

Function: virDomainCreateLinux

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

Launch a new Linux guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires priviledged access to the hypervisor.

conn:pointer to the hypervisor connection
xmlDesc:an XML description of the domain
flags:an optional set of virDomainFlags
Returns:a new domain object or NULL in case of failure

Function: virDomainDefineXML

virDomainPtr	virDomainDefineXML	(virConnectPtr conn, 
const char * xml)

define a domain, but does not start it

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

Function: 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. The data structure is freed and should not be used thereafter if the call does not return an error. This function may requires priviledged access

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

Function: virDomainDetachDevice

int	virDomainDetachDevice		(virDomainPtr domain, 
char * xml)

Destroy a virtual device attachment to backend.

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

Function: 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.

Function: 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

Function: 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

Function: 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.

Function: 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.

Function: 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.

Function: 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.

Function: 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.

Function: 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.

Function: 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.

Function: 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

Function: 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

Function: 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 is'nt 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 an bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) If cpumaps is NULL, then no cupmap 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...).
Returns:the number of info filled in case of success, -1 in case of failure.

Function: 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 virDomainCreateLinux().

domain:a domain object
flags:and 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.

Function: virDomainLookupByID

virDomainPtr	virDomainLookupByID	(virConnectPtr conn, 
int id)

Try to find a domain based on the hypervisor ID number

conn:pointer to the hypervisor connection
id:the domain ID number
Returns:a new domain object or NULL in case of failure

Function: 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

Function: 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

Function: 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

Function: 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 priviledged access to the hypervisor.

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.

Function: 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.

Function: 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.

Function: virDomainResume

int	virDomainResume			(virDomainPtr domain)

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

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

Function: 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.

Function: 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

Function: 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 priviledged access to the hypervisor.

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

Function: 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 priviledged access to the hypervisor.

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

Function: 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.

Function: 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 priviledged access to the hypervisor.

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.

Function: 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.

Function: 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 priviledged access.

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

Function: 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

Function: 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 availble, 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.

Function: 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

Function: 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

Function: 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

Function: 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

Function: 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. The data structure is freed and should not be used thereafter if the call does not return an error. This function may requires priviledged access

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

Function: 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.

Function: 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

Function: 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.

Function: 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.

Function: 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

Function: 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

Function: 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:and 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.

Function: 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

Function: 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

Function: 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

Function: 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

Function: 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

Function: 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.