From 4bf3bc9eda4075480efff8335c64f831c82fdd27 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Fri, 28 Sep 2007 14:28:12 +0000 Subject: [PATCH] * include/libvirt/libvirt.h[.in] src/driver.h src/openvz_driver.c src/qemu_driver.c src/remote_internal.c src/test.c src/xen_internal.[ch] src/xen_unified.c src/xend_internal.[ch] src/libvirt.c src/libvirt_sym.version: adding NUMA support patches from Beth Kon adding new virNodeGetCellsFreeMemory entry point and extending the virConnectGetCapabilities one. Fix a couple of issues in the patch and add to exported symbols from shared lib. * docs/virsh.pod docs/virsh.1 src/virsh.c: added new command freecell to get the available memory on the node or in a NUMA cell. * docs/*: updated and regenerated the documentation Daniel --- ChangeLog | 13 ++ docs/APIchunk0.html | 2 + docs/APIchunk1.html | 9 ++ docs/APIchunk2.html | 7 + docs/APIchunk3.html | 9 ++ docs/APIchunk4.html | 6 + docs/APIchunk5.html | 3 + docs/APIchunk6.html | 5 + docs/APIfiles.html | 1 + docs/APIfunctions.html | 2 + docs/APIsymbols.html | 1 + docs/devhelp/libvirt-libvirt.html | 5 + docs/html/libvirt-libvirt.html | 5 +- docs/hvsupport.html | 6 + docs/libvir.html | 8 ++ docs/libvirt-api.xml | 9 ++ docs/libvirt-refs.xml | 76 ++++++++++ docs/remote.html | 4 +- docs/virsh.pod | 6 + include/libvirt/libvirt.h | 9 ++ include/libvirt/libvirt.h.in | 9 ++ src/driver.h | 8 ++ src/libvirt.c | 39 +++++ src/libvirt_sym.version | 2 + src/openvz_driver.c | 1 + src/qemu_driver.c | 1 + src/remote_internal.c | 1 + src/test.c | 1 + src/virsh.c | 43 ++++++ src/xen_internal.c | 115 ++++++++++++++- src/xen_internal.h | 4 + src/xen_unified.c | 15 ++ src/xend_internal.c | 228 +++++++++++++++++++++++++++++- src/xend_internal.h | 2 + virsh.1 | 7 +- 35 files changed, 654 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82a0830da1..b032655a5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Fri Sep 28 16:17:41 CEST 2007 Daniel Veillard + + * include/libvirt/libvirt.h[.in] src/driver.h src/openvz_driver.c + src/qemu_driver.c src/remote_internal.c src/test.c + src/xen_internal.[ch] src/xen_unified.c src/xend_internal.[ch] + src/libvirt.c src/libvirt_sym.version: adding NUMA support patches + from Beth Kon adding new virNodeGetCellsFreeMemory entry point + and extending the virConnectGetCapabilities one. Fix a couple of + issues in the patch and add to exported symbols from shared lib. + * docs/virsh.pod docs/virsh.1 src/virsh.c: added new command + freecell to get the available memory on the node or in a NUMA cell. + * docs/*: updated and regenerated the documentation + Fri Sep 28 11:20:00 BST 2007 Richard W.M. Jones * docs/libvir.html: Clarified configuration required for diff --git a/docs/APIchunk0.html b/docs/APIchunk0.html index 212dae8cb9..39c9938422 100644 --- a/docs/APIchunk0.html +++ b/docs/APIchunk0.html @@ -111,9 +111,11 @@
Linux
virDomainCreateLinux

Letter M:

Macro
LIBVIR_VERSION_NUMBER
VIR_DOMAIN_SCHED_FIELD_LENGTH
+
Maximum
virNodeGetCellsFreeMemory
Mbps
virDomainMigrate
Migrate
virDomainMigrate

Letter N:

NUMA
_virNodeInfo
+virNodeGetCellsFreeMemory
Normally
virConnectGetURI
Note
virDomainCoreDump
virDomainGetInfo
diff --git a/docs/APIchunk1.html b/docs/APIchunk1.html index 8bd30237ec..0d0cff0ed4 100644 --- a/docs/APIchunk1.html +++ b/docs/APIchunk1.html @@ -54,6 +54,7 @@ virConnectNumOfNetworks
virDomainSuspend
add
virDomainShutdown
+
additional
virNodeGetCellsFreeMemory
address
virDomainMigrate
after
virConnectGetCapabilities
virDomainReboot
@@ -74,6 +75,7 @@ virDomainSetMaxMemory
virDomainSetMemory
virDomainSuspend
+virNodeGetCellsFreeMemory
virNodeGetInfo
allowed
_virDomainInfo
already
virDomainDestroy
@@ -83,6 +85,7 @@
amount
virDomainGetMaxMemory
virDomainSetMaxMemory
virDomainSetMemory
+virNodeGetCellsFreeMemory
analysis
virDomainCoreDump
anymore
virDomainSave
application
virConnectClose
@@ -115,6 +118,7 @@ virDomainGetVcpus
virNetworkGetUUID
virNetworkGetUUIDString
+virNodeGetCellsFreeMemory
associated
virDomainGetConnect
virNetworkGetConnect
assumed
virDomainGetVcpus
@@ -211,6 +215,7 @@ virNetworkCreate
virNetworkDestroy
virNetworkGetConnect
+virNodeGetCellsFreeMemory
callback
virConnSetErrorFunc
virErrorFunc
virSetErrorFunc
@@ -227,6 +232,7 @@ virDomainGetXMLDesc
virNetworkGetBridgeName
virNetworkGetXMLDesc
+virNodeGetCellsFreeMemory
calling
virDomainBlockStats
virDomainResume
calloc
virDomainGetVcpus
@@ -237,6 +243,7 @@ virDomainGetInfo
virDomainMigrate
virDomainPinVcpu
+virNodeGetCellsFreeMemory
cannot
virDomainLookupByID
virDomainLookupByName
virDomainLookupByUUID
@@ -256,6 +263,8 @@ virResetLastError
virSetErrorFunc
cell
_virNodeInfo
+virNodeGetCellsFreeMemory
+
cells
virNodeGetCellsFreeMemory
change
virDomainPinVcpu
virDomainSetMaxMemory
virDomainSetMemory
diff --git a/docs/APIchunk2.html b/docs/APIchunk2.html index 376a8b3a4d..5146301c9a 100644 --- a/docs/APIchunk2.html +++ b/docs/APIchunk2.html @@ -82,10 +82,13 @@ virDomainInterfaceStats
virDomainMigrate
virDomainPinVcpu
+virNodeGetCellsFreeMemory
+
either
virNodeGetCellsFreeMemory
element
virConnectGetMaxVcpus
else
virDomainMigrate
encoded
virDomainGetXMLDesc
virNetworkGetXMLDesc
+
entries
virNodeGetCellsFreeMemory
especially
virConnectClose
etc
virDomainMigrate
even
virDomainMigrate
@@ -111,11 +114,13 @@ virDomainSave
filled
virDomainGetSchedulerParameters
virDomainGetVcpus
+virNodeGetCellsFreeMemory
find
virDomainLookupByID
virDomainMigrate
finding
virDomainBlockStats
first
virConnectOpen
virConnectOpenReadOnly
+virNodeGetCellsFreeMemory
flags
virDomainCoreDump
virDomainGetXMLDesc
virDomainMigrate
@@ -147,6 +152,8 @@ virDomainGetXMLDesc
virNetworkGetBridgeName
virNetworkGetXMLDesc
+virNodeGetCellsFreeMemory
+
freeMems
virNodeGetCellsFreeMemory
freed
virConnectGetHostname
virConnectGetURI
virDomainDestroy
diff --git a/docs/APIchunk3.html b/docs/APIchunk3.html index d52fbc80b7..a0842c522f 100644 --- a/docs/APIchunk3.html +++ b/docs/APIchunk3.html @@ -47,18 +47,21 @@ virDomainGetMaxVcpus
increased
virDomainGetConnect
virNetworkGetConnect
+
index
virNodeGetCellsFreeMemory
indicates
virDomainBlockStats
virDomainInterfaceStats
indicating
_virNodeInfo
virDomainGetAutostart
virNetworkGetAutostart
info
virDomainGetVcpus
+virNodeGetCellsFreeMemory
information
_virError
virDomainGetInfo
virDomainGetUUIDString
virDomainGetVcpus
virGetVersion
virNetworkGetUUIDString
+virNodeGetCellsFreeMemory
virNodeGetInfo
informative
_virError
initializing
virInitialize
@@ -95,6 +98,7 @@ virDomainGetMaxMemory
virDomainSetMaxMemory
virDomainSetMemory
+virNodeGetCellsFreeMemory
knowing
virDomainShutdown

Letter l:

lack
virConnectGetVersion
languages
virDomainGetConnect
@@ -153,6 +157,7 @@
listed
virDomainSave
little-endian
virDomainPinVcpu
live
virDomainMigrate
+
long
virNodeGetCellsFreeMemory
looked
virGetVersion
lookup
virDomainLookupByName
virDomainLookupByUUID
@@ -188,6 +193,7 @@
maplen
cpumap
virDomainGetVcpus
virDomainPinVcpu
+
maxCells
virNodeGetCellsFreeMemory
maximum
_virDomainInfo
virConnectGetMaxVcpus
virDomainGetMaxMemory
@@ -225,6 +231,7 @@ virDomainSetMaxMemory
virDomainSetMemory
virDomainSuspend
+virNodeGetCellsFreeMemory
message
_virError
method
virDomainCoreDump
virDomainMigrate
@@ -246,6 +253,7 @@ virDomainInterfaceStats
virDomainMigrate
virNetworkGetUUIDString
+virNodeGetCellsFreeMemory
moves
virDomainCreate
virNetworkCreate
msg00096
virConnectGetType
@@ -265,6 +273,7 @@ virDomainMigrate
virNetworkGetBridgeName
virNetworkGetXMLDesc
+virNodeGetCellsFreeMemory
mysterious
_virDomainBlockStats

A-V W-c diff --git a/docs/APIchunk4.html b/docs/APIchunk4.html index fd9ee9e6bc..e87be5a058 100644 --- a/docs/APIchunk4.html +++ b/docs/APIchunk4.html @@ -50,6 +50,7 @@ virNetworkLookupByUUID
virNetworkLookupByUUIDString
node
_virNodeInfo
+virNodeGetCellsFreeMemory
virNodeGetInfo
non
VIR_CPU_USABLE
non-NULL
virConnectGetURI
@@ -70,6 +71,7 @@ virDomainGetVcpus
virDomainMigrate
virNetworkCreateXML
+virNodeGetCellsFreeMemory
only
virConnectGetVersion
virDomainGetInfo
oo_req
_virDomainBlockStats
@@ -205,6 +207,7 @@
reporting
virDefaultErrorFunc
request
virDomainReboot
virDomainShutdown
+
requested
virNodeGetCellsFreeMemory
required
VIR_CPU_MAPLEN
VIR_UUID_BUFLEN
VIR_UUID_STRING_BUFLEN
@@ -242,6 +245,7 @@ virDomainMigrate
virGetVersion
virNetworkDestroy
+virNodeGetCellsFreeMemory
returned
virConnectGetCapabilities
virDomainBlockStats
virDomainCreateLinux
@@ -258,6 +262,7 @@ virNetworkGetAutostart
virNetworkGetBridgeName
virNetworkGetXMLDesc
+virNodeGetCellsFreeMemory
returns
VIR_CPU_MAPLEN
VIR_CPU_USABLE
VIR_GET_CPUMAP
@@ -267,6 +272,7 @@ virConnectGetVersion
virDomainBlockStats
virDomainInterfaceStats
+virNodeGetCellsFreeMemory
reused
virDomainGetXMLDesc
virNetworkGetXMLDesc
routine
virDefaultErrorFunc
diff --git a/docs/APIchunk5.html b/docs/APIchunk5.html index b1be1d4db5..5c90c72ced 100644 --- a/docs/APIchunk5.html +++ b/docs/APIchunk5.html @@ -67,6 +67,7 @@ virDomainPinVcpu
virDomainSetMaxMemory
virDomainSetMemory
+
smaller
virNodeGetCellsFreeMemory
socket
_virNodeInfo
software
virConnectGetType
source
virDomainMigrate
@@ -78,10 +79,12 @@
start
virDomainDefineXML
virNetworkCreate
virNetworkCreateXML
+
startCell
virNodeGetCellsFreeMemory
started
virDomainGetAutostart
virDomainSetAutostart
virNetworkGetAutostart
virNetworkSetAutostart
+
starting
virNodeGetCellsFreeMemory
startup
virInitialize
state
_virDomainInfo
virDomainResume
diff --git a/docs/APIchunk6.html b/docs/APIchunk6.html index 7bedf5c1ce..1b01dfc4ec 100644 --- a/docs/APIchunk6.html +++ b/docs/APIchunk6.html @@ -16,6 +16,7 @@
uniform
_virNodeInfo
unknown
virGetVersion
unsigned
virDomainGetID
+virNodeGetCellsFreeMemory
unused
virDomainCoreDump
uri
virConnectOpen
virConnectOpenReadOnly
@@ -174,7 +175,9 @@ virGetLastError
virGetVersion
virNetworkGetBridgeName
+virNodeGetCellsFreeMemory
virSetErrorFunc
+
whichever
virNodeGetCellsFreeMemory
while
virGetVersion
will
virConnCopyLastError
virConnSetErrorFunc
@@ -190,6 +193,7 @@ virDomainSuspend
virGetVersion
virNetworkGetName
+virNodeGetCellsFreeMemory
virSetErrorFunc
with
VIR_COPY_CPUMAP
VIR_CPU_MAPLEN
@@ -208,6 +212,7 @@ virDomainMigrate
virNetworkGetConnect
virNetworkGetXMLDesc
+virNodeGetCellsFreeMemory
within
virDomainBlockStats
virDomainInterfaceStats
without
virDomainSuspend
diff --git a/docs/APIfiles.html b/docs/APIfiles.html index ea7433e42a..908a7d6c13 100644 --- a/docs/APIfiles.html +++ b/docs/APIfiles.html @@ -133,6 +133,7 @@ virNetworkPtr
virNetworkSetAutostart
virNetworkUndefine
+virNodeGetCellsFreeMemory
virNodeGetInfo
virNodeInfo
virNodeInfoPtr
diff --git a/docs/APIfunctions.html b/docs/APIfunctions.html index 7361ca55e5..5c7d043e23 100644 --- a/docs/APIfunctions.html +++ b/docs/APIfunctions.html @@ -25,6 +25,7 @@ virDomainSetMemory

Type unsigned long *:

virConnectGetVersion
virGetVersion
+

Type unsigned long long *:

virNodeGetCellsFreeMemory

Type virConnectPtr:

virConnCopyLastError
virConnGetLastError
virConnResetLastError
@@ -57,6 +58,7 @@ virNetworkLookupByName
virNetworkLookupByUUID
virNetworkLookupByUUIDString
+virNodeGetCellsFreeMemory
virNodeGetInfo

Type virDomainBlockStatsPtr:

virDomainBlockStats

Type virDomainInfoPtr:

virDomainGetInfo
diff --git a/docs/APIsymbols.html b/docs/APIsymbols.html index 6a68f70c51..411a4369f6 100644 --- a/docs/APIsymbols.html +++ b/docs/APIsymbols.html @@ -210,6 +210,7 @@ virNetworkPtr
virNetworkSetAutostart
virNetworkUndefine
+virNodeGetCellsFreeMemory
virNodeGetInfo
virNodeInfo
virNodeInfoPtr
diff --git a/docs/devhelp/libvirt-libvirt.html b/docs/devhelp/libvirt-libvirt.html index cec3697304..d80856885a 100644 --- a/docs/devhelp/libvirt-libvirt.html +++ b/docs/devhelp/libvirt-libvirt.html @@ -124,6 +124,7 @@ int virConnectNumOfDefinedDomains ( virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
const char * xml); int virNetworkCreate (virNetworkPtr network); int virDomainSetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
int nparams); +int virNodeGetCellsFreeMemory (virConnectPtr conn,
unsigned long long * freeMems,
int startCell,
int maxCells); int virConnectClose (virConnectPtr conn); int virDomainReboot (virDomainPtr domain,
unsigned int flags); int virDomainBlockStats (virDomainPtr dom,
const char * path,
virDomainBlockStatsPtr stats,
size_t size); @@ -683,6 +684,10 @@ The content of this structure is not made public by the API.

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

virNodeGetCellsFreeMemory ()

int	virNodeGetCellsFreeMemory	(virConnectPtr conn, 
unsigned long long * freeMems,
int startCell,
int maxCells)
+

This call returns the amount of free memory in one or more NUMA cells. The @freeMems array must be allocated by the caller and will be filled with the amount of free memory in kilobytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller.

+
conn:pointer to the hypervisor connection
freeMems:pointer to the array of unsigned long long
startCell:index of first cell to return freeMems info on.
maxCells:Maximum number of cells for which freeMems information can be returned.
Returns:the number of entries filled in freeMems, or -1 in case of error.

virNodeGetInfo ()

int	virNodeGetInfo			(virConnectPtr conn, 
virNodeInfoPtr info)

Extract hardware information about the node.

diff --git a/docs/html/libvirt-libvirt.html b/docs/html/libvirt-libvirt.html index 6e290ba8de..2f2af53845 100644 --- a/docs/html/libvirt-libvirt.html +++ b/docs/html/libvirt-libvirt.html @@ -105,6 +105,7 @@ The content of this structure is not made public by the API.
virNetworkPtr	virNetworkLookupByUUIDString	(virConnectPtr conn, 
const char * uuidstr)
int	virNetworkSetAutostart		(virNetworkPtr network, 
int autostart)
int	virNetworkUndefine		(virNetworkPtr network)
+
int	virNodeGetCellsFreeMemory	(virConnectPtr conn, 
unsigned long long * freeMems,
int startCell,
int maxCells)
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

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

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)
+
network:pointer to a defined network
Returns:0 in case of success, -1 in case of error

Function: virNodeGetCellsFreeMemory

int	virNodeGetCellsFreeMemory	(virConnectPtr conn, 
unsigned long long * freeMems,
int startCell,
int maxCells)
+

This call returns the amount of free memory in one or more NUMA cells. The @freeMems array must be allocated by the caller and will be filled with the amount of free memory in kilobytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller.

+
conn:pointer to the hypervisor connection
freeMems:pointer to the array of unsigned long long
startCell:index of first cell to return freeMems info on.
maxCells:Maximum number of cells for which freeMems information can be returned.
Returns:the number of entries filled in freeMems, or -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/hvsupport.html b/docs/hvsupport.html index f390d91090..a874fe6563 100644 --- a/docs/hvsupport.html +++ b/docs/hvsupport.html @@ -352,6 +352,12 @@ updated on 2007-08-20. ≥ 0.2.0 ≥ 0.2.0 ≥ 0.3.0 + virNodeGetCellsFreeMemory + 0.3.3 + ≥ 0.3.3 + + +

Network functions

Network functions are not hypervisor-specific. For historical reasons they require the QEMU daemon to be running (this diff --git a/docs/libvir.html b/docs/libvir.html index 343de99dcb..c64df30e14 100644 --- a/docs/libvir.html +++ b/docs/libvir.html @@ -3235,6 +3235,14 @@ updated on 2007-08-20. ≥ 0.2.0 ≥ 0.3.0 + + virNodeGetCellsFreeMemory + 0.3.3 + ≥ 0.3.3 + + + +

Network functions

diff --git a/docs/libvirt-api.xml b/docs/libvirt-api.xml index 04f082ee21..9b70dce377 100644 --- a/docs/libvirt-api.xml +++ b/docs/libvirt-api.xml @@ -119,6 +119,7 @@ + @@ -966,6 +967,14 @@ + + This call returns the amount of free memory in one or more NUMA cells. The @freeMems array must be allocated by the caller and will be filled with the amount of free memory in kilobytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller. + + + + + + Extract hardware information about the node. diff --git a/docs/libvirt-refs.xml b/docs/libvirt-refs.xml index 7f77c047c6..7bd87589f6 100644 --- a/docs/libvirt-refs.xml +++ b/docs/libvirt-refs.xml @@ -211,6 +211,7 @@ + @@ -442,6 +443,7 @@ + @@ -532,6 +534,9 @@ + + + @@ -565,6 +570,7 @@ + @@ -789,6 +795,7 @@ + @@ -1080,6 +1087,9 @@ + + + @@ -1090,6 +1100,7 @@ + @@ -1359,6 +1370,9 @@ + + + @@ -1390,6 +1404,7 @@ + @@ -1409,6 +1424,7 @@ + @@ -1459,6 +1475,7 @@ + @@ -1621,6 +1638,7 @@ + @@ -1643,6 +1661,7 @@ + @@ -1661,6 +1680,7 @@ + @@ -1692,6 +1712,10 @@ + + + + @@ -1954,6 +1978,10 @@ + + + + @@ -1965,6 +1993,9 @@ + + + @@ -2025,6 +2056,7 @@ + @@ -2036,6 +2068,7 @@ + @@ -2079,6 +2112,10 @@ + + + + @@ -2264,6 +2301,9 @@ + + + @@ -2275,6 +2315,7 @@ + @@ -2283,6 +2324,7 @@ + @@ -2353,6 +2395,7 @@ + @@ -2458,6 +2501,9 @@ + + + @@ -2517,6 +2563,9 @@ + + + @@ -2565,6 +2614,7 @@ + @@ -2610,6 +2660,7 @@ + @@ -2639,6 +2690,7 @@ + @@ -2706,6 +2758,7 @@ + @@ -2744,6 +2797,7 @@ + @@ -3000,6 +3054,9 @@ + + + @@ -3058,6 +3115,7 @@ + @@ -3076,6 +3134,7 @@ + @@ -3087,6 +3146,7 @@ + @@ -3210,6 +3270,9 @@ + + + @@ -3235,12 +3298,18 @@ + + + + + + @@ -3525,6 +3594,7 @@ + @@ -3783,8 +3853,12 @@ + + + + @@ -3803,6 +3877,7 @@ + @@ -3823,6 +3898,7 @@ + diff --git a/docs/remote.html b/docs/remote.html index 7598a26882..e8626c1f00 100644 --- a/docs/remote.html +++ b/docs/remote.html @@ -71,8 +71,8 @@ Remote libvirt supports a range of transports: ssh (secure shell) connection. Requires Netcat (nc) - installed on the remote machine, and the remote libvirtd should - be listening on the unix transport. You should use some sort of + installed and libvirtd should be running + on the remote machine. You should use some sort of ssh key management (eg. ssh-agent) otherwise programs which use diff --git a/docs/virsh.pod b/docs/virsh.pod index aff0e0c96a..62e05f35fa 100644 --- a/docs/virsh.pod +++ b/docs/virsh.pod @@ -121,6 +121,7 @@ capabilities in terms of CPU and features, and a set of description for each kind of guest which can be virtualized. For a more complete description see: L +The XML also show the NUMA topology informations if available. =item B @@ -141,6 +142,11 @@ B list Name is the name of the domain. ID the domain numeric id. State is the run state (see below). +=item B optional I + +Prints the available amount of memory on the machine or within a +NUMA cell if I is provided. + =over 4 B diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h index cacb258eb6..9db6d7b6ac 100644 --- a/include/libvirt/libvirt.h +++ b/include/libvirt/libvirt.h @@ -581,6 +581,15 @@ int virDomainGetVcpus (virDomainPtr domain, int virDomainAttachDevice(virDomainPtr domain, char *xml); int virDomainDetachDevice(virDomainPtr domain, char *xml); +/* + * NUMA support + */ + +int virNodeGetCellsFreeMemory(virConnectPtr conn, + unsigned long long *freeMems, + int startCell, + int maxCells); + /* * Virtual Networks API */ diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 0cbb5e7c2e..fcfed43fe8 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -581,6 +581,15 @@ int virDomainGetVcpus (virDomainPtr domain, int virDomainAttachDevice(virDomainPtr domain, char *xml); int virDomainDetachDevice(virDomainPtr domain, char *xml); +/* + * NUMA support + */ + +int virNodeGetCellsFreeMemory(virConnectPtr conn, + unsigned long long *freeMems, + int startCell, + int maxCells); + /* * Virtual Networks API */ diff --git a/src/driver.h b/src/driver.h index 7d6a2d808f..577fa6a8dc 100644 --- a/src/driver.h +++ b/src/driver.h @@ -255,6 +255,13 @@ typedef virDomainPtr typedef struct _virDriver virDriver; typedef virDriver *virDriverPtr; +typedef int + (*virDrvNodeGetCellsFreeMemory) + (virConnectPtr conn, + unsigned long long *freeMems, + int startCell, + int maxCells); + /** * _virDriver: * @@ -322,6 +329,7 @@ struct _virDriver { virDrvDomainMigrateFinish domainMigrateFinish; virDrvDomainBlockStats domainBlockStats; virDrvDomainInterfaceStats domainInterfaceStats; + virDrvNodeGetCellsFreeMemory nodeGetCellsFreeMemory; }; typedef int diff --git a/src/libvirt.c b/src/libvirt.c index 8089ddecb3..40df5394d4 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2633,6 +2633,45 @@ virDomainDetachDevice(virDomainPtr domain, char *xml) return -1; } +/** + * virNodeGetCellsFreeMemory: + * @conn: pointer to the hypervisor connection + * @freeMems: pointer to the array of unsigned long long + * @startCell: index of first cell to return freeMems info on. + * @maxCells: Maximum number of cells for which freeMems information can + * be returned. + * + * This call returns the amount of free memory in one or more NUMA cells. + * The @freeMems array must be allocated by the caller and will be filled + * with the amount of free memory in kilobytes for each cell requested, + * starting with startCell (in freeMems[0]), up to either + * (startCell + maxCells), or the number of additional cells in the node, + * whichever is smaller. + * + * Returns the number of entries filled in freeMems, or -1 in case of error. + */ + +int +virNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems, + int startCell, int maxCells) +{ + if (!VIR_IS_CONNECT(conn)) { + virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__); + return (-1); + } + + if ((freeMems == NULL) || (maxCells <= 0)) { + virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__); + return (-1); + } + + if (conn->driver->nodeGetCellsFreeMemory) + return conn->driver->nodeGetCellsFreeMemory (conn, freeMems, startCell, maxCells); + + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); + return -1; +} + /** * virNetworkGetConnect: * @net: pointer to a network diff --git a/src/libvirt_sym.version b/src/libvirt_sym.version index d04a6cd545..fa7cda3225 100644 --- a/src/libvirt_sym.version +++ b/src/libvirt_sym.version @@ -20,6 +20,7 @@ virDomainGetUUID; virDomainGetUUIDString; virDomainGetInfo; + virNodeGetCellsFreeMemory; virDomainGetMaxMemory; virDomainGetName; virDomainGetOSType; @@ -57,6 +58,7 @@ virDefaultErrorFunc; virNodeGetInfo; virConnectGetCapabilities; + virNodeGetCellsFreeMemory; virDomainSetVcpus; virDomainPinVcpu; diff --git a/src/openvz_driver.c b/src/openvz_driver.c index 84c9e86f41..1f9c8c4512 100644 --- a/src/openvz_driver.c +++ b/src/openvz_driver.c @@ -753,6 +753,7 @@ static virDriver openvzDriver = { NULL, /* domainMigrateFinish */ NULL, /* domainBlockStats */ NULL, /* domainInterfaceStats */ + NULL, /* nodeGetCellsFreeMemory */ }; static virNetworkDriver openvzNetworkDriver = { diff --git a/src/qemu_driver.c b/src/qemu_driver.c index be75081002..9be402392c 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -2704,6 +2704,7 @@ static virDriver qemuDriver = { NULL, /* domainMigrateFinish */ NULL, /* domainBlockStats */ NULL, /* domainInterfaceStats */ + NULL, /* nodeGetCellsFreeMemory */ }; static virNetworkDriver qemuNetworkDriver = { diff --git a/src/remote_internal.c b/src/remote_internal.c index 4f7e6ba938..fc9d3e27ad 100644 --- a/src/remote_internal.c +++ b/src/remote_internal.c @@ -3150,6 +3150,7 @@ static virDriver driver = { .domainMigrateFinish = remoteDomainMigrateFinish, .domainBlockStats = remoteDomainBlockStats, .domainInterfaceStats = remoteDomainInterfaceStats, + .nodeGetCellsFreeMemory = NULL, }; static virNetworkDriver network_driver = { diff --git a/src/test.c b/src/test.c index 59e1d4b958..03e49736ba 100644 --- a/src/test.c +++ b/src/test.c @@ -1969,6 +1969,7 @@ static virDriver testDriver = { NULL, /* domainMigrateFinish */ NULL, /* domainBlockStats */ NULL, /* domainInterfaceStats */ + NULL, /* nodeGetCellsFreeMemory */ }; static virNetworkDriver testNetworkDriver = { diff --git a/src/virsh.c b/src/virsh.c index c68e0dc805..585cc35d02 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -1561,6 +1561,48 @@ cmdDominfo(vshControl * ctl, vshCmd * cmd) return ret; } +/* + * "freecell" command + */ +static vshCmdInfo info_freecell[] = { + {"syntax", "freecell []"}, + {"help", gettext_noop("NUMA free memory")}, + {"desc", gettext_noop("display available free memory for the NUMA cell.")}, + {NULL, NULL} +}; + +static vshCmdOptDef opts_freecell[] = { + {"cellno", VSH_OT_DATA, 0, gettext_noop("NUMA cell number")}, + {NULL, 0, 0, NULL} +}; + +static int +cmdFreecell(vshControl * ctl, vshCmd * cmd) +{ + int ret; + int cell, cell_given; + unsigned long long memory; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + return FALSE; + + cell = vshCommandOptInt(cmd, "cellno", &cell_given); + if (!cell_given) { + cell = -1; + } + + ret = virNodeGetCellsFreeMemory(ctl->conn, &memory, cell, 1); + if (ret != 1) + return FALSE; + + if (cell == -1) + vshPrint(ctl, "%s: %llu kB\n", _("Total"), memory); + else + vshPrint(ctl, "%d: %llu kB\n", cell, memory); + + return TRUE; +} + /* * "vcpuinfo" command */ @@ -3661,6 +3703,7 @@ static vshCmdDef commands[] = { {"domblkstat", cmdDomblkstat, opts_domblkstat, info_domblkstat}, {"domifstat", cmdDomIfstat, opts_domifstat, info_domifstat}, {"dumpxml", cmdDumpXML, opts_dumpxml, info_dumpxml}, + {"freecell", cmdFreecell, opts_freecell, info_freecell}, {"hostname", cmdHostname, NULL, info_hostname}, {"list", cmdList, opts_list, info_list}, {"migrate", cmdMigrate, opts_migrate, info_migrate}, diff --git a/src/xen_internal.c b/src/xen_internal.c index 148e731b51..891e856a36 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -28,6 +28,7 @@ #include #include #include "xs_internal.h" +#include "xend_internal.h" /* required for dom0_getdomaininfo_t */ #include @@ -201,6 +202,15 @@ union xen_getschedulerid { }; typedef union xen_getschedulerid xen_getschedulerid; +struct xen_v2s4_availheap { + uint32_t min_bitwidth; /* Smallest address width (zero if don't care). */ + uint32_t max_bitwidth; /* Largest address width (zero if don't care). */ + int32_t node; /* NUMA node (-1 for sum across all nodes). */ + uint64_t avail_bytes; /* Bytes available in the specified region. */ +}; + +typedef struct xen_v2s4_availheap xen_v2s4_availheap; + #define XEN_GETDOMAININFOLIST_ALLOC(domlist, size) \ (hypervisor_version < 2 ? \ @@ -523,6 +533,11 @@ typedef struct xen_v2d5_setvcpumap xen_v2d5_getvcpumap; */ #define XEN_V2_OP_GETSCHEDULERID 4 +/* + * from V2 we get the available heap information + */ +#define XEN_V2_OP_GETAVAILHEAP 9 + /* * from V2 we get the scheduler parameter */ @@ -584,6 +599,7 @@ struct xen_op_v2_sys { xen_v2_getdomaininfolistop getdomaininfolist; xen_v2s3_getdomaininfolistop getdomaininfolists3; xen_v2_getschedulerid getschedulerid; + xen_v2s4_availheap availheap; uint8_t padding[128]; } u; }; @@ -2012,7 +2028,7 @@ xenHypervisorInit(void) #endif return(-1); } - /* Currently consider RHEL5.0 Fedora7 and xen-unstable */ + /* Currently consider RHEL5.0 Fedora7, xen-3.1, and xen-unstable */ sys_interface_version = 2; /* XEN_SYSCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { /* RHEL 5.0 */ @@ -2035,7 +2051,7 @@ xenHypervisorInit(void) sys_interface_version = 3; /* XEN_SYSCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { - /* xen-unstable */ + /* xen-3.1 */ dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ #ifdef DEBUG @@ -2045,6 +2061,18 @@ xenHypervisorInit(void) } } + sys_interface_version = 4; /* 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 ver4 dom ver5\n"); +#endif + goto done; + } + } + hypervisor_version = 1; sys_interface_version = -1; if (virXen_getdomaininfo(fd, 0, &info) == 1) { @@ -2200,7 +2228,7 @@ xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED, char line[1024], *str, *token; regmatch_t subs[4]; char *saveptr = NULL; - int i, r; + int i, r, topology; char hvm_type[4] = ""; /* "vmx" or "svm" (or "" if not in CPU). */ int host_pae = 0; @@ -2377,6 +2405,12 @@ xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED, \n", -1); if (r == -1) goto vir_buffer_failed; + if (sys_interface_version >= 4) { + topology = xenDaemonNodeGetTopology(conn, xml); + if (topology != 0) + goto topology_failed; + } + for (i = 0; i < nr_guest_archs; ++i) { r = virBufferVSprintf (xml, "\ @@ -2438,6 +2472,7 @@ xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED, \n", -1); if (r == -1) goto vir_buffer_failed; } + r = virBufferAdd (xml, "\ \n", -1); @@ -2450,6 +2485,7 @@ xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED, vir_buffer_failed: virXenError(VIR_ERR_NO_MEMORY, __FUNCTION__, 0); + topology_failed: virBufferFree (xml); return NULL; } @@ -2938,6 +2974,79 @@ xenHypervisorGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) } #ifndef PROXY +/** + * xenHypervisorNodeGetCellsFreeMemory: + * @conn: pointer to the hypervisor connection + * @freeMems: pointer to the array of unsigned long long + * @startCell: index of first cell to return freeMems info on. + * @maxCells: Maximum number of cells for which freeMems information can + * be returned. + * + * This call returns the amount of free memory in one or more NUMA cells. + * The @freeMems array must be allocated by the caller and will be filled + * with the amount of free memory in kilobytes for each cell requested, + * starting with startCell (in freeMems[0]), up to either + * (startCell + maxCells), or the number of additional cells in the node, + * whichever is smaller. + * + * Returns the number of entries filled in freeMems, or -1 in case of error. + */ +int +xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems, + int startCell, int maxCells) +{ + xen_op_v2_sys op_sys; + int i, j, ret; + xenUnifiedPrivatePtr priv; + static int nbNodeCells = -1; + virNodeInfo nodeInfo; + + + if (nbNodeCells == -1) { + if (xenDaemonNodeGetInfo(conn, &nodeInfo)) { + virXenErrorFunc (VIR_ERR_XEN_CALL, __FUNCTION__, + "cannot determine actual number of cells",0); + return -1; + } + nbNodeCells = nodeInfo.nodes; + } + + if ((conn == NULL) || (maxCells < 1) || (startCell >= nbNodeCells)) { + virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, + "invalid argument", 0); + return -1; + } + /* + * Support only sys_interface_version >=4 + */ + if (sys_interface_version < 4) { + virXenErrorFunc (VIR_ERR_XEN_CALL, __FUNCTION__, + "unsupported in sys interface < 4", 0); + return -1; + } + + priv = (xenUnifiedPrivatePtr) conn->privateData; + if (priv->handle < 0) { + virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__, + "priv->handle invalid", 0); + return -1; + } + + memset(&op_sys, 0, sizeof(op_sys)); + op_sys.cmd = XEN_V2_OP_GETAVAILHEAP; + + for (i = startCell, j = 0;(i < nbNodeCells) && (j < maxCells);i++,j++) { + op_sys.u.availheap.node = i; + ret = xenHypervisorDoV2Sys(priv->handle, &op_sys); + if (ret < 0) { + return(-1); + } + freeMems[j] = op_sys.u.availheap.avail_bytes; + } + return (j); +} + + /** * xenHypervisorPauseDomain: * @domain: pointer to the domain block diff --git a/src/xen_internal.h b/src/xen_internal.h index be4d79e834..94f5abdb7e 100644 --- a/src/xen_internal.h +++ b/src/xen_internal.h @@ -93,6 +93,10 @@ int xenHypervisorDomainInterfaceStats (virDomainPtr domain, const char *path, struct _virDomainInterfaceStats *stats); +int xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, + unsigned long long *freeMems, + int startCell, + int maxCells); #ifdef __cplusplus } #endif diff --git a/src/xen_unified.c b/src/xen_unified.c index e7b8842e4c..cddda39bcb 100644 --- a/src/xen_unified.c +++ b/src/xen_unified.c @@ -1053,6 +1053,20 @@ xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path, return -1; } +static int +xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMems, + int startCell, int maxCells) +{ + GET_PRIVATE (conn); + + if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) + return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems, + startCell, maxCells); + + xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); + return -1; +} + /*----- Register with libvirt.c, and initialise Xen drivers. -----*/ #define VERSION ((DOM0_INTERFACE_VERSION >> 24) * 1000000 + \ @@ -1113,6 +1127,7 @@ static virDriver xenUnifiedDriver = { .domainMigrateFinish = xenUnifiedDomainMigrateFinish, .domainBlockStats = xenUnifiedDomainBlockStats, .domainInterfaceStats = xenUnifiedDomainInterfaceStats, + .nodeGetCellsFreeMemory = xenUnifiedNodeGetCellsFreeMemory, }; /** diff --git a/src/xend_internal.c b/src/xend_internal.c index 29a11f7ea9..a1892a7fb5 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "libvirt/libvirt.h" @@ -1871,6 +1872,198 @@ sexpr_to_xend_node_info(struct sexpr *root, virNodeInfoPtr info) return (0); } +/** + * getNumber: + * @pointer: pointer to string beginning with numerical characters + * @result: pointer to integer for storing the numerical result + * + * Internal routine extracting a number from the beginning of a string + * + * Returns the number of characters that were extracted as digits + * or -1 if no digits were found. + */ +static int +getNumber (const char * pointer, int * result) { + int len = 0; + while (isdigit(*(pointer + len))) + len++; + if (len == 0) + return -1; + *(result) = atoi(pointer); + return (len); +} + +/** + * sexpr_to_xend_topology_xml: + * @root: an S-Expression describing a node + * + * Internal routine creating an XML string with the values from + * the node root provided. + * + * Returns 0 in case of success, -1 in case of error + */ +static int +sexpr_to_xend_topology_xml(virConnectPtr conn, struct sexpr *root, virBufferPtr xml) +{ + const char *nodeToCpu; + const char *offset; + int cellNum; + int numCells = 0; + int numCpus; + int cellCpuCount = 0; + int nodeCpuCount = 0; + int start; + int finish; + int r; + int i; + int len; + int cpuNum; + int *cpuIdsPtr = NULL; + int *iCpuIdsPtr = NULL; + char next; + + nodeToCpu = sexpr_node(root, "node/node_to_cpu"); + if (nodeToCpu == NULL) { + virXendError(conn, VIR_ERR_INTERNAL_ERROR, + _("failed to parse topology information")); + goto error; + } + + numCells = sexpr_int(root, "node/nr_nodes"); + numCpus = sexpr_int(root, "node/nr_cpus"); + + /* array for holding all cpu numbers associated with a single cell. + * Should never need more than numCpus (which is total number of + * cpus for the node) + */ + cpuIdsPtr = iCpuIdsPtr = malloc(numCpus * sizeof(int)); + if (cpuIdsPtr == NULL) { + goto vir_buffer_failed; + } + + /* start filling in xml */ + r = virBufferVSprintf (xml, + "\ + \n\ + \n", + numCells); + if (r == -1) goto vir_buffer_failed; + + offset = nodeToCpu; + /* now iterate through all cells and find associated cpu ids */ + /* example of string being parsed: "node0:0-3,7,9-10\n node1:11-14\n" */ + while ((offset = strstr(offset, "node")) != NULL) { + cpuIdsPtr = iCpuIdsPtr; + cellCpuCount = 0; + offset +=4; + if ((len = getNumber(offset, &cellNum)) < 0) { + virXendError(conn, VIR_ERR_XEN_CALL, " topology string syntax error"); + goto error; + } + offset += len; + if (*(offset) != ':') { + virXendError(conn, VIR_ERR_XEN_CALL, " topology string syntax error"); + goto error; + } + offset++; + /* get list of cpus associated w/ single cell */ + while (1) { + if ((len = getNumber(offset, &cpuNum)) < 0) { + virXendError(conn, VIR_ERR_XEN_CALL, " topology string syntax error"); + goto error; + } + offset += len; + next = *(offset); + if (next == '-') { + offset++; + start = cpuNum; + if ((len = getNumber(offset, &finish)) < 0) { + virXendError(conn, VIR_ERR_XEN_CALL, " topology string syntax error"); + goto error; + } + if (start > finish) { + virXendError(conn, VIR_ERR_XEN_CALL, " topology string syntax error"); + goto error; + + } + for (i=start; i<=finish && nodeCpuCount numCpus) { + virXendError(conn, VIR_ERR_XEN_CALL, + "conflicting cpu counts"); + goto error; + } + offset += len; + next = *(offset); + offset++; + if (next == ',') { + continue; + } else if ((next == '\\') || (next =='\0')) { + break; + } else { + virXendError(conn, VIR_ERR_XEN_CALL, + " topology string syntax error"); + goto error; + } + } else { + /* add the single number */ + if (nodeCpuCount >= numCpus) { + virXendError(conn, VIR_ERR_XEN_CALL, + "conflicting cpu counts"); + goto error; + } + *(cpuIdsPtr++) = cpuNum; + cellCpuCount++; + nodeCpuCount++; + if (next == ',') { + offset++; + continue; + } else if ((next == '\\') || (next =='\0')) { + break; + } else { + virXendError(conn, VIR_ERR_XEN_CALL, + " topology string syntax error"); + goto error; + } + } + } + + /* add xml for all cpus associated with one cell */ + r = virBufferVSprintf (xml, "\ + \n\ + \n", cellNum, cellCpuCount); + if (r == -1) goto vir_buffer_failed; + + for (i = 0; i < cellCpuCount; i++) { + r = virBufferVSprintf (xml, "\ + \n", *(iCpuIdsPtr + i)); + if (r == -1) goto vir_buffer_failed; + } + r = virBufferAdd (xml, "\ + \n\ + \n", -1); + if (r == -1) goto vir_buffer_failed; + } + r = virBufferAdd (xml, "\ + \n\ + \n", -1); + if (r == -1) goto vir_buffer_failed; + free(iCpuIdsPtr); + return (0); + + +vir_buffer_failed: + virXendError(conn, VIR_ERR_NO_MEMORY, _("allocate new buffer")); + +error: + if (iCpuIdsPtr) + free(iCpuIdsPtr); + return (-1); +} + #ifndef PROXY /** * sexpr_to_domain: @@ -1956,7 +2149,7 @@ xenDaemonOpen(virConnectPtr conn, const char *name, { xmlURIPtr uri = NULL; int ret; - + /* If the name is just "xen" (it might originally have been NULL, * see xenUnifiedOpen) or any URI beginning with "xen:///" then * try default paths and methods to get to the xend socket. @@ -2588,6 +2781,39 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) { return (ret); } +/** + * xenDaemonNodeGetTopology: + * @conn: pointer to the Xen Daemon block + * + * This method retrieves a node's topology information. + * + * Returns -1 in case of error, 0 otherwise. + */ +int +xenDaemonNodeGetTopology(virConnectPtr conn, virBufferPtr xml) { + int ret = -1; + struct sexpr *root; + + if (!VIR_IS_CONNECT(conn)) { + virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__); + return (-1); + } + + if (xml == NULL) { + virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__); + return (-1); + } + + root = sexpr_get(conn, "/xend/node/"); + if (root == NULL) { + return (-1); + } + + ret = sexpr_to_xend_topology_xml(conn, root, xml); + sexpr_free(root); + return (ret); +} + #ifndef PROXY /** * xenDaemonGetType: diff --git a/src/xend_internal.h b/src/xend_internal.h index 68833b0d75..67c44ec8bd 100644 --- a/src/xend_internal.h +++ b/src/xend_internal.h @@ -19,6 +19,7 @@ #include #include "libvirt/libvirt.h" +#include "buf.h" #ifdef __cplusplus extern "C" { @@ -182,6 +183,7 @@ int xenDaemonOpen(virConnectPtr conn, const char *name, int flags); int xenDaemonClose(virConnectPtr conn); int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer); int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); +int xenDaemonNodeGetTopology(virConnectPtr conn, virBufferPtr xml); int xenDaemonDomainSuspend(virDomainPtr domain); int xenDaemonDomainResume(virDomainPtr domain); int xenDaemonDomainShutdown(virDomainPtr domain); diff --git a/virsh.1 b/virsh.1 index 3030e8507b..09df396e4b 100644 --- a/virsh.1 +++ b/virsh.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "VIRSH 1" -.TH VIRSH 1 "2007-08-14" "perl v5.8.8" "Virtualization Support" +.TH VIRSH 1 "2007-09-28" "perl v5.8.8" "Virtualization Support" .SH "NAME" virsh \- management user interface .SH "SYNOPSIS" @@ -241,6 +241,7 @@ capabilities in terms of \s-1CPU\s0 and features, and a set of description for each kind of guest which can be virtualized. For a more complete description see: +The \s-1XML\s0 also show the \s-1NUMA\s0 topology informations if available. .IP "\fBlist\fR" 4 .IX Item "list" Prints information about one or more domains. If no domains are @@ -260,6 +261,10 @@ An example format for the list is as follows: .Sp Name is the name of the domain. \s-1ID\s0 the domain numeric id. State is the run state (see below). +.IP "\fBfreecell\fR optional \fIcellno\fR" 4 +.IX Item "freecell optional cellno" +Prints the available amount of memory on the machine or within a +\&\s-1NUMA\s0 cell if \fIcellno\fR is provided. .RS 4 .Sp .RS 4