提交 e05a8790 编写于 作者: D Daniel P. Berrange

Fix nodeinfo compat for Xen 3.2.0

上级 e8d690ae
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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册