From 66ab526b3fabc10f48b792b97098ca721fc84819 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 22 Nov 2006 17:48:29 +0000 Subject: [PATCH] * docs//*: regenerated * include/libvirt/libvirt.h include/libvirt/libvirt.h.in src/driver.h src/libvirt.c src/proxy_internal.c src/test.c src/virsh.c src/xen_internal.c src/xend_internal.c src/xm_internal.c src/xs_internal.c: added support for dumping core of domains assuming a xend with the latest patch to do so. Daniel --- ChangeLog | 9 +++ docs/APIchunk0.html | 19 ++++-- docs/APIchunk1.html | 24 ++++++-- docs/APIchunk2.html | 8 ++- docs/APIchunk3.html | 36 +++--------- docs/APIchunk4.html | 5 ++ docs/APIfiles.html | 3 + docs/APIfunctions.html | 5 +- docs/APIsymbols.html | 3 + docs/apibuild.py | 2 + docs/devhelp/libvirt-libvirt.html | 21 ++++++- docs/html/libvirt-libvirt.html | 13 +++- docs/html/libvirt-virterror.html | 1 + docs/libvirt-api.xml | 28 ++++++++- docs/libvirt-refs.xml | 98 ++++++++++++++++++++++--------- include/libvirt/libvirt.h | 7 +++ include/libvirt/libvirt.h.in | 7 +++ src/driver.h | 5 ++ src/libvirt.c | 66 +++++++++++++++++++++ src/proxy_internal.c | 1 + src/test.c | 1 + src/virsh.c | 46 +++++++++++++++ src/xen_internal.c | 1 + src/xend_internal.c | 31 ++++++++++ src/xm_internal.c | 1 + src/xs_internal.c | 1 + 26 files changed, 369 insertions(+), 73 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a6e1ae3d6..fab011d718 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Nov 22 17:57:58 CET 2006 Daniel Veillard + + * docs//*: regenerated + * include/libvirt/libvirt.h include/libvirt/libvirt.h.in src/driver.h + src/libvirt.c src/proxy_internal.c src/test.c src/virsh.c + src/xen_internal.c src/xend_internal.c src/xm_internal.c + src/xs_internal.c: added support for dumping core of domains + assuming a xend with the latest patch to do so. + Tue Nov 21 18:05:33 CET 2006 Daniel Veillard * src/xs_internal.c: Michel Ponceau pointed out a bug in diff --git a/docs/APIchunk0.html b/docs/APIchunk0.html index cc81e4240d..18976e9ee5 100644 --- a/docs/APIchunk0.html +++ b/docs/APIchunk0.html @@ -40,8 +40,11 @@
Collect
virConnectListDomains
Copy
virConnCopyLastError
virCopyLastError
-

Letter D:

Default
virDefaultErrorFunc
+
Create
virDomainAttachDevice
+

Letter D:

Daemon
virDomainCoreDump
+
Default
virDefaultErrorFunc
Destroy
virDomainDestroy
+virDomainDetachDevice
Domain0
virDomainGetMaxMemory
virDomainGetVcpus
virDomainPinVcpu
@@ -76,7 +79,8 @@
Linux
virDomainCreateLinux

Letter M:

Macro
LIBVIR_VERSION_NUMBER

Letter N:

NUMA
_virNodeInfo
-
Note
virDomainGetInfo
+
Note
virDomainCoreDump
+virDomainGetInfo
virDomainReboot
virDomainSetVcpus
virDomainShutdown
@@ -121,6 +125,7 @@ virConnectGetVersion
virConnectOpen
virConnectOpenReadOnly
+virDomainCoreDump
virDomainCreateLinux
virDomainDestroy
virDomainPinVcpu
@@ -149,10 +154,13 @@
VIR_CPU_USABLE
VIR_CPU_USABLE
VIR_GET_CPUMAP
VIR_GET_CPUMAP

Letter W:

What
_virError
-

Letter X:

XML
virDomainCreateLinux
+

Letter X:

XML
virDomainAttachDevice
+virDomainCreateLinux
virDomainDefineXML
+virDomainDetachDevice
virDomainGetXMLDesc
-
Xen
virDomainGetVcpus
+
Xen
virDomainCoreDump
+virDomainGetVcpus
virDomainPinVcpu
virGetVersion

Letter a:

about
virDomainGetInfo
@@ -201,6 +209,7 @@
amount
virDomainGetMaxMemory
virDomainSetMaxMemory
virDomainSetMemory
+
analysis
virDomainCoreDump
anymore
virDomainSave
application
virConnectClose
virDomainGetMaxMemory
@@ -225,6 +234,8 @@ virDomainGetVcpus
assumed
virDomainGetVcpus
virGetVersion
+
attachment
virDomainAttachDevice
+virDomainDetachDevice
available
_virError
virConnectOpenReadOnly
availble
virGetVersion
diff --git a/docs/APIchunk1.html b/docs/APIchunk1.html index 9b168150fb..0aafab8013 100644 --- a/docs/APIchunk1.html +++ b/docs/APIchunk1.html @@ -8,6 +8,8 @@

Letter b:

back
virConnSetErrorFunc
virDomainDestroy
virGetVersion
+
backend
virDomainAttachDevice
+virDomainDetachDevice
based
virDomainCreateLinux
virDomainLookupByID
virDomainLookupByName
@@ -104,6 +106,7 @@ virConnCopyLastError
virCopyLastError
core
_virNodeInfo
+virDomainCoreDump
corresponding
virDomainPinVcpu
could
virSetErrorFunc
cpu
VIR_CPU_USABLE
@@ -124,6 +127,7 @@
cupmap
virDomainGetVcpus
currently
virConnectOpen
virConnectOpenReadOnly
+virDomainCoreDump

Letter d:

data
virConnSetErrorFunc
virDomainDestroy
virDomainFree
@@ -137,10 +141,14 @@ virDomainCreate
virDomainUndefine
described
virDomainGetVcpus
-
description
virDomainCreateLinux
+
description
virDomainAttachDevice
+virDomainCreateLinux
virDomainDefineXML
+virDomainDetachDevice
virDomainGetXMLDesc
device
_virDomainKernel
+virDomainAttachDevice
+virDomainDetachDevice
disk
virDomainRestore
virDomainSave
doable
virDomainShutdown
@@ -156,19 +164,24 @@ virDomainCreate
down
virDomainDestroy
driver
virGetVersion
+
dump
virDomainCoreDump

Letter e:

each
virDomainPinVcpu
encoded
virDomainGetXMLDesc
especially
virConnectClose
expected
_virNodeInfo
extra
_virError
+virDomainCoreDump
virDomainReboot
extract
VIR_COPY_CPUMAP
extracted
virConnectGetVersion
virDomainGetInfo
extraction
virDomainGetXMLDesc

Letter f:

fail
virDomainSetVcpus
-
failure
virDomainCreateLinux
+
failure
virDomainAttachDevice
+virDomainCoreDump
+virDomainCreateLinux
virDomainDestroy
+virDomainDetachDevice
virDomainFree
virDomainGetInfo
virDomainGetVcpus
@@ -188,18 +201,21 @@ virDomainSuspend
virGetVersion
virNodeGetInfo
-
file
virDomainSave
+
file
virDomainCoreDump
+virDomainSave
filename
_virDomainKernel
filled
virDomainGetVcpus
find
virDomainLookupByID
first
virConnectOpen
virConnectOpenReadOnly
-
flags
virDomainGetXMLDesc
+
flags
virDomainCoreDump
+virDomainGetXMLDesc
virDomainReboot
for
_virDomainInfo
_virNodeInfo
virConnGetLastError
virConnectGetVersion
+virDomainCoreDump
virDomainDefineXML
virDomainGetID
virDomainGetName
diff --git a/docs/APIchunk2.html b/docs/APIchunk2.html index 04c66cde17..0a1a8b7550 100644 --- a/docs/APIchunk2.html +++ b/docs/APIchunk2.html @@ -12,7 +12,8 @@ virDomainGetInfo
virDomainGetMaxMemory
virSetErrorFunc
-
given
virDomainDestroy
+
given
virDomainCoreDump
+virDomainDestroy
virDomainLookupByName
virDomainLookupByUUID
virDomainLookupByUUIDString
@@ -30,6 +31,7 @@
has
virDomainGetVcpus
have
virGetVersion
host
VIR_NODEINFO_MAXCPUS
+virDomainCoreDump
how
_virError
human-readable
_virError

Letter i:

ie:
cpumap
@@ -55,6 +57,7 @@ virDomainGetXMLDesc
int
virDomainGetID
interaction
virConnectClose
+
interpreted
virDomainCoreDump
into
VIR_COPY_CPUMAP
its
virDomainGetName
virDomainLookupByName
@@ -156,7 +159,8 @@ virDomainSetMemory
virDomainSuspend
message
_virError
-
method
virDomainRestore
+
method
virDomainCoreDump
+virDomainRestore
virDomainSave
methods
virConnectOpenReadOnly
micro
LIBVIR_VERSION_NUMBER
diff --git a/docs/APIchunk3.html b/docs/APIchunk3.html index f1b99fbcc4..5e4cff27f8 100644 --- a/docs/APIchunk3.html +++ b/docs/APIchunk3.html @@ -5,37 +5,14 @@ g-n o-s t-z -

Letter o:

object
virDomainCreateLinux
-virDomainDestroy
-virDomainFree
-virDomainGetID
-virDomainGetInfo
-virDomainGetMaxMemory
-virDomainGetName
-virDomainGetOSType
-virDomainGetUUID
-virDomainGetUUIDString
-virDomainGetVcpus
-virDomainGetXMLDesc
-virDomainLookupByID
-virDomainLookupByName
-virDomainLookupByUUID
-virDomainLookupByUUIDString
-virDomainPinVcpu
-virDomainReboot
-virDomainResume
-virDomainSave
-virDomainSetMaxMemory
-virDomainSetMemory
-virDomainSetVcpus
-virDomainShutdown
-virDomainSuspend
-
occured
virConnGetLastError
+

Letter o:

occured
virConnGetLastError
virGetLastError
offline
_virVcpuInfo
one
_virDomainInfo
maplen
+virDomainAttachDevice
virDomainCreateLinux
+virDomainDetachDevice
virDomainGetVcpus
only
virConnectGetVersion
virDomainGetInfo
@@ -63,7 +40,8 @@
pass
virConnSetErrorFunc
virConnectOpen
virConnectOpenReadOnly
-
path
virDomainRestore
+
path
virDomainCoreDump
+virDomainRestore
virDomainSave
per
_virNodeInfo
physical
VIR_CPU_MAPLEN
@@ -117,6 +95,7 @@
relaunch
virDomainGetXMLDesc
release
virConnectGetVersion
virGetVersion
+
remote
virDomainCoreDump
reporting
virDefaultErrorFunc
request
virDomainReboot
virDomainShutdown
@@ -238,8 +217,11 @@
structures
virDomainGetVcpus
succeed
virDomainCreate
success
virConnectClose
+virDomainAttachDevice
+virDomainCoreDump
virDomainCreate
virDomainDestroy
+virDomainDetachDevice
virDomainFree
virDomainGetInfo
virDomainGetUUID
diff --git a/docs/APIchunk4.html b/docs/APIchunk4.html index 1aaa27d398..f233b4ade0 100644 --- a/docs/APIchunk4.html +++ b/docs/APIchunk4.html @@ -13,6 +13,7 @@
that
virConnCopyLastError
virConnGetLastError
virConnResetLastError
+virDomainCoreDump
virDomainGetInfo
virDomainGetName
virDomainPinVcpu
@@ -59,6 +60,7 @@
unsigned
virDomainGetID
unused
virConnectOpen
virConnectOpenReadOnly
+virDomainCoreDump
usable
VIR_CPU_USABLE
VIR_UNUSE_CPU
VIR_USE_CPU
@@ -135,6 +137,8 @@ _virDomainInfo
_virVcpuInfo
vcpu
+virDomainAttachDevice
+virDomainDetachDevice
virDomainGetVcpus
virDomainPinVcpu
virDomainSetVcpus
@@ -162,6 +166,7 @@
will
virConnCopyLastError
virConnSetErrorFunc
virCopyLastError
+virDomainCoreDump
virDomainGetName
virDomainRestore
virDomainSave
diff --git a/docs/APIfiles.html b/docs/APIfiles.html index 1eead3da94..d0cb108fba 100644 --- a/docs/APIfiles.html +++ b/docs/APIfiles.html @@ -44,11 +44,14 @@ virConnectPtr
virDeviceMode
virDomain
+virDomainAttachDevice
+virDomainCoreDump
virDomainCreate
virDomainCreateFlags
virDomainCreateLinux
virDomainDefineXML
virDomainDestroy
+virDomainDetachDevice
virDomainFree
virDomainGetID
virDomainGetInfo
diff --git a/docs/APIfunctions.html b/docs/APIfunctions.html index 31019e17d5..9db433eae6 100644 --- a/docs/APIfunctions.html +++ b/docs/APIfunctions.html @@ -34,8 +34,11 @@ virDomainRestore
virNodeGetInfo

Type virDomainInfoPtr:

virDomainGetInfo
-

Type virDomainPtr:

virDomainCreate
+

Type virDomainPtr:

virDomainAttachDevice
+virDomainCoreDump
+virDomainCreate
virDomainDestroy
+virDomainDetachDevice
virDomainFree
virDomainGetID
virDomainGetInfo
diff --git a/docs/APIsymbols.html b/docs/APIsymbols.html index ea9c241368..ff9a9ee7ff 100644 --- a/docs/APIsymbols.html +++ b/docs/APIsymbols.html @@ -100,11 +100,14 @@ virDefaultErrorFunc
virDeviceMode
virDomain
+virDomainAttachDevice
+virDomainCoreDump
virDomainCreate
virDomainCreateFlags
virDomainCreateLinux
virDomainDefineXML
virDomainDestroy
+virDomainDetachDevice
virDomainFree
virDomainGetID
virDomainGetInfo
diff --git a/docs/apibuild.py b/docs/apibuild.py index 4feb42e641..c7b18487ab 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -31,6 +31,8 @@ ignored_files = { "xen_internal.c": "internal code", "xs_internal.h": "internal includes and defines", "xs_internal.c": "internal code", + "xm_internal.h": "internal code", + "xm_internal.c": "internal code", "sexpr.h": "internal includes and defines", "sexpr.c": "internal code", "xml.h": "internal includes and defines", diff --git a/docs/devhelp/libvirt-libvirt.html b/docs/devhelp/libvirt-libvirt.html index 0aab728ca0..ff90a02815 100644 --- a/docs/devhelp/libvirt-libvirt.html +++ b/docs/devhelp/libvirt-libvirt.html @@ -76,6 +76,7 @@ const char * virConnectGetType (virDomainSave (virDomainPtr domain,
const char * to); int virDomainCreate (virDomainPtr domain); int virConnectListDomains (virConnectPtr conn,
int * ids,
int maxids); +int virDomainCoreDump (virDomainPtr domain,
const char * to,
int flags); virDomainPtr virDomainLookupByUUID (virConnectPtr conn,
const unsigned char * uuid); virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn,
const char * uuidstr); virDomainPtr virDomainLookupByID (virConnectPtr conn,
int id); @@ -84,8 +85,8 @@ int virNodeGetInfo (virDomainGetUUID (virDomainPtr domain,
unsigned char * uuid); int virConnectNumOfDomains (virConnectPtr conn); int virDomainGetUUIDString (virDomainPtr domain,
char * buf); -int virDomainGetVcpus (virDomainPtr domain,
virVcpuInfoPtr info,
int maxinfo,
unsigned char * cpumaps,
int maplen); -int virConnectGetVersion (virConnectPtr conn,
unsigned long * hvVer); +unsigned long virDomainGetMaxMemory (virDomainPtr domain); +int virDomainAttachDevice (virDomainPtr domain,
char * xml); int virDomainSetMaxMemory (virDomainPtr domain,
unsigned long memory); int virDomainFree (virDomainPtr domain); virConnectPtr virConnectOpen (const char * name); @@ -100,8 +101,10 @@ int virDomainResume (virDomainPtr virDomainCreateLinux (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags); int virDomainSetMemory (virDomainPtr domain,
unsigned long memory); int virDomainDestroy (virDomainPtr domain); -unsigned long virDomainGetMaxMemory (virDomainPtr domain); +int virDomainDetachDevice (virDomainPtr domain,
char * xml); +int virDomainGetVcpus (virDomainPtr domain,
virVcpuInfoPtr info,
int maxinfo,
unsigned char * cpumaps,
int maplen); char * virDomainGetXMLDesc (virDomainPtr domain,
int flags); +int virConnectGetVersion (virConnectPtr conn,
unsigned long * hvVer); const char * virDomainGetName (virDomainPtr domain); virConnectPtr virConnectOpenReadOnly (const char * name); @@ -300,6 +303,14 @@ The content of this structure is not made public by the API.

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

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

virDomainCoreDump ()

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

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

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

virDomainCreate ()

int	virDomainCreate			(virDomainPtr domain)

launch a defined domain. If the call succeed the domain moves from the defined to the running domains pools.

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

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

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.

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.

diff --git a/docs/html/libvirt-libvirt.html b/docs/html/libvirt-libvirt.html index 60c30eeb96..33525e611a 100644 --- a/docs/html/libvirt-libvirt.html +++ b/docs/html/libvirt-libvirt.html @@ -28,10 +28,13 @@ The content of this structure is not made public by the API.
int	virConnectNumOfDomains		(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)
unsigned int	virDomainGetID		(virDomainPtr domain)
int	virDomainGetInfo		(virDomainPtr domain, 
virDomainInfoPtr info)
@@ -155,7 +158,11 @@ The content of this structure is not made public by the API.

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

int	virDomainCreate			(virDomainPtr domain)
+
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.

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

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

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

unsigned int	virDomainGetID		(virDomainPtr domain)

Get the hypervisor ID number for the domain

diff --git a/docs/html/libvirt-virterror.html b/docs/html/libvirt-virterror.html index e813633d07..ca65bcf94e 100644 --- a/docs/html/libvirt-virterror.html +++ b/docs/html/libvirt-virterror.html @@ -84,6 +84,7 @@ void virErrorFunc (void * userData,
VIR_ERR_PARSE_FAILED = 32 : failed to parse a conf file VIR_ERR_CONF_SYNTAX = 33 : failed to parse the syntax of a conf file VIR_ERR_WRITE_FAILED = 34 : failed to write a conf file + VIR_ERR_XML_DETAIL = 35 : detail of an XML error }

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 f88b00658a..856b3725bb 100644 --- a/docs/libvirt-api.xml +++ b/docs/libvirt-api.xml @@ -66,6 +66,7 @@ + @@ -74,8 +75,8 @@ - - + + @@ -90,8 +91,10 @@ - + + + @@ -429,6 +432,19 @@ + + Create a virtual device attachment to backend. + + + + + + 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. + + + + + launch a defined domain. If the call succeed the domain moves from the defined to the running domains pools. @@ -452,6 +468,12 @@ + + Destroy a virtual device attachment to backend. + + + + Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter. diff --git a/docs/libvirt-refs.xml b/docs/libvirt-refs.xml index b46d24e91f..47aee2391f 100644 --- a/docs/libvirt-refs.xml +++ b/docs/libvirt-refs.xml @@ -101,11 +101,14 @@ + + + @@ -265,11 +268,14 @@ + + + @@ -400,8 +406,11 @@ + + + @@ -492,11 +501,14 @@ + + + @@ -667,13 +679,20 @@ + + + + + + + @@ -758,6 +777,7 @@ + @@ -847,6 +867,7 @@ + @@ -903,11 +924,14 @@ + + + @@ -988,6 +1012,9 @@ + + + @@ -1028,6 +1055,10 @@ + + + + @@ -1047,6 +1078,10 @@ + + + + @@ -1214,6 +1249,7 @@ + @@ -1248,6 +1284,7 @@ + @@ -1277,12 +1314,16 @@ + + + + @@ -1311,6 +1352,9 @@ + + + @@ -1327,6 +1371,7 @@ + @@ -1345,8 +1390,11 @@ + + + @@ -1368,6 +1416,7 @@ + @@ -1384,6 +1433,7 @@ + @@ -1392,6 +1442,7 @@ + @@ -1487,6 +1538,7 @@ + @@ -1525,6 +1577,7 @@ + @@ -1583,6 +1636,9 @@ + + + @@ -1763,6 +1819,7 @@ + @@ -1872,33 +1929,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1909,7 +1939,9 @@ + + @@ -1965,6 +1997,7 @@ + @@ -2076,6 +2109,9 @@ + + + @@ -2302,8 +2338,11 @@ + + + @@ -2364,6 +2403,7 @@ + @@ -2448,6 +2488,7 @@ + @@ -2582,6 +2623,8 @@ + + @@ -2625,6 +2668,7 @@ + diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h index dabe35ceb1..3d1e566b68 100644 --- a/include/libvirt/libvirt.h +++ b/include/libvirt/libvirt.h @@ -264,6 +264,13 @@ int virDomainSave (virDomainPtr domain, int virDomainRestore (virConnectPtr conn, const char *from); +/* + * Domain core dump + */ +int virDomainCoreDump (virDomainPtr domain, + const char *to, + int flags); + /* * Domain runtime informations */ diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 92f1feb906..aa0e93d315 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -264,6 +264,13 @@ int virDomainSave (virDomainPtr domain, int virDomainRestore (virConnectPtr conn, const char *from); +/* + * Domain core dump + */ +int virDomainCoreDump (virDomainPtr domain, + const char *to, + int flags); + /* * Domain runtime informations */ diff --git a/src/driver.h b/src/driver.h index 329240631a..9027ff985b 100644 --- a/src/driver.h +++ b/src/driver.h @@ -105,6 +105,10 @@ typedef int typedef int (*virDrvDomainRestore) (virConnectPtr conn, const char *from); +typedef int + (*virDrvDomainCoreDump) (virDomainPtr domain, + const char *to, + int flags); typedef char * (*virDrvDomainDumpXML) (virDomainPtr dom, int flags); @@ -182,6 +186,7 @@ struct _virDriver { virDrvDomainGetInfo domainGetInfo; virDrvDomainSave domainSave; virDrvDomainRestore domainRestore; + virDrvDomainCoreDump domainCoreDump; virDrvDomainSetVcpus domainSetVcpus; virDrvDomainPinVcpu domainPinVcpu; virDrvDomainGetVcpus domainGetVcpus; diff --git a/src/libvirt.c b/src/libvirt.c index 9b4cd86dc7..5f0489ad22 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -1025,6 +1025,72 @@ virDomainRestore(virConnectPtr conn, const char *from) return (-1); } +/** + * virDomainCoreDump: + * @domain: a domain object + * @to: path for the core file + * @flags: extra flags, currently unused + * + * 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. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +virDomainCoreDump(virDomainPtr domain, const char *to, int flags) +{ + int ret, i; + char filepath[4096]; + virConnectPtr conn; + + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { + virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); + return (-1); + } + if (domain->conn->flags & VIR_CONNECT_RO) { + virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__); + return (-1); + } + conn = domain->conn; + if (to == NULL) { + virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__); + return (-1); + } + + /* + * We must absolutize the file path as the save is done out of process + * TODO: check for URI when libxml2 is linked in. + */ + if (to[0] != '/') { + unsigned int len, t; + + t = strlen(to); + if (getcwd(filepath, sizeof(filepath) - (t + 3)) == NULL) + return (-1); + len = strlen(filepath); + /* that should be covered by getcwd() semantic, but be 100% sure */ + if (len > sizeof(filepath) - (t + 3)) + return (-1); + filepath[len] = '/'; + strcpy(&filepath[len + 1], to); + to = &filepath[0]; + + } + + /* Go though the driver registered entry points */ + for (i = 0;i < conn->nb_drivers;i++) { + if ((conn->drivers[i] != NULL) && + (conn->drivers[i]->domainCoreDump != NULL)) { + ret = conn->drivers[i]->domainCoreDump(domain, to, flags); + if (ret == 0) + return(0); + } + } + virLibConnError(conn, VIR_ERR_CALL_FAILED, __FUNCTION__); + return (-1); +} + /** * virDomainShutdown: * @domain: a domain object diff --git a/src/proxy_internal.c b/src/proxy_internal.c index ce8d96b604..aade2308c1 100644 --- a/src/proxy_internal.c +++ b/src/proxy_internal.c @@ -74,6 +74,7 @@ static virDriver xenProxyDriver = { xenProxyDomainGetInfo, /* domainGetInfo */ NULL, /* domainSave */ NULL, /* domainRestore */ + NULL, /* domainCoreDump */ NULL, /* domainSetVcpus */ NULL, /* domainPinVcpu */ NULL, /* domainGetVcpus */ diff --git a/src/test.c b/src/test.c index 51ba18a572..c69f1ce54a 100644 --- a/src/test.c +++ b/src/test.c @@ -54,6 +54,7 @@ static virDriver testDriver = { testGetDomainInfo, /* domainGetInfo */ NULL, /* domainSave */ NULL, /* domainRestore */ + NULL, /* domainCoreDump */ testSetVcpus, /* domainSetVcpus */ NULL, /* domainPinVcpu */ NULL, /* domainGetVcpus */ diff --git a/src/virsh.c b/src/virsh.c index 03ea811d33..30b5c6b1de 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -804,6 +804,51 @@ cmdRestore(vshControl * ctl, vshCmd * cmd) return ret; } +/* + * "dump" command + */ +static vshCmdInfo info_dump[] = { + {"syntax", "dump "}, + {"help", gettext_noop("dump the core of a domain to a file for analysis")}, + {"desc", gettext_noop("Core dump a domain.")}, + {NULL, NULL} +}; + +static vshCmdOptDef opts_dump[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, + {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("where to dump the core")}, + {NULL, 0, 0, NULL} +}; + +static int +cmdDump(vshControl * ctl, vshCmd * cmd) +{ + virDomainPtr dom; + char *name; + char *to; + int ret = TRUE; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + return FALSE; + + if (!(to = vshCommandOptString(cmd, "file", NULL))) + return FALSE; + + if (!(dom = vshCommandOptDomain(ctl, cmd, "domain", &name))) + return FALSE; + + if (virDomainCoreDump(dom, to, 0) == 0) { + vshPrint(ctl, _("Domain %s dumpd to %s\n"), name, to); + } else { + vshError(ctl, FALSE, _("Failed to core dump domain %s to %s"), + name, to); + ret = FALSE; + } + + virDomainFree(dom); + return ret; +} + /* * "resume" command */ @@ -1623,6 +1668,7 @@ static vshCmdDef commands[] = { {"restore", cmdRestore, opts_restore, info_restore}, {"resume", cmdResume, opts_resume, info_resume}, {"save", cmdSave, opts_save, info_save}, + {"dump", cmdDump, opts_dump, info_dump}, {"shutdown", cmdShutdown, opts_shutdown, info_shutdown}, {"setmem", cmdSetmem, opts_setmem, info_setmem}, {"setmaxmem", cmdSetmaxmem, opts_setmaxmem, info_setmaxmem}, diff --git a/src/xen_internal.c b/src/xen_internal.c index abbf75c314..f1b9b334e5 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -449,6 +449,7 @@ static virDriver xenHypervisorDriver = { xenHypervisorGetDomainInfo, /* domainGetInfo */ NULL, /* domainSave */ NULL, /* domainRestore */ + NULL, /* domainCoreDump */ xenHypervisorSetVcpus, /* domainSetVcpus */ xenHypervisorPinVcpu, /* domainPinVcpu */ xenHypervisorGetVcpus, /* domainGetVcpus */ diff --git a/src/xend_internal.c b/src/xend_internal.c index 9e73faaed6..2f1fb5bf49 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -49,6 +49,8 @@ static virDomainPtr xenDaemonCreateLinux(virConnectPtr conn, unsigned int flags); static int xenDaemonAttachDevice(virDomainPtr domain, char *xml); static int xenDaemonDetachDevice(virDomainPtr domain, char *xml); +static int xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename, + int flags); #endif /* PROXY */ #ifndef PROXY @@ -86,6 +88,7 @@ static virDriver xenDaemonDriver = { xenDaemonDomainGetInfo, /* domainGetInfo */ xenDaemonDomainSave, /* domainSave */ xenDaemonDomainRestore, /* domainRestore */ + xenDaemonDomainCoreDump, /* domainCoreDump */ xenDaemonDomainSetVcpus, /* domainSetVcpus */ xenDaemonDomainPinVcpu, /* domainPinVcpu */ xenDaemonDomainGetVcpus, /* domainGetVcpus */ @@ -2206,6 +2209,34 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename) return xend_op(domain->conn, domain->name, "op", "save", "file", filename, NULL); } +/** + * xenDaemonDomainCoreDump: + * @domain: pointer to the Domain block + * @filename: path for the output file + * @flags: extra flags, currently unused + * + * 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. + * + * Returns 0 in case of success, -1 in case of error. + */ +static int +xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename, + int flags ATTRIBUTE_UNUSED) +{ + if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || + (filename == NULL)) { + virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG, + __FUNCTION__); + return(-1); + } + if (domain->handle < 0) + return(-1); + return xend_op(domain->conn, domain->name, "op", "dump", "file", filename, + "live", "1", "crash", "0", NULL); +} + /** * xenDaemonDomainRestore: * @conn: pointer to the Xem Daemon block diff --git a/src/xm_internal.c b/src/xm_internal.c index c1910f923b..530c6f8ec7 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -84,6 +84,7 @@ static virDriver xenXMDriver = { xenXMDomainGetInfo, /* domainGetInfo */ NULL, /* domainSave */ NULL, /* domainRestore */ + NULL, /* domainCoreDump */ xenXMDomainSetVcpus, /* domainSetVcpus */ NULL, /* domainPinVcpu */ NULL, /* domainGetVcpus */ diff --git a/src/xs_internal.c b/src/xs_internal.c index 36f615a184..70ef0c770f 100644 --- a/src/xs_internal.c +++ b/src/xs_internal.c @@ -68,6 +68,7 @@ static virDriver xenStoreDriver = { xenStoreGetDomainInfo, /* domainGetInfo */ NULL, /* domainSave */ NULL, /* domainRestore */ + NULL, /* domainCoreDump */ NULL, /* domainSetVcpus */ NULL, /* domainPinVcpu */ NULL, /* domainGetVcpus */