DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/vm_power_manager: fix build when libvirt version < 1.0
@ 2015-12-07  7:24 Yong Liu
  2015-12-07 22:46 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Yong Liu @ 2015-12-07  7:24 UTC (permalink / raw)
  To: dev

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 <yong.liu@intel.com>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-07 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07  7:24 [dpdk-dev] [PATCH] examples/vm_power_manager: fix build when libvirt version < 1.0 Yong Liu
2015-12-07 22:46 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).