From 2a10972010da079fa1f0d5d770bb8860c7792756 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 7 Jun 2007 13:05:00 +0000 Subject: [PATCH] * src/libvirt.c: do not die if the daemon is not running on a Xen system (shows up as root only) and emit a warning instead * src/virterror.c include/libvirt/virterror.h docs/*: add the new warning. Daniel --- ChangeLog | 7 ++ docs/APIchunk0.html | 4 + docs/APIchunk1.html | 3 +- docs/APIchunk2.html | 6 +- docs/APIchunk3.html | 8 +- docs/APIchunk4.html | 25 ++++- docs/APIfiles.html | 19 ++++ docs/APIfunctions.html | 7 ++ docs/APIsymbols.html | 19 ++++ docs/devhelp/libvirt-libvirt.html | 79 ++++++++++++---- docs/devhelp/libvirt-virterror.html | 9 +- docs/html/libvirt-libvirt.html | 36 +++++++- docs/html/libvirt-virterror.html | 5 + docs/libvirt-api.xml | 123 ++++++++++++++++++------- docs/libvirt-refs.xml | 137 +++++++++++++++++++++++++++- include/libvirt/virterror.h | 1 + src/libvirt.c | 34 ++++++- src/virterror.c | 42 +++++---- 18 files changed, 480 insertions(+), 84 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b0232d1ce..c5ea03bc18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Jun 7 15:02:44 CEST 2007 Daniel Veillard + + * src/libvirt.c: do not die if the daemon is not running on a Xen + system (shows up as root only) and emit a warning instead + * src/virterror.c include/libvirt/virterror.h docs/*: add + the new warning. + Wed Jun 6 16:37:36 CEST 2007 Daniel Veillard * src/xml.c: patch from Saori Fukuta to avoid (type ioemu) diff --git a/docs/APIchunk0.html b/docs/APIchunk0.html index 22b93276dd..4e088c0726 100644 --- a/docs/APIchunk0.html +++ b/docs/APIchunk0.html @@ -43,6 +43,7 @@ virDomainGetVcpus
virDomainPinVcpu
virDomainSetVcpus
+
Change
virDomainSetSchedulerParameters
Collect
virConnectListDomains
virConnectListNetworks
Configure
virDomainSetAutostart
@@ -81,6 +82,8 @@ virDomainGetID
virDomainGetName
virDomainGetOSType
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virDomainGetUUID
virDomainGetUUIDString
virNetworkGetName
@@ -96,6 +99,7 @@

Letter L:

Launch
virDomainCreateLinux
Linux
virDomainCreateLinux

Letter M:

Macro
LIBVIR_VERSION_NUMBER
+VIR_DOMAIN_SCHED_FIELD_LENGTH

Letter N:

NUMA
_virNodeInfo
Note
virDomainCoreDump
virDomainGetInfo
diff --git a/docs/APIchunk1.html b/docs/APIchunk1.html index fee89cd061..0630a16044 100644 --- a/docs/APIchunk1.html +++ b/docs/APIchunk1.html @@ -29,7 +29,6 @@ _virNodeInfo
virConnectListDomains
virConnectListNetworks
-virConnectNumOfDefinedDomains
virConnectNumOfDomains
virConnectNumOfNetworks
virDomainSuspend
@@ -84,6 +83,7 @@ virConnectListDefinedNetworks
virConnectListDomains
virConnectListNetworks
+virDomainGetSchedulerParameters
virDomainGetUUID
virDomainGetUUIDString
virDomainGetVcpus
@@ -180,6 +180,7 @@ virSetErrorFunc
caller
cpumap
virDomainGetOSType
+virDomainGetSchedulerType
virDomainGetXMLDesc
virNetworkGetBridgeName
virNetworkGetXMLDesc
diff --git a/docs/APIchunk2.html b/docs/APIchunk2.html index 8302588608..072e605c32 100644 --- a/docs/APIchunk2.html +++ b/docs/APIchunk2.html @@ -72,10 +72,12 @@
extraction
virDomainGetXMLDesc
virNetworkGetXMLDesc

Letter f:

fail
virDomainSetVcpus
+
field
VIR_DOMAIN_SCHED_FIELD_LENGTH
file
virDomainCoreDump
virDomainSave
filename
_virDomainKernel
-
filled
virDomainGetVcpus
+
filled
virDomainGetSchedulerParameters
+virDomainGetVcpus
find
virDomainLookupByID
first
virConnectOpen
virConnectOpenReadOnly
@@ -96,6 +98,7 @@
free
virConnCopyLastError
virConnectGetCapabilities
virCopyLastError
+virDomainGetSchedulerType
virDomainGetXMLDesc
virNetworkGetBridgeName
virNetworkGetXMLDesc
@@ -179,6 +182,7 @@ virDomainShutdown
image
_virDomainKernel
inactive
virConnectListDefinedNetworks
+virConnectNumOfDefinedDomains
virConnectNumOfDefinedNetworks
virDomainGetMaxVcpus
indicating
_virNodeInfo
diff --git a/docs/APIchunk3.html b/docs/APIchunk3.html index 932f13d931..16cfbef737 100644 --- a/docs/APIchunk3.html +++ b/docs/APIchunk3.html @@ -29,9 +29,11 @@
launch
virDomainCreate
least
virDomainPinVcpu
length
VIR_CPU_MAPLEN
+VIR_DOMAIN_SCHED_FIELD_LENGTH
VIR_UUID_BUFLEN
VIR_UUID_STRING_BUFLEN
maplen
+
less
virDomainSetSchedulerParameters
level
virConnectGetVersion
virCopyLastError
virDomainSuspend
@@ -145,11 +147,13 @@
must
cpumap
virConnectGetCapabilities
virDomainGetOSType
+virDomainGetSchedulerType
virDomainGetVcpus
virDomainGetXMLDesc
virNetworkGetBridgeName
virNetworkGetXMLDesc
-

Letter n:

name
virConnectGetType
+

Letter n:

name
_virSchedParameter
+virConnectGetType
virDomainGetName
virDomainLookupByName
virNetworkGetBridgeName
@@ -211,6 +215,8 @@ virNetworkGetName
virNetworkGetXMLDesc
virNetworkUndefine
+
nparams
virDomainGetSchedulerParameters
+virDomainSetSchedulerParameters

A-X a-c d-i diff --git a/docs/APIchunk4.html b/docs/APIchunk4.html index 954dacae15..1956a2e313 100644 --- a/docs/APIchunk4.html +++ b/docs/APIchunk4.html @@ -7,7 +7,8 @@ o-s t-w x-z -

Letter o:

occured
virConnGetLastError
+

Letter o:

objects
virDomainSetSchedulerParameters
+
occured
virConnGetLastError
virGetLastError
offline
_virVcpuInfo
one
_virDomainInfo
@@ -38,10 +39,16 @@ virGetVersion
virNetworkDefineXML
output
virDomainSave
-

Letter p:

parameter
virConnCopyLastError
+

Letter p:

parameter
_virSchedParameter
+virConnCopyLastError
virConnectGetMaxVcpus
virCopyLastError
+virDomainGetSchedulerParameters
+virDomainSetSchedulerParameters
parameters
_virDomainKernel
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
+virDomainSetSchedulerParameters
part
_virError
partial
virDomainGetInfo
pass
virConnSetErrorFunc
@@ -88,6 +95,7 @@
provides
VIR_UUID_BUFLEN
VIR_UUID_STRING_BUFLEN
providing
LIBVIR_VERSION_NUMBER
+VIR_DOMAIN_SCHED_FIELD_LENGTH
public
virDomainGetName
virNetworkGetName

Letter r:

race
virInitialize
@@ -147,14 +155,19 @@ virCopyLastError
return
virConnectGetVersion
virDomainDestroy
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virGetVersion
virNetworkDestroy
returned
virConnectGetCapabilities
virDomainCreateLinux
virDomainGetAutostart
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virDomainGetVcpus
virDomainGetXMLDesc
virDomainPinVcpu
+virDomainSetSchedulerParameters
virGetVersion
virNetworkCreateXML
virNetworkGetAutostart
@@ -187,10 +200,15 @@ virDomainSetMemory

Letter s:

same
virDomainGetMaxVcpus
virDomainGetName
+virDomainGetSchedulerParameters
+virDomainSetSchedulerParameters
virNetworkGetName
save
virDomainSave
saved
virDomainRestore
saving
virDomainSave
+
scheduler
virDomainGetSchedulerParameters
+virDomainGetSchedulerType
+virDomainSetSchedulerParameters
see
virDomainGetUUIDString
virNetworkGetUUIDString
set
VIR_USE_CPU
@@ -205,7 +223,9 @@ virConnectOpenReadOnly
virDomainDestroy
virDomainFree
+virDomainGetSchedulerParameters
virDomainSetAutostart
+virDomainSetSchedulerParameters
virDomainShutdown
virNetworkDestroy
virNetworkFree
@@ -267,6 +287,7 @@ virConnectGetType
virDomainGetName
virDomainGetOSType
+virDomainGetSchedulerType
virDomainGetUUIDString
virDomainLookupByUUIDString
virNetworkGetName
diff --git a/docs/APIfiles.html b/docs/APIfiles.html index cd09dda774..d8c6cf3256 100644 --- a/docs/APIfiles.html +++ b/docs/APIfiles.html @@ -18,6 +18,13 @@ VIR_DOMAIN_RENAME_RESTART
VIR_DOMAIN_RESTART
VIR_DOMAIN_RUNNING
+VIR_DOMAIN_SCHED_FIELD_BOOLEAN
+VIR_DOMAIN_SCHED_FIELD_DOUBLE
+VIR_DOMAIN_SCHED_FIELD_INT
+VIR_DOMAIN_SCHED_FIELD_LENGTH
+VIR_DOMAIN_SCHED_FIELD_LLONG
+VIR_DOMAIN_SCHED_FIELD_UINT
+VIR_DOMAIN_SCHED_FIELD_ULLONG
VIR_DOMAIN_SHUTDOWN
VIR_DOMAIN_SHUTOFF
VIR_GET_CPUMAP
@@ -32,6 +39,7 @@ _virDomainInfo
_virDomainKernel
_virNodeInfo
+_virSchedParameter
_virVcpuInfo
virConnect
virConnectClose
@@ -68,6 +76,8 @@ virDomainGetMaxVcpus
virDomainGetName
virDomainGetOSType
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virDomainGetUUID
virDomainGetUUIDString
virDomainGetVcpus
@@ -90,6 +100,7 @@ virDomainSetAutostart
virDomainSetMaxMemory
virDomainSetMemory
+virDomainSetSchedulerParameters
virDomainSetVcpus
virDomainShutdown
virDomainState
@@ -118,6 +129,9 @@ virNodeGetInfo
virNodeInfo
virNodeInfoPtr
+virSchedParameter
+virSchedParameterPtr
+virSchedParameterType
virVcpuInfo
virVcpuInfoPtr
virVcpuState
@@ -127,6 +141,7 @@ VIR_ERR_DRIVER_FULL
VIR_ERR_ERROR
VIR_ERR_GET_FAILED
+VIR_ERR_GNUTLS_ERROR
VIR_ERR_HTTP_ERROR
VIR_ERR_INTERNAL_ERROR
VIR_ERR_INVALID_ARG
@@ -155,6 +170,7 @@ VIR_ERR_PARSE_FAILED
VIR_ERR_POST_FAILED
VIR_ERR_READ_FAILED
+VIR_ERR_RPC
VIR_ERR_SEXPR_SERIAL
VIR_ERR_SYSTEM_ERROR
VIR_ERR_UNKNOWN_HOST
@@ -169,12 +185,15 @@ VIR_FROM_NONE
VIR_FROM_PROXY
VIR_FROM_QEMU
+VIR_FROM_REMOTE
VIR_FROM_RPC
VIR_FROM_SEXPR
+VIR_FROM_TEST
VIR_FROM_XEN
VIR_FROM_XEND
VIR_FROM_XENSTORE
VIR_FROM_XML
+VIR_WAR_NO_NETWORK
_virError
virConnCopyLastError
virConnGetLastError
diff --git a/docs/APIfunctions.html b/docs/APIfunctions.html index e676b5fcde..df939ee74d 100644 --- a/docs/APIfunctions.html +++ b/docs/APIfunctions.html @@ -7,6 +7,8 @@ virNetworkLookupByUUID

Type int *:

virConnectListDomains
virDomainGetAutostart
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virNetworkGetAutostart

Type unsigned char *:

virDomainGetUUID
virDomainGetVcpus
@@ -64,6 +66,8 @@ virDomainGetMaxVcpus
virDomainGetName
virDomainGetOSType
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virDomainGetUUID
virDomainGetUUIDString
virDomainGetVcpus
@@ -75,6 +79,7 @@ virDomainSetAutostart
virDomainSetMaxMemory
virDomainSetMemory
+virDomainSetSchedulerParameters
virDomainSetVcpus
virDomainShutdown
virDomainSuspend
@@ -98,6 +103,8 @@ virNetworkSetAutostart
virNetworkUndefine

Type virNodeInfoPtr:

virNodeGetInfo
+

Type virSchedParameterPtr:

virDomainGetSchedulerParameters
+virDomainSetSchedulerParameters

Type virVcpuInfoPtr:

virDomainGetVcpus

Type void *:

virConnSetErrorFunc
virErrorFunc
diff --git a/docs/APIsymbols.html b/docs/APIsymbols.html index 2566ff065f..c423cd7b76 100644 --- a/docs/APIsymbols.html +++ b/docs/APIsymbols.html @@ -18,6 +18,13 @@ VIR_DOMAIN_RENAME_RESTART
VIR_DOMAIN_RESTART
VIR_DOMAIN_RUNNING
+VIR_DOMAIN_SCHED_FIELD_BOOLEAN
+VIR_DOMAIN_SCHED_FIELD_DOUBLE
+VIR_DOMAIN_SCHED_FIELD_INT
+VIR_DOMAIN_SCHED_FIELD_LENGTH
+VIR_DOMAIN_SCHED_FIELD_LLONG
+VIR_DOMAIN_SCHED_FIELD_UINT
+VIR_DOMAIN_SCHED_FIELD_ULLONG
VIR_DOMAIN_SHUTDOWN
VIR_DOMAIN_SHUTOFF
VIR_ERR_CALL_FAILED
@@ -26,6 +33,7 @@ VIR_ERR_DRIVER_FULL
VIR_ERR_ERROR
VIR_ERR_GET_FAILED
+VIR_ERR_GNUTLS_ERROR
VIR_ERR_HTTP_ERROR
VIR_ERR_INTERNAL_ERROR
VIR_ERR_INVALID_ARG
@@ -54,6 +62,7 @@ VIR_ERR_PARSE_FAILED
VIR_ERR_POST_FAILED
VIR_ERR_READ_FAILED
+VIR_ERR_RPC
VIR_ERR_SEXPR_SERIAL
VIR_ERR_SYSTEM_ERROR
VIR_ERR_UNKNOWN_HOST
@@ -68,8 +77,10 @@ VIR_FROM_NONE
VIR_FROM_PROXY
VIR_FROM_QEMU
+VIR_FROM_REMOTE
VIR_FROM_RPC
VIR_FROM_SEXPR
+VIR_FROM_TEST
VIR_FROM_XEN
VIR_FROM_XEND
VIR_FROM_XENSTORE
@@ -83,10 +94,12 @@ VIR_VCPU_BLOCKED
VIR_VCPU_OFFLINE
VIR_VCPU_RUNNING
+VIR_WAR_NO_NETWORK

Letter _:

_virDomainInfo
_virDomainKernel
_virError
_virNodeInfo
+_virSchedParameter
_virVcpuInfo

Letter v:

virConnCopyLastError
virConnGetLastError
@@ -129,6 +142,8 @@ virDomainGetMaxVcpus
virDomainGetName
virDomainGetOSType
+virDomainGetSchedulerParameters
+virDomainGetSchedulerType
virDomainGetUUID
virDomainGetUUIDString
virDomainGetVcpus
@@ -151,6 +166,7 @@ virDomainSetAutostart
virDomainSetMaxMemory
virDomainSetMemory
+virDomainSetSchedulerParameters
virDomainSetVcpus
virDomainShutdown
virDomainState
@@ -188,6 +204,9 @@ virNodeInfoPtr
virResetError
virResetLastError
+virSchedParameter
+virSchedParameterPtr
+virSchedParameterType
virSetErrorFunc
virVcpuInfo
virVcpuInfoPtr
diff --git a/docs/devhelp/libvirt-libvirt.html b/docs/devhelp/libvirt-libvirt.html index 828b182079..4f1bb4e0cc 100644 --- a/docs/devhelp/libvirt-libvirt.html +++ b/docs/devhelp/libvirt-libvirt.html @@ -45,28 +45,32 @@ #define VIR_UUID_BUFLEN; #define VIR_CPU_USABLE(cpumaps, maplen, vcpu, cpu); #define VIR_COPY_CPUMAP(cpumaps, maplen, vcpu, cpumap); +#define VIR_DOMAIN_SCHED_FIELD_LENGTH; #define VIR_UUID_STRING_BUFLEN; #define VIR_GET_CPUMAP(cpumaps, maplen, vcpu); #define VIR_UNUSE_CPU(cpumap, cpu); +typedef struct _virNodeInfo virNodeInfo; +typedef struct _virNetwork virNetwork; +typedef enum virDeviceMode; +typedef struct _virConnect virConnect; +typedef struct _virVcpuInfo virVcpuInfo; +typedef struct _virDomainInfo virDomainInfo; +typedef enum virDomainCreateFlags; +typedef virDomainKernel * virDomainKernelPtr; +typedef enum virDomainState; +typedef struct _virDomain virDomain; +typedef enum virSchedParameterType; +typedef enum virDomainRestart; typedef virNodeInfo * virNodeInfoPtr; typedef virNetwork * virNetworkPtr; typedef virDomainInfo * virDomainInfoPtr; -typedef virDomainKernel * virDomainKernelPtr; typedef virConnect * virConnectPtr; typedef struct _virDomainKernel virDomainKernel; -typedef struct _virNodeInfo virNodeInfo; -typedef struct _virNetwork virNetwork; -typedef enum virDomainState; -typedef enum virDeviceMode; -typedef struct _virDomain virDomain; -typedef virDomain * virDomainPtr; -typedef struct _virVcpuInfo virVcpuInfo; typedef virVcpuInfo * virVcpuInfoPtr; -typedef enum virDomainRestart; -typedef struct _virConnect virConnect; -typedef enum virDomainCreateFlags; -typedef struct _virDomainInfo virDomainInfo; +typedef virSchedParameter * virSchedParameterPtr; typedef enum virVcpuState; +typedef virDomain * virDomainPtr; +typedef struct _virSchedParameter virSchedParameter; int virDomainGetInfo (virDomainPtr domain,
virDomainInfoPtr info); int virNetworkFree (virNetworkPtr network); const char * virNetworkGetName (virNetworkPtr network); @@ -82,10 +86,11 @@ int virNetworkGetUUID (virDomainPtr virDomainLookupByName (virConnectPtr conn,
const char * name); virNetworkPtr virNetworkLookupByUUID (virConnectPtr conn,
const unsigned char * uuid); char * virNetworkGetBridgeName (virNetworkPtr network); +char * virNetworkGetXMLDesc (virNetworkPtr network,
int flags); int virDomainPinVcpu (virDomainPtr domain,
unsigned int vcpu,
unsigned char * cpumap,
int maplen); int virDomainRestore (virConnectPtr conn,
const char * from); const char * virConnectGetType (virConnectPtr conn); -int virDomainSave (virDomainPtr domain,
const char * to); +int virDomainGetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
int * nparams); int virDomainCreate (virDomainPtr domain); int virConnectListDomains (virConnectPtr conn,
int * ids,
int maxids); virNetworkPtr virNetworkLookupByUUIDString (virConnectPtr conn,
const char * uuidstr); @@ -98,7 +103,7 @@ char * virDomainGetOSType (virConnectListDefinedNetworks (virConnectPtr conn,
char ** const names,
int maxnames); int virNodeGetInfo (virConnectPtr conn,
virNodeInfoPtr info); int virDomainGetUUID (virDomainPtr domain,
unsigned char * uuid); -virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
const char * xmlDesc); +int virDomainSetMemory (virDomainPtr domain,
unsigned long memory); int virNetworkSetAutostart (virNetworkPtr network,
int autostart); int virConnectNumOfDomains (virConnectPtr conn); int virDomainGetUUIDString (virDomainPtr domain,
char * buf); @@ -113,17 +118,18 @@ int virConnectGetMaxVcpus (virConnectNumOfDefinedDomains (virConnectPtr conn); virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
const char * xml); int virNetworkCreate (virNetworkPtr network); +int virDomainSetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
int nparams); int virConnectClose (virConnectPtr conn); int virDomainReboot (virDomainPtr domain,
unsigned int flags); int virInitialize (void); int virDomainSetVcpus (virDomainPtr domain,
unsigned int nvcpus); int virNetworkGetUUIDString (virNetworkPtr network,
char * buf); virNetworkPtr virNetworkLookupByName (virConnectPtr conn,
const char * name); -char * virNetworkGetXMLDesc (virNetworkPtr network,
int flags); +virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
const char * xmlDesc); unsigned int virDomainGetID (virDomainPtr domain); int virDomainResume (virDomainPtr domain); virDomainPtr virDomainCreateLinux (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags); -int virDomainSetMemory (virDomainPtr domain,
unsigned long memory); +char * virDomainGetSchedulerType (virDomainPtr domain,
int * nparams); int virNetworkDestroy (virNetworkPtr network); int virDomainDestroy (virDomainPtr domain); int virConnectNumOfNetworks (virConnectPtr conn); @@ -135,6 +141,7 @@ int virDomainSetMaxMemory (virConnectGetVersion (virConnectPtr conn,
unsigned long * hvVer); int virConnectListNetworks (virConnectPtr conn,
char ** const names,
int maxnames); virDomainPtr virDomainLookupByID (virConnectPtr conn,
int id); +int virDomainSave (virDomainPtr domain,
const char * to); virConnectPtr virConnectOpenReadOnly (const char * name); @@ -158,6 +165,10 @@ int virConnectListNetworks (

Macro VIR_CPU_USABLE

#define VIR_CPU_USABLE(cpumaps, maplen, vcpu, cpu);
 

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.

cpumaps:pointer to an array of cpumap (in 8-bit bytes) (IN)
maplen:the length (in bytes) of one cpumap
vcpu:the virtual CPU number
cpu:the physical CPU number
+ +
+

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(cpumaps, maplen, vcpu);
@@ -292,6 +303,28 @@ The content of this structure is not made public by the API.
         

Typedef virNodeInfoPtr

virNodeInfo * virNodeInfoPtr;
 

a virNodeInfoPtr is a pointer to a virNodeInfo structure.

+
+
+

Structure virSchedParameter

struct _virSchedParameter {
+    charfield[VIR_DOMAIN_SCHED_FIELD_LENGTH]	field	: parameter name
+    int	type	: parameter type
+} virSchedParameter;
+

+

+
+

Typedef virSchedParameterPtr

virSchedParameter * virSchedParameterPtr;
+

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

struct _virVcpuInfo {
@@ -352,7 +385,7 @@ The content of this structure is not made public by the API.
 
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

Provides the number of inactive domains.

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

virConnectNumOfDefinedNetworks ()

int	virConnectNumOfDefinedNetworks	(virConnectPtr conn)
@@ -434,6 +467,14 @@ The content of this structure is not made public by the API.

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.

virDomainGetUUID ()

int	virDomainGetUUID		(virDomainPtr domain, 
unsigned char * uuid)

Get the UUID for a domain

@@ -498,6 +539,10 @@ The content of this structure is not made public by the API.

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.
+
+

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

diff --git a/docs/devhelp/libvirt-virterror.html b/docs/devhelp/libvirt-virterror.html index 10806fa373..fab930a268 100644 --- a/docs/devhelp/libvirt-virterror.html +++ b/docs/devhelp/libvirt-virterror.html @@ -91,7 +91,9 @@ void virConnResetLastError (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 */ + 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 */ };

@@ -143,7 +145,10 @@ void virConnResetLastError (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_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 */ };

diff --git a/docs/html/libvirt-libvirt.html b/docs/html/libvirt-libvirt.html index c6b2f651eb..99038eaddc 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
#define VIR_UUID_BUFLEN
#define VIR_UUID_STRING_BUFLEN
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_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
@@ -19,6 +19,9 @@ 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
@@ -52,6 +55,8 @@ The content of this structure is not made public by the API.
 
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)
@@ -68,6 +73,7 @@ The content of this structure is not made public by the API.
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)
@@ -96,6 +102,7 @@ The content of this structure is not made public by the API.

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.

@@ -164,7 +171,20 @@ The content of this structure is not made public by the API. unsigned int threads : number of threads per core }
a virNodeInfoPtr is a pointer to a virNodeInfo structure. -

Structure virVcpuInfo

Structure virVcpuInfo
struct _virVcpuInfo { +

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 @@ -193,7 +213,7 @@ The content of this structure is not made public by the API.
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.

+

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)
@@ -234,7 +254,11 @@ The content of this structure is not made public by the API.

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)
+
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.

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

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

int	virDomainSetVcpus		(virDomainPtr domain, 
unsigned int nvcpus)
+
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 ?

diff --git a/docs/html/libvirt-virterror.html b/docs/html/libvirt-virterror.html index aaa71655d0..b96441c0f3 100644 --- a/docs/html/libvirt-virterror.html +++ b/docs/html/libvirt-virterror.html @@ -45,6 +45,8 @@ void virErrorFunc (void * userData,
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 }

Enum virErrorLevel

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

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/docs/libvirt-api.xml b/docs/libvirt-api.xml index d301f08893..2f16acfe3f 100644 --- a/docs/libvirt-api.xml +++ b/docs/libvirt-api.xml @@ -12,51 +12,62 @@ + - - - - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + @@ -72,10 +83,11 @@ + - + @@ -88,7 +100,7 @@ - + @@ -103,17 +115,18 @@ + - + - + @@ -125,6 +138,7 @@ + @@ -134,6 +148,7 @@ + @@ -153,8 +168,10 @@ + + @@ -162,6 +179,7 @@ + @@ -173,6 +191,7 @@ + @@ -226,6 +245,9 @@ + + Macro providing the field length of virSchedParameter + 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. @@ -266,6 +288,12 @@ + + + + + + @@ -274,6 +302,7 @@ + @@ -302,8 +331,9 @@ + - + @@ -312,12 +342,14 @@ - + + + @@ -325,6 +357,7 @@ + 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. @@ -391,6 +424,14 @@ a virNodeInfoPtr is a pointer to a virNodeInfo structure. + + + + + + a virSchedParameterPtr is a pointer to a virSchedParameter structure. + + @@ -478,7 +519,7 @@ - Provides the number of active domains. + Provides the number of inactive domains. @@ -601,6 +642,19 @@ + + Get the scheduler parameters, the @params array will be filled with the values. + + + + + + + Get the scheduler type. + + + + Get the UUID for a domain @@ -701,6 +755,13 @@ + + Change the scheduler parameters + + + + + 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. diff --git a/docs/libvirt-refs.xml b/docs/libvirt-refs.xml index f42c5465df..f8ce1c600a 100644 --- a/docs/libvirt-refs.xml +++ b/docs/libvirt-refs.xml @@ -19,6 +19,13 @@ + + + + + + + @@ -27,6 +34,7 @@ + @@ -55,6 +63,7 @@ + @@ -69,8 +78,10 @@ + + @@ -84,10 +95,12 @@ + + @@ -130,6 +143,8 @@ + + @@ -152,6 +167,7 @@ + @@ -189,6 +205,9 @@ + + + @@ -216,6 +235,13 @@ + + + + + + + @@ -224,6 +250,7 @@ + @@ -252,6 +279,7 @@ + @@ -266,8 +294,10 @@ + + @@ -281,12 +311,14 @@ + + @@ -331,6 +363,8 @@ + + @@ -353,6 +387,7 @@ + @@ -390,6 +425,9 @@ + + + @@ -440,6 +478,8 @@ + + @@ -511,6 +551,8 @@ + + @@ -522,6 +564,7 @@ + @@ -554,6 +597,10 @@ + + + + @@ -583,6 +630,13 @@ + + + + + + + @@ -597,6 +651,7 @@ + @@ -633,6 +688,8 @@ + + @@ -655,6 +712,7 @@ + @@ -683,6 +741,9 @@ + + + @@ -694,6 +755,7 @@ + @@ -722,6 +784,7 @@ + @@ -736,12 +799,15 @@ + + + @@ -818,6 +884,9 @@ + + + @@ -893,6 +962,8 @@ + + @@ -932,6 +1003,7 @@ + @@ -1168,7 +1240,6 @@ - @@ -1259,6 +1330,7 @@ + @@ -1417,6 +1489,7 @@ + @@ -1686,6 +1759,9 @@ + + + @@ -1694,6 +1770,7 @@ + @@ -1727,6 +1804,7 @@ + @@ -1868,6 +1946,7 @@ + @@ -1986,10 +2065,14 @@ + + + + @@ -2176,6 +2259,7 @@ + @@ -2184,6 +2268,7 @@ + @@ -2269,10 +2354,17 @@ + + + + + + + @@ -2331,12 +2423,18 @@ + + + + + + @@ -2423,6 +2521,7 @@ + @@ -2538,6 +2637,8 @@ + + @@ -2545,9 +2646,12 @@ + + + @@ -2596,6 +2700,8 @@ + + @@ -2607,6 +2713,11 @@ + + + + + @@ -2626,7 +2737,9 @@ + + @@ -2734,6 +2847,7 @@ + @@ -2797,6 +2911,10 @@ + + + + @@ -2839,10 +2957,12 @@ + + @@ -2866,8 +2986,10 @@ + + @@ -2945,13 +3067,17 @@ + + + + @@ -2989,6 +3115,10 @@ + + + + @@ -3043,6 +3173,9 @@ + + + @@ -3120,6 +3253,7 @@ + @@ -3139,6 +3273,7 @@ + diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 79c6e29406..1ea4fe1192 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -124,6 +124,7 @@ typedef enum { VIR_ERR_SYSTEM_ERROR, /* general system call failure */ VIR_ERR_RPC, /* some sort of RPC error */ VIR_ERR_GNUTLS_ERROR, /* error from a GNUTLS call */ + VIR_WAR_NO_NETWORK, /* failed to start network */ } virErrorNumber; /** diff --git a/src/libvirt.c b/src/libvirt.c index f7a9968ac1..5a79bc1f7c 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -82,7 +82,7 @@ virInitialize(void) /** * virLibConnError: * @conn: the connection if available - * @error: the error noumber + * @error: the error number * @info: extra information string * * Handle an error at the connection level @@ -101,9 +101,30 @@ virLibConnError(virConnectPtr conn, virErrorNumber error, const char *info) } /** - * virLibConnError: + * virLibConnWarning: * @conn: the connection if available - * @error: the error noumber + * @error: the error number + * @info: extra information string + * + * Handle an error at the connection level + */ +static void +virLibConnWarning(virConnectPtr conn, virErrorNumber error, const char *info) +{ + const char *errmsg; + + if (error == VIR_ERR_OK) + return; + + errmsg = __virErrorMsg(error, info); + __virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_WARNING, + errmsg, info, NULL, 0, 0, errmsg, info); +} + +/** + * virLibDomainError: + * @domain: the domain if available + * @error: the error number * @info: extra information string * * Handle an error at the connection level @@ -295,8 +316,11 @@ do_open (const char *name, int flags) for (i = 0; i < virNetworkDriverTabCount; i++) { res = virNetworkDriverTab[i]->open (ret, name, flags); - if (res == VIR_DRV_OPEN_ERROR) goto failed; - else if (res == VIR_DRV_OPEN_SUCCESS) { + if (res == VIR_DRV_OPEN_ERROR) { + virLibConnWarning (NULL, VIR_WAR_NO_NETWORK, + "Is the daemon running ?"); + break; + } else if (res == VIR_DRV_OPEN_SUCCESS) { ret->networkDriver = virNetworkDriverTab[i]; break; } diff --git a/src/virterror.c b/src/virterror.c index 5fce348f22..7ca585fa3b 100644 --- a/src/virterror.c +++ b/src/virterror.c @@ -610,24 +610,30 @@ __virErrorMsg(virErrorNumber error, const char *info) else errmsg = _("network %s exists already"); break; - case VIR_ERR_SYSTEM_ERROR: - if (info == NULL) - errmsg = _("system call error"); - else - errmsg = "%s"; - break; - case VIR_ERR_RPC: - if (info == NULL) - errmsg = _("RPC error"); - else - errmsg = "%s"; - break; - case VIR_ERR_GNUTLS_ERROR: - if (info == NULL) - errmsg = _("GNUTLS call error"); - else - errmsg = "%s"; - break; + case VIR_ERR_SYSTEM_ERROR: + if (info == NULL) + errmsg = _("system call error"); + else + errmsg = "%s"; + break; + case VIR_ERR_RPC: + if (info == NULL) + errmsg = _("RPC error"); + else + errmsg = "%s"; + break; + case VIR_ERR_GNUTLS_ERROR: + if (info == NULL) + errmsg = _("GNUTLS call error"); + else + errmsg = "%s"; + break; + case VIR_WAR_NO_NETWORK: + if (info == NULL) + errmsg = _("Failed to find the network"); + else + errmsg = _("Failed to find the network: %s"); + break; } return (errmsg); }