Module virterror from libvirt

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

Table of Contents

Structure virError
struct _virError
Enum virErrorDomain
Enum virErrorLevel
Enum virErrorNumber
Typedef virError * virErrorPtr
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)
Function type: virErrorFunc
void	virErrorFunc			(void * userData, 
virErrorPtr error)
virErrorPtr	virGetLastError		(void)
void	virResetError			(virErrorPtr err)
void	virResetLastError		(void)
void	virSetErrorFunc			(void * userData, 
virErrorFunc handler)

Description

Structure virError

Structure virError
struct _virError { int code : The error code, e.g. an virParserError int domain : What part of the library raised this er char * message : human-readable informative error messag virErrorLevel level : how consequent is the error virConnectPtr conn : the connection if available virDomainPtr dom : the domain if available char * str1 : extra string information char * str2 : extra string information char * str3 : extra string information int int1 : extra number information int int2 : extra number information }

Enum 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_DOM = 3 : Error when operating on a domain
}

Enum virErrorLevel

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

Enum virErrorNumber

Enum virErrorNumber {
    VIR_ERR_OK = 0
    VIR_ERR_INTERNAL_ERROR = 1 : 1
    VIR_ERR_NO_MEMORY = 2 : 2
}

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()

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.

Function: virConnGetLastError

virErrorPtr	virConnGetLastError	(virConnectPtr conn)

Provide a pointer to the last error caught on that connection Simpler but may not be suitable for multithreaded accesses, in which case use virConnCopyLastError()

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

Function: virConnResetLastError

void	virConnResetLastError		(virConnectPtr conn)

Reset the last error caught on that connection

conn:pointer to the hypervisor connection

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

Function: virCopyLastError

int	virCopyLastError		(virErrorPtr to)

Copy the content of the last error caught at the library level 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.

Function type: virErrorFunc

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

Function: virGetLastError

virErrorPtr	virGetLastError		(void)

Provide a pointer to the last error caught at the library level Simpler but may not be suitable for multithreaded accesses, in which case use virCopyLastError()

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

Function: virResetError

void	virResetError			(virErrorPtr err)

Reset the error being pointed to

err:pointer to the virError to clean up

Function: virResetLastError

void	virResetLastError		(void)

Reset the last error caught at the library level.

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

related links

Graphics and design by Diana Fong