DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] examples/vm_power_manager: fix build when libvirt version < 1.0
Date: Mon,  7 Dec 2015 15:24:17 +0800	[thread overview]
Message-ID: <1449473057-16921-1-git-send-email-yong.liu@intel.com> (raw)

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

             reply	other threads:[~2015-12-07  7:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07  7:24 Yong Liu [this message]
2015-12-07 22:46 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449473057-16921-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).