mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
Fix nodeinfo compat for Xen 3.2.0
This commit is contained in:
parent
e8d690aeb5
commit
e05a879022
@ -1,3 +1,8 @@
|
||||
Sun Jan 20 10:54:22 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/xend_internal.c: Fix nodeinfo compat with Xen 3.2.0 and
|
||||
add sanity checking of data
|
||||
|
||||
Sat Jan 19 13:32:22 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/configure.in: enable debug by default. print status of
|
||||
|
@ -1910,6 +1910,9 @@ sexpr_to_xend_node_info(struct sexpr *root, virNodeInfoPtr info)
|
||||
info->mhz = sexpr_int(root, "node/cpu_mhz");
|
||||
info->nodes = sexpr_int(root, "node/nr_nodes");
|
||||
info->sockets = sexpr_int(root, "node/sockets_per_node");
|
||||
info->cores = sexpr_int(root, "node/cores_per_socket");
|
||||
info->threads = sexpr_int(root, "node/threads_per_core");
|
||||
|
||||
/* Xen 3.2.0 replaces sockets_per_node with 'nr_cpus'.
|
||||
* Old Xen calculated sockets_per_node using its internal
|
||||
* nr_cpus / (nodes*cores*threads), so fake it ourselves
|
||||
@ -1917,15 +1920,16 @@ sexpr_to_xend_node_info(struct sexpr *root, virNodeInfoPtr info)
|
||||
*/
|
||||
if (info->sockets == 0) {
|
||||
int nr_cpus = sexpr_int(root, "node/nr_cpus");
|
||||
info->sockets = nr_cpus / (info->nodes * info->cores * info->threads);
|
||||
/* Should already be fine, but for sanity make
|
||||
int procs = info->nodes * info->cores * info->threads;
|
||||
if (procs == 0) /* Sanity check in case of Xen bugs in futures..*/
|
||||
return (-1);
|
||||
info->sockets = nr_cpus / procs;
|
||||
/* Should already be fine, but for further sanity make
|
||||
* sure we have at least one socket
|
||||
*/
|
||||
if (info->sockets == 0)
|
||||
info->sockets = 1;
|
||||
}
|
||||
info->cores = sexpr_int(root, "node/cores_per_socket");
|
||||
info->threads = sexpr_int(root, "node/threads_per_core");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user