1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-08-20 21:50:07 +03:00

Compare commits

..

3 Commits

11 changed files with 526 additions and 366 deletions

View File

@ -1,3 +1,26 @@
Fri Sep 29 11:27:36 CEST 2006 Daniel Veillard <veillard@redhat.com>
* docs/* libvirt.spec.in configure.in NEWS: preparing release of 0.1.7
Thu Sep 21 10:19:02 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/xen_internal.c: Fork different version of getdomaininfo struct for
Xen 3.0.2, and 3.0.3 because the shared_info_frame field is different
size on between these versions on 32-bit platforms. Make callers use
appropriate struct version matched to hypervisor version, hiding detail
in macros to aid readability. Cleanup whitespace to remove tabs. Disable
xenHypervisorGetVcpus completely in proxy since its not used.
Thu Sep 21 10:19:02 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/xend_internal.c: Check if the physical CPU will fit in the maplen
provided by the caller when populating VCPU<->CPU mapping. This is because
XenD will return data for 32 physical CPUs, even if the box only has 4
CPUs. The caller of course will only have allocated a map big enough for
the actual number of physical CPUs. We simply check against maplen param
supplied by caller & discard info about CPUs which don't fit. Also santise
whitespace.
Fri Sep 22 11:02:48 CEST 2006 Daniel Veillard <veillard@redhat.com>
* docs/* libvirt.spec.in configure.in NEWS: preparing release of 0.1.6

8
NEWS
View File

@ -5,7 +5,13 @@
http://libvirt.org/news.html
Releases
0.1.6: Sep 5 2006:
0.1.7: Sep 29 2006:
- fix a memory bug on getting vcpu informations from xend (Daniel Berrange)
- fix another problem in the hypercalls change in Xen changeset
86d26e6ec89b when getting domain informations (Daniel Berrange)
0.1.6: Sep 22 2006:
- Support for localization of strings using gettext (Daniel Berrange)
- Support for new Xen-3.0.3 cdrom and disk configuration (Daniel Berrange)
- Support for setting VNC port when creating domains with new

View File

@ -5,7 +5,7 @@ AC_CANONICAL_HOST
LIBVIRT_MAJOR_VERSION=0
LIBVIRT_MINOR_VERSION=1
LIBVIRT_MICRO_VERSION=6
LIBVIRT_MICRO_VERSION=7
LIBVIRT_MICRO_VERSION_SUFFIX=
LIBVIRT_VERSION=$LIBVIRT_MAJOR_VERSION.$LIBVIRT_MINOR_VERSION.$LIBVIRT_MICRO_VERSION$LIBVIRT_MICRO_VERSION_SUFFIX
LIBVIRT_VERSION_INFO=`expr $LIBVIRT_MAJOR_VERSION + $LIBVIRT_MINOR_VERSION`:$LIBVIRT_MICRO_VERSION:$LIBVIRT_MINOR_VERSION

View File

@ -33,7 +33,13 @@ development of libvirt, it is preferable when possible to just use the <a
href="downloads.html">CVS version or snapshot</a>, contact the mailing list
and check the <a href="ChangeLog.html">ChangeLog</a> to gauge progresses.</p>
<h3>0.1.6: Sep 5 2006</h3>
<h3>0.1.7: Sep 29 2006</h3>
<ul>
<li> fix a memory bug on getting vcpu informations from xend (Daniel Berrange)</li>
<li> fix another problem in the hypercalls change in Xen changeset
86d26e6ec89b when getting domain informations (Daniel Berrange)</li>
</ul>
<h3>0.1.6: Sep 22 2006</h3>
<ul>
<li>Support for localization of strings using gettext (Daniel Berrange)</li>
<li>Support for new Xen-3.0.3 cdrom and disk configuration (Daniel Berrange)</li>

View File

@ -2,7 +2,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><link rel="stylesheet" type="text/css" href="libvirt.css" /><link rel="SHORTCUT ICON" href="/32favicon.png" /><title>Releases</title></head><body><div id="container"><div id="intro"><div id="adjustments"></div><div id="pageHeader"></div><div id="content2"><h1 class="style1">Releases</h1><p>Here is the list of official releases, however since it is early on in the
development of libvirt, it is preferable when possible to just use the <a href="downloads.html">CVS version or snapshot</a>, contact the mailing list
and check the <a href="ChangeLog.html">ChangeLog</a> to gauge progresses.</p><h3>0.1.6: Sep 5 2006</h3><ul><li>Support for localization of strings using gettext (Daniel Berrange)</li>
and check the <a href="ChangeLog.html">ChangeLog</a> to gauge progresses.</p><h3>0.1.7: Sep 29 2006</h3><ul><li> fix a memory bug on getting vcpu informations from xend (Daniel Berrange)</li>
<li> fix another problem in the hypercalls change in Xen changeset
86d26e6ec89b when getting domain informations (Daniel Berrange)</li>
</ul><h3>0.1.6: Sep 22 2006</h3><ul><li>Support for localization of strings using gettext (Daniel Berrange)</li>
<li>Support for new Xen-3.0.3 cdrom and disk configuration (Daniel Berrange)</li>
<li>Support for setting VNC port when creating domains with new
xend config files (Daniel Berrange) </li>

View File

@ -196,7 +196,7 @@ typedef virNodeInfo *virNodeInfoPtr;
* version * 1,000,000 + minor * 1000 + micro
*/
#define LIBVIR_VERSION_NUMBER 1006
#define LIBVIR_VERSION_NUMBER 1007
int virGetVersion (unsigned long *libVer,
const char *type,

View File

@ -111,6 +111,10 @@ rm -fr %{buildroot}
%doc docs/examples/python
%changelog
* Fri Sep 22 2007 Daniel Veillard <veillard@redhat.com> 0.1.7-1
- Fix bug when running against xen-3.0.3 hypercalls
- Fix memory bug when getting vcpus info from xend
* Fri Sep 22 2006 Daniel Veillard <veillard@redhat.com> 0.1.6-1
- Support for localization
- Support for new Xen-3.0.3 cdrom and disk configuration

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libvirt\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-09-21 17:03+0200\n"
"POT-Creation-Date: 2006-09-29 11:28+0200\n"
"PO-Revision-Date: 2006-09-20 10:20-0400\n"
"Last-Translator: Daniel Berrange <berrange@redhat.com>\n"
"Language-Team: English <en@li.org>\n"
@ -370,7 +370,7 @@ msgstr ""
#: src/hash.c:628 src/hash.c:634 src/test.c:725 src/test.c:750 src/test.c:773
#: src/test.c:797 src/xend_internal.c:1864 src/xend_internal.c:2560
#: src/xend_internal.c:2768 src/xs_internal.c:592 src/proxy_internal.c:790
#: src/xend_internal.c:2771 src/xs_internal.c:592 src/proxy_internal.c:790
#: src/proxy_internal.c:837 src/proxy_internal.c:888
msgid "allocating domain"
msgstr ""
@ -543,17 +543,17 @@ msgstr ""
msgid "failed to parse Xend domain information"
msgstr ""
#: src/xend_internal.c:2831
#: src/xend_internal.c:2834
#, c-format
msgid "Failed to create domain %s\n"
msgstr ""
#: src/xend_internal.c:2837
#: src/xend_internal.c:2840
#, c-format
msgid "Failed to get devices for domain %s\n"
msgstr ""
#: src/xend_internal.c:2848
#: src/xend_internal.c:2851
#, c-format
msgid "Failed to resume new domain %s\n"
msgstr ""
@ -1407,7 +1407,7 @@ msgstr ""
msgid "got asynchronous packet number %d\n"
msgstr ""
#: src/xen_internal.c:1241
#: src/xen_internal.c:1351
#, c-format
msgid "allocating %d domain info"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-09-21 17:03+0200\n"
"POT-Creation-Date: 2006-09-29 11:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -370,7 +370,7 @@ msgstr ""
#: src/hash.c:628 src/hash.c:634 src/test.c:725 src/test.c:750 src/test.c:773
#: src/test.c:797 src/xend_internal.c:1864 src/xend_internal.c:2560
#: src/xend_internal.c:2768 src/xs_internal.c:592 src/proxy_internal.c:790
#: src/xend_internal.c:2771 src/xs_internal.c:592 src/proxy_internal.c:790
#: src/proxy_internal.c:837 src/proxy_internal.c:888
msgid "allocating domain"
msgstr ""
@ -543,17 +543,17 @@ msgstr ""
msgid "failed to parse Xend domain information"
msgstr ""
#: src/xend_internal.c:2831
#: src/xend_internal.c:2834
#, c-format
msgid "Failed to create domain %s\n"
msgstr ""
#: src/xend_internal.c:2837
#: src/xend_internal.c:2840
#, c-format
msgid "Failed to get devices for domain %s\n"
msgstr ""
#: src/xend_internal.c:2848
#: src/xend_internal.c:2851
#, c-format
msgid "Failed to resume new domain %s\n"
msgstr ""
@ -1407,7 +1407,7 @@ msgstr ""
msgid "got asynchronous packet number %d\n"
msgstr ""
#: src/xen_internal.c:1241
#: src/xen_internal.c:1351
#, c-format
msgid "allocating %d domain info"
msgstr ""

View File

@ -99,13 +99,109 @@ struct xen_v0_getdomaininfo {
};
typedef struct xen_v0_getdomaininfo xen_v0_getdomaininfo;
struct xen_v0_getdomaininfolist {
struct xen_v2_getdomaininfo {
domid_t domain; /* the domain number */
uint32_t flags; /* falgs, see before */
uint64_t tot_pages; /* total number of pages used */
uint64_t max_pages; /* maximum number of pages allowed */
uint64_t shared_info_frame; /* MFN of shared_info struct */
uint64_t cpu_time; /* CPU time used */
uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
uint32_t ssidref;
xen_domain_handle_t handle;
};
typedef struct xen_v2_getdomaininfo xen_v2_getdomaininfo;
union xen_getdomaininfo {
struct xen_v0_getdomaininfo v0;
struct xen_v2_getdomaininfo v2;
};
typedef union xen_getdomaininfo xen_getdomaininfo;
union xen_getdomaininfolist {
struct xen_v0_getdomaininfo *v0;
struct xen_v2_getdomaininfo *v2;
};
typedef union xen_getdomaininfolist xen_getdomaininfolist;
#define XEN_GETDOMAININFOLIST_ALLOC(domlist, size) \
(hypervisor_version < 2 ? \
((domlist.v0 = malloc(sizeof(xen_v0_getdomaininfo)*(size))) != NULL) : \
((domlist.v2 = malloc(sizeof(xen_v2_getdomaininfo)*(size))) != NULL))
#define XEN_GETDOMAININFOLIST_FREE(domlist) \
(hypervisor_version < 2 ? \
free(domlist.v0) : \
free(domlist.v2))
#define XEN_GETDOMAININFOLIST_CLEAR(domlist, size) \
(hypervisor_version < 2 ? \
memset(domlist.v0, 0, sizeof(xen_v0_getdomaininfo) * size) : \
memset(domlist.v2, 0, sizeof(xen_v2_getdomaininfo) * size))
#define XEN_GETDOMAININFOLIST_DOMAIN(domlist, n) \
(hypervisor_version < 2 ? \
domlist.v0[n].domain : \
domlist.v2[n].domain)
#define XEN_GETDOMAININFO_CLEAR(dominfo) \
(hypervisor_version < 2 ? \
memset(&(dominfo.v0), 0, sizeof(xen_v0_getdomaininfo)) : \
memset(&(dominfo.v2), 0, sizeof(xen_v2_getdomaininfo)))
#define XEN_GETDOMAININFO_DOMAIN(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.domain : \
dominfo.v2.domain)
#define XEN_GETDOMAININFO_CPUTIME(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.cpu_time : \
dominfo.v2.cpu_time)
#define XEN_GETDOMAININFO_CPUCOUNT(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.nr_online_vcpus : \
dominfo.v2.nr_online_vcpus)
#define XEN_GETDOMAININFO_FLAGS(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.flags : \
dominfo.v2.flags)
#define XEN_GETDOMAININFO_TOT_PAGES(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.tot_pages : \
dominfo.v2.tot_pages)
#define XEN_GETDOMAININFO_MAX_PAGES(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.max_pages : \
dominfo.v2.max_pages)
struct xen_v0_getdomaininfolistop {
domid_t first_domain;
uint32_t max_domains;
struct xen_v0_getdomaininfo *buffer;
uint32_t num_domains;
};
typedef struct xen_v0_getdomaininfolist xen_v0_getdomaininfolist;
typedef struct xen_v0_getdomaininfolistop xen_v0_getdomaininfolistop;
struct xen_v2_getdomaininfolistop {
domid_t first_domain;
uint32_t max_domains;
struct xen_v2_getdomaininfo *buffer;
uint32_t num_domains;
};
typedef struct xen_v2_getdomaininfolistop xen_v2_getdomaininfolistop;
struct xen_v0_domainop {
domid_t domain;
@ -244,7 +340,7 @@ struct xen_op_v0 {
uint32_t cmd;
uint32_t interface_version;
union {
xen_v0_getdomaininfolist getdomaininfolist;
xen_v0_getdomaininfolistop getdomaininfolist;
xen_v0_domainop domain;
xen_v0_setmaxmem setmaxmem;
xen_v0_setmaxvcpu setmaxvcpu;
@ -261,7 +357,7 @@ struct xen_op_v2_sys {
uint32_t cmd;
uint32_t interface_version;
union {
xen_v0_getdomaininfolist getdomaininfolist;
xen_v2_getdomaininfolistop getdomaininfolist;
uint8_t padding[128];
} u;
};
@ -545,7 +641,7 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op)
*/
static int
virXen_getdomaininfolist(int handle, int first_domain, int maxids,
xen_v0_getdomaininfo *dominfos)
xen_getdomaininfolist *dominfos)
{
int ret = -1;
@ -561,7 +657,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
op.cmd = XEN_V2_OP_GETDOMAININFOLIST;
op.u.getdomaininfolist.first_domain = (domid_t) first_domain;
op.u.getdomaininfolist.max_domains = maxids;
op.u.getdomaininfolist.buffer = dominfos;
op.u.getdomaininfolist.buffer = dominfos->v2;
op.u.getdomaininfolist.num_domains = maxids;
ret = xenHypervisorDoV2Sys(handle, &op);
if (ret == 0)
@ -573,7 +669,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
op.cmd = XEN_V1_OP_GETDOMAININFOLIST;
op.u.getdomaininfolist.first_domain = (domid_t) first_domain;
op.u.getdomaininfolist.max_domains = maxids;
op.u.getdomaininfolist.buffer = dominfos;
op.u.getdomaininfolist.buffer = dominfos->v0;
op.u.getdomaininfolist.num_domains = maxids;
ret = xenHypervisorDoV1Op(handle, &op);
if (ret == 0)
@ -585,7 +681,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
op.cmd = XEN_V0_OP_GETDOMAININFOLIST;
op.u.getdomaininfolist.first_domain = (domid_t) first_domain;
op.u.getdomaininfolist.max_domains = maxids;
op.u.getdomaininfolist.buffer = dominfos;
op.u.getdomaininfolist.buffer = dominfos->v0;
op.u.getdomaininfolist.num_domains = maxids;
ret = xenHypervisorDoV0Op(handle, &op);
if (ret == 0)
@ -599,6 +695,21 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
return(ret);
}
static int
virXen_getdomaininfo(int handle, int first_domain,
xen_getdomaininfo *dominfo) {
xen_getdomaininfolist dominfos;
if (hypervisor_version < 2) {
dominfos.v0 = &(dominfo->v0);
} else {
dominfos.v2 = &(dominfo->v2);
}
return virXen_getdomaininfolist(handle, first_domain, 1, &dominfos);
}
#ifndef PROXY
/**
* virXen_pausedomain:
@ -998,7 +1109,7 @@ int xenHypervisorInit(void)
int fd, ret, cmd;
hypercall_t hc;
v0_hypercall_t v0_hc;
xen_v0_getdomaininfo info;
xen_getdomaininfo info;
if (initialized) {
if (hypervisor_version == -1)
@ -1073,7 +1184,7 @@ detect_v2:
/* TODO: one probably will need to autodetect thse subversions too */
sys_interface_version = 2; /* XEN_SYSCTL_INTERFACE_VERSION */
dom_interface_version = 3; /* XEN_DOMCTL_INTERFACE_VERSION */
if (virXen_getdomaininfolist(fd, 0, 1, &info) == 1) {
if (virXen_getdomaininfo(fd, 0, &info) == 1) {
#ifdef DEBUG
fprintf(stderr, "Using hypervisor call v2, sys version 2\n");
#endif
@ -1081,7 +1192,7 @@ detect_v2:
}
hypervisor_version = 1;
sys_interface_version = -1;
if (virXen_getdomaininfolist(fd, 0, 1, &info) == 1) {
if (virXen_getdomaininfo(fd, 0, &info) == 1) {
#ifdef DEBUG
fprintf(stderr, "Using hypervisor call v1\n");
#endif
@ -1227,7 +1338,7 @@ xenHypervisorGetVersion(virConnectPtr conn, unsigned long *hvVer)
int
xenHypervisorNumOfDomains(virConnectPtr conn)
{
xen_v0_getdomaininfo *dominfos;
xen_getdomaininfolist dominfos;
int ret, nbids;
static int last_maxids = 2;
int maxids = last_maxids;
@ -1236,18 +1347,17 @@ xenHypervisorNumOfDomains(virConnectPtr conn)
return (-1);
retry:
dominfos = malloc(maxids * sizeof(xen_v0_getdomaininfo));
if (dominfos == NULL) {
if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
virXenError(VIR_ERR_NO_MEMORY, _("allocating %d domain info"),
maxids);
return(-1);
}
memset(dominfos, 0, sizeof(xen_v0_getdomaininfo) * maxids);
XEN_GETDOMAININFOLIST_CLEAR(dominfos, maxids);
ret = virXen_getdomaininfolist(conn->handle, 0, maxids, dominfos);
ret = virXen_getdomaininfolist(conn->handle, 0, maxids, &dominfos);
free(dominfos);
XEN_GETDOMAININFOLIST_FREE(dominfos);
if (ret < 0)
return (-1);
@ -1276,41 +1386,40 @@ retry:
int
xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
{
xen_v0_getdomaininfo *dominfos;
xen_getdomaininfolist dominfos;
int ret, nbids, i;
if ((conn == NULL) || (conn->handle < 0) ||
(ids == NULL) || (maxids < 1))
return (-1);
dominfos = malloc(maxids * sizeof(xen_v0_getdomaininfo));
if (dominfos == NULL) {
if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
virXenError(VIR_ERR_NO_MEMORY, "allocating %d domain info",
maxids);
return(-1);
}
memset(dominfos, 0, sizeof(xen_v0_getdomaininfo) * maxids);
XEN_GETDOMAININFOLIST_CLEAR(dominfos, maxids);
memset(ids, 0, maxids * sizeof(int));
ret = virXen_getdomaininfolist(conn->handle, 0, maxids, dominfos);
ret = virXen_getdomaininfolist(conn->handle, 0, maxids, &dominfos);
if (ret < 0) {
free(dominfos);
XEN_GETDOMAININFOLIST_FREE(dominfos);
return (-1);
}
nbids = ret;
if ((nbids < 0) || (nbids > maxids)) {
free(dominfos);
XEN_GETDOMAININFOLIST_FREE(dominfos);
return(-1);
}
for (i = 0;i < nbids;i++) {
ids[i] = dominfos[i].domain;
ids[i] = XEN_GETDOMAININFOLIST_DOMAIN(dominfos, i);
}
free(dominfos);
XEN_GETDOMAININFOLIST_FREE(dominfos);
return (nbids);
}
@ -1327,21 +1436,20 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
unsigned long
xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
{
xen_v0_getdomaininfo dominfo;
xen_getdomaininfo dominfo;
int ret;
if ((conn == NULL) || (conn->handle < 0))
return (0);
memset(&dominfo, 0, sizeof(xen_v0_getdomaininfo));
XEN_GETDOMAININFO_CLEAR(dominfo);
dominfo.domain = id;
ret = virXen_getdomaininfolist(conn->handle, id, 1, &dominfo);
ret = virXen_getdomaininfo(conn->handle, id, &dominfo);
if ((ret < 0) || (dominfo.domain != id))
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != id))
return (0);
return((unsigned long) dominfo.max_pages * 4);
return((unsigned long) XEN_GETDOMAININFO_MAX_PAGES(dominfo) * 4);
}
#ifndef PROXY
@ -1379,21 +1487,21 @@ xenHypervisorGetMaxMemory(virDomainPtr domain)
int
xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
{
xen_v0_getdomaininfo dominfo;
xen_getdomaininfo dominfo;
int ret;
if ((conn == NULL) || (conn->handle < 0) || (info == NULL))
return (-1);
memset(info, 0, sizeof(virDomainInfo));
memset(&dominfo, 0, sizeof(xen_v0_getdomaininfo));
XEN_GETDOMAININFO_CLEAR(dominfo);
ret = virXen_getdomaininfolist(conn->handle, id, 1, &dominfo);
ret = virXen_getdomaininfo(conn->handle, id, &dominfo);
if ((ret < 0) || (dominfo.domain != id))
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != id))
return (-1);
switch (dominfo.flags & 0xFF) {
switch (XEN_GETDOMAININFO_FLAGS(dominfo) & 0xFF) {
case DOMFLAGS_DYING:
info->state = VIR_DOMAIN_SHUTDOWN;
break;
@ -1418,10 +1526,10 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
* convert to microseconds, same thing convert to
* kilobytes from page counts
*/
info->cpuTime = dominfo.cpu_time;
info->memory = dominfo.tot_pages * 4;
info->maxMem = dominfo.max_pages * 4;
info->nrVirtCpu = dominfo.nr_online_vcpus;
info->cpuTime = XEN_GETDOMAININFO_CPUTIME(dominfo);
info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * 4;
info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo) * 4;
info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
return (0);
}
@ -1615,12 +1723,12 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
*
* Returns the number of info filled in case of success, -1 in case of failure.
*/
#ifndef PROXY
int
xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
unsigned char *cpumaps, int maplen)
{
#ifndef PROXY
xen_v0_getdomaininfo dominfo;
xen_getdomaininfo dominfo;
int ret;
virVcpuInfoPtr ipt;
@ -1634,13 +1742,13 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
return -1;
/* first get the number of virtual CPUs in this domain */
memset(&dominfo, 0, sizeof(xen_v0_getdomaininfo));
ret = virXen_getdomaininfolist(domain->conn->handle, domain->handle,
1, &dominfo);
XEN_GETDOMAININFO_CLEAR(dominfo);
ret = virXen_getdomaininfo(domain->conn->handle, domain->handle,
&dominfo);
if ((ret < 0) || (dominfo.domain != domain->handle))
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->handle))
return (-1);
nbinfo = dominfo.max_vcpu_id + 1;
nbinfo = XEN_GETDOMAININFO_CPUCOUNT(dominfo) + 1;
if (nbinfo > maxinfo) nbinfo = maxinfo;
if (cpumaps != NULL)
@ -1662,7 +1770,14 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
}
}
return nbinfo;
#else
return(-1);
#endif
}
#endif
/*
* Local variables:
* indent-tabs-mode: nil
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 4
* End:
*/

View File

@ -2680,7 +2680,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
memset(cpumaps, 0, maxinfo * maplen);
/* scan the sexprs from "(vcpu (number x)...)" and get parameter values */
for (s = root; s->kind == SEXPR_CONS; s = s->cdr)
for (s = root; s->kind == SEXPR_CONS; s = s->cdr) {
if ((s->car->kind == SEXPR_CONS) &&
(s->car->car->kind == SEXPR_VALUE) &&
!strcmp(s->car->car->value, "vcpu")) {
@ -2690,7 +2690,8 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if (sexpr_int(t, "vcpu/running")) ipt->state = VIR_VCPU_RUNNING;
if (sexpr_int(t, "vcpu/blocked")) ipt->state = VIR_VCPU_BLOCKED;
}
else ipt->state = VIR_VCPU_OFFLINE;
else
ipt->state = VIR_VCPU_OFFLINE;
ipt->cpuTime = sexpr_float(t, "vcpu/cpu_time") * 1000000000;
ipt->cpu = oln ? sexpr_int(t, "vcpu/cpu") : -1;
@ -2708,9 +2709,10 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
for (t = t->car->cdr->car; t->kind == SEXPR_CONS; t = t->cdr)
if (t->car->kind == SEXPR_VALUE) {
cpu = strtol(t->car->value, NULL, 0);
if (cpu >= 0)
if (cpu >= 0 && (VIR_CPU_MAPLEN(cpu+1) <= maplen)) {
VIR_USE_CPU(cpumap, cpu);
}
}
break;
}
}
@ -2718,6 +2720,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if (++nbinfo == maxinfo) break;
ipt++;
}
}
sexpr_free(root);
return(nbinfo);
}