From: Daniel Veillard Date: Tue, 20 Mar 2007 15:22:39 +0000 (+0000) Subject: * src/xen_internal.c: applied patch from Atsushi SAKAI fixing X-Git-Tag: LIBVIRT_0_2_2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=633a3bef0d0bafe4c90cf6ef29809c2039351581;p=thirdparty%2Flibvirt.git * src/xen_internal.c: applied patch from Atsushi SAKAI fixing direct hypervisor calls on some recent Xen versions Daniel --- diff --git a/ChangeLog b/ChangeLog index ceba169c82..8a812846f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 20 16:30:29 CET 2007 Daniel Veillard + + * src/xen_internal.c: applied patch from Atsushi SAKAI fixing + direct hypervisor calls on some recent Xen versions + Tue Mar 20 15:58:10 CET 2007 Daniel Veillard * libvirt.spec.in: missing /etc/libvirt/qemu/networks/autostart diff --git a/docs/html/libvirt-libvirt.html b/docs/html/libvirt-libvirt.html index 33525e611a..c6b2f651eb 100644 --- a/docs/html/libvirt-libvirt.html +++ b/docs/html/libvirt-libvirt.html @@ -1,6 +1,6 @@ -Module libvirt from libvirt

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_GET_CPUMAP
#define VIR_NODEINFO_MAXCPUS
#define VIR_UNUSE_CPU
#define VIR_USE_CPU
Structure virConnect
struct _virConnect +Module libvirt from libvirt

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_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
@@ -14,18 +14,27 @@ The content of this structure is not made public by the API.
 
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 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, 
const char ** names,
int maxnames)
+
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)
@@ -36,9 +45,11 @@ The content of this structure is not made public by the API.
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	virDomainGetUUID		(virDomainPtr domain, 
unsigned char * uuid)
@@ -54,6 +65,7 @@ The content of this structure is not made public by the API.
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	virDomainSetVcpus		(virDomainPtr domain, 
unsigned int nvcpus)
@@ -62,6 +74,22 @@ The content of this structure is not made public by the API.
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

@@ -72,6 +100,8 @@ The content of this structure is not made public by the API.

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. }
@@ -119,7 +149,11 @@ The content of this structure is not made public by the API. VIR_DOMAIN_SHUTOFF = 5 : the domain is shut off VIR_DOMAIN_CRASHED = 6 : the domain is crashed } -

Structure virNodeInfo

Structure virNodeInfo
struct _virNodeInfo { +

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 @@ -142,19 +176,31 @@ The content of this structure is not made public by the API. }

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

const char *	virConnectGetType	(virConnectPtr conn)
+
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, 
const char ** names,
int maxnames)
+
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: virConnectNumOfDefinedDomains

int	virConnectNumOfDefinedDomains	(virConnectPtr conn)
+
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 active domains.

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

Function: virConnectNumOfDomains

int	virConnectNumOfDomains		(virConnectPtr conn)
+
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: virConnectOpen

virConnectPtr	virConnectOpen		(const char * name)
+
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.

@@ -174,21 +220,25 @@ The content of this structure is not made public by the API.

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

unsigned int	virDomainGetID		(virDomainPtr domain)
+
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: virDomainGetName

const char *	virDomainGetName	(virDomainPtr domain)
+
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: virDomainGetUUID

int	virDomainGetUUID		(virDomainPtr domain, 
unsigned char * uuid)

Get the UUID for a domain

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

Function: virDomainGetUUIDString

int	virDomainGetUUIDString		(virDomainPtr domain, 
char * buf)
+
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 37 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)
+
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().

@@ -210,7 +260,9 @@ The content of this structure is not made public by the API.

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

int	virDomainSetMaxMemory		(virDomainPtr domain, 
unsigned long memory)
+
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.

@@ -226,6 +278,38 @@ The content of this structure is not made public by the API.

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

int	virNodeGetInfo			(virConnectPtr conn, 
virNodeInfoPtr info)
+
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.

diff --git a/docs/html/libvirt-virterror.html b/docs/html/libvirt-virterror.html index ca65bcf94e..aaa71655d0 100644 --- a/docs/html/libvirt-virterror.html +++ b/docs/html/libvirt-virterror.html @@ -31,6 +31,7 @@ void virErrorFunc (void * userData,
virNetworkPtr net : the network if available }

Enum virErrorDomain

Enum virErrorDomain {
     VIR_FROM_NONE = 0
     VIR_FROM_XEN = 1 : Error at Xen hypervisor layer
@@ -42,6 +43,8 @@ void	virErrorFunc			(void * userData, 
VIR_FROM_RPC = 7 : Error in the XML-RPC code VIR_FROM_PROXY = 8 : Error in the proxy code 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 }

Enum virErrorLevel

Enum virErrorLevel {
     VIR_ERR_NONE = 0
@@ -85,6 +88,9 @@ void	virErrorFunc			(void * userData, 
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 }

Function: virConnCopyLastError

int	virConnCopyLastError		(virConnectPtr conn, 
virErrorPtr to)

Copy the content of the last error caught on that connection One will need to free the result with virResetError()

diff --git a/po/libvirt.pot b/po/libvirt.pot index d053fd6751..13096e18e4 100644 --- a/po/libvirt.pot +++ b/po/libvirt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-03-16 18:45+0100\n" +"POT-Creation-Date: 2007-03-20 11:12+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1608,11 +1608,16 @@ msgstr "" msgid "error: " msgstr "" -#: src/virsh.c:3137 src/virsh.c:3149 src/virsh.c:3161 +#: src/virsh.c:3137 src/virsh.c:3149 #, c-format msgid "%s: %d: failed to allocate %d bytes" msgstr "" +#: src/virsh.c:3161 +#, c-format +msgid "%s: %d: failed to allocate %lu bytes" +msgstr "" + #: src/virsh.c:3191 msgid "failed to connect to the hypervisor" msgstr "" diff --git a/src/xen_internal.c b/src/xen_internal.c index 5f66e22b24..66066de6e2 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -655,7 +655,6 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op) return (0); } -#ifndef PROXY /** * xenHypervisorDoV2Dom: * @handle: the handle to the Xen hypervisor @@ -697,7 +696,6 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op) return (0); } -#endif /* PROXY */ /** * virXen_getdomaininfolist: @@ -1057,6 +1055,8 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu, } return(ret); } +#endif /* !PROXY*/ + /** * virXen_getvcpusinfo: * @handle: the hypervisor handle @@ -1169,7 +1169,6 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt, } return(ret); } -#endif /* !PROXY*/ /** * xenHypervisorInit: @@ -1184,6 +1183,7 @@ xenHypervisorInit(void) hypercall_t hc; v0_hypercall_t v0_hc; xen_getdomaininfo info; + virVcpuInfoPtr ipt; if (initialized) { if (hypervisor_version == -1) @@ -1291,15 +1291,47 @@ xenHypervisorInit(void) * or the old ones */ hypervisor_version = 2; - /* TODO: one probably will need to autodetect thse subversions too */ + + ipt = malloc(sizeof(virVcpuInfo)); + if (ipt == NULL){ +#ifdef DEBUG + fprintf(stderr, "Memory allocation failed at xenHypervisorIniti()\n"); +#endif + return(-1); + } + /* Currently consider RHEL5.0 Fedora7 and xen-unstable */ sys_interface_version = 2; /* XEN_SYSCTL_INTERFACE_VERSION */ - dom_interface_version = 3; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { + /* RHEL 5.0 */ + dom_interface_version = 3; /* XEN_DOMCTL_INTERFACE_VERSION */ + if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ #ifdef DEBUG - fprintf(stderr, "Using hypervisor call v2, sys version 2\n"); + fprintf(stderr, "Using hypervisor call v2, sys ver2 dom ver3\n"); #endif - goto done; + goto done; + } + /* Fedora 7 */ + dom_interface_version = 4; /* XEN_DOMCTL_INTERFACE_VERSION */ + if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ +#ifdef DEBUG + fprintf(stderr, "Using hypervisor call v2, sys ver2 dom ver4\n"); +#endif + goto done; + } } + + sys_interface_version = 3; /* XEN_SYSCTL_INTERFACE_VERSION */ + if (virXen_getdomaininfo(fd, 0, &info) == 1) { + /* xen-unstable */ + dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ + if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ +#ifdef DEBUG + fprintf(stderr, "Using hypervisor call v2, sys ver3 dom ver5\n"); +#endif + goto done; + } + } + hypervisor_version = 1; sys_interface_version = -1; if (virXen_getdomaininfo(fd, 0, &info) == 1) {