[dpdk-dev,v4] examples/vm_power_manager: fix libvirt dependency check

Message ID 1460370772-17663-1-git-send-email-thomas.monjalon@6wind.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Thomas Monjalon April 11, 2016, 10:32 a.m. UTC
  From: Marvin Liu <yong.liu@intel.com>

vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo to
retrieve domU vcpu information. This API is implemented from version 0.9.3.
Suse11 SP3 32bit default libvirt version is 0.8.8.

examples/vm_power_manager/channel_manager.c:
channel_manager.c:117:3: error: implicit declaration of function
‘virDomainGetVcpuPinInfo’

Check and skip it from examples or raise an error when trying to compile
without libvirt or with a too old libvirt.

Fixes: e8ae9b662 ("examples/vm_power: channel manager and monitor in host")

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 examples/Makefile                  | 4 ++++
 examples/vm_power_manager/Makefile | 6 ++++++
 2 files changed, 10 insertions(+)

v4: mix v2 and v3 to skip in examples list but raise an error if trying
    to compile directly
  

Comments

Bruce Richardson April 11, 2016, 10:37 a.m. UTC | #1
On Mon, Apr 11, 2016 at 12:32:52PM +0200, Thomas Monjalon wrote:
> From: Marvin Liu <yong.liu@intel.com>
> 
> vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo to
> retrieve domU vcpu information. This API is implemented from version 0.9.3.
> Suse11 SP3 32bit default libvirt version is 0.8.8.
> 
> examples/vm_power_manager/channel_manager.c:
> channel_manager.c:117:3: error: implicit declaration of function
> ‘virDomainGetVcpuPinInfo’
> 
> Check and skip it from examples or raise an error when trying to compile
> without libvirt or with a too old libvirt.
> 
> Fixes: e8ae9b662 ("examples/vm_power: channel manager and monitor in host")
> 
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
>  examples/Makefile                  | 4 ++++
>  examples/vm_power_manager/Makefile | 6 ++++++
>  2 files changed, 10 insertions(+)
> 
> v4: mix v2 and v3 to skip in examples list but raise an error if trying
>     to compile directly
> 
Yes, that is the correct way to fix it, I believe.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/examples/Makefile b/examples/Makefile
index a8bc381..fcf1eb7 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -87,6 +87,10 @@  DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += vhost
 DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen
 DIRS-y += vmdq
 DIRS-y += vmdq_dcb
+ifeq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager
+else
+$(info vm_power_manager requires libvirt >= 0.9.3)
+endif
 
 include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile
index 113dbc4..59a9641 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -29,6 +29,10 @@ 
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+ifneq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
+$(error vm_power_manager requires libvirt >= 0.9.3)
+else
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -57,3 +61,5 @@  CFLAGS_main.o += -Wno-return-type
 endif
 
 include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif # libvirt check