summaryrefslogtreecommitdiff
path: root/examples/vm_power_manager
diff options
context:
space:
mode:
authorYong Liu <yong.liu@intel.com>2015-12-07 15:24:17 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-12-08 00:09:43 +0100
commitf7f14fe390cae1705fef8372e1df4ff61ce24fd2 (patch)
treea355e71c794dab914231fda9f9b8c7ae91f95441 /examples/vm_power_manager
parent3f3d601071a7148a5fb3b4a843716fff7f2fdc1c (diff)
downloaddpdk-f7f14fe390cae1705fef8372e1df4ff61ce24fd2.zip
dpdk-f7f14fe390cae1705fef8372e1df4ff61ce24fd2.tar.gz
dpdk-f7f14fe390cae1705fef8372e1df4ff61ce24fd2.tar.xz
examples/vm_power_manager: fix build with libvirt < 1.0
virNodeGetCPUMap introduced in libvirt 1.0. In some linux distributions like Ubuntu12/14 and Fedora18, libvirt version is older than 1.0. So this sample will not build pass. Replace "virNodeGetCPUMap" with another libvirt API "virNodeGetInfo". Signed-off-by: Marvin Liu <yong.liu@intel.com>
Diffstat (limited to 'examples/vm_power_manager')
-rw-r--r--examples/vm_power_manager/channel_manager.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index db76f2e..ceaf95d 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -734,7 +734,7 @@ connect_hypervisor(const char *path)
int
channel_manager_init(const char *path)
{
- int n_cpus;
+ virNodeInfo info;
LIST_INIT(&vm_list_head);
if (connect_hypervisor(path) < 0) {
@@ -756,13 +756,12 @@ channel_manager_init(const char *path)
goto error;
}
- n_cpus = virNodeGetCPUMap(global_vir_conn_ptr, NULL, NULL, 0);
- if (n_cpus <= 0) {
- RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to get the number of Host "
- "CPUs\n");
+ if (virNodeGetInfo(global_vir_conn_ptr, &info)) {
+ RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to retrieve node Info\n");
goto error;
}
- global_n_host_cpus = (unsigned)n_cpus;
+
+ global_n_host_cpus = (unsigned)info.cpus;
if (global_n_host_cpus > CHANNEL_CMDS_MAX_CPUS) {
RTE_LOG(WARNING, CHANNEL_MANAGER, "The number of host CPUs(%u) exceeds the "