From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5B0FC957B for ; Mon, 7 Dec 2015 08:24:24 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 06 Dec 2015 23:24:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,393,1444719600"; d="scan'208";a="868112902" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 06 Dec 2015 23:24:22 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id tB77OKNE014510; Mon, 7 Dec 2015 15:24:20 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id tB77OIwZ016957; Mon, 7 Dec 2015 15:24:20 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id tB77OITA016953; Mon, 7 Dec 2015 15:24:18 +0800 From: Yong Liu To: dev@dpdk.org Date: Mon, 7 Dec 2015 15:24:17 +0800 Message-Id: <1449473057-16921-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] examples/vm_power_manager: fix build when libvirt version < 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 07:24:24 -0000 virNodeGetCPUMap introduced in from libvirt 1.0. In some linux distributions like Ubuntu12/14 and Fedora18, libvirt version is elder than 1.0. So this sample will not build pass. Replace "virNodeGetCPUMap" with another libvirt API "virNodeGetInfo". Signed-off-by: Marvin Liu 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 " -- 1.9.3