From ccd4c2e1775a214967ca287729facfc21bd4e59d Mon Sep 17 00:00:00 2001
From: Chris Dent <chdent@redhat.com>
Date: Wed, 17 Jun 2015 16:42:43 +0000
Subject: [PATCH] Install python-libvirt for ceilometer only if n-cpu enabled

Nova is responsible for installing the libvirt package (if it is being
used). It is required by python-libvirt but python-libvirt only required
in ceilometer if nova compute is being used. There are some usage
scenarios where nova compute is not being used so in that case don't
install python-libvirt.

Change-Id: I0db66f1c0526e24ade98de85989a5ed8d37f0c4f
---
 lib/ceilometer | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/ceilometer b/lib/ceilometer
index 90c7705743..a577ee9ca8 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -334,12 +334,15 @@ function install_ceilometer {
         pip_install_gr pymongo
     fi
 
-    if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
-        pip_install_gr libvirt-python
-    fi
+    # Only install virt drivers if we're running nova compute
+    if is_service_enabled n-cpu ; then
+        if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
+            pip_install_gr libvirt-python
+        fi
 
-    if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
-        pip_instal_gr oslo.vmware
+        if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
+            pip_instal_gr oslo.vmware
+        fi
     fi
 
     if [ "$CEILOMETER_BACKEND" = 'es' ] ; then