From 380d92cc7a0601d89e40d311172e7e3ee4a58640 Mon Sep 17 00:00:00 2001
From: Attila Fazekas <afazekas@redhat.com>
Date: Wed, 18 Feb 2015 16:22:06 +0100
Subject: [PATCH] Ensure lvm2-lvmetad service running on Fedora

When the lvm package gets installed the meta service does
not gets started automatically, but it becomes enabled so it would be
running on the next reboot.

The lvm commands are configured to use this service.
In the past this issue just causes warnings in the cinder log,
but now it can lead to a real issue.

It is better to ensure it is really running,
because it speeds up the lvm related commands.

Change-Id: I17fe2c3bcf77a6505ed2b6c824c5b20807beb725
---
 lib/lvm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/lvm b/lib/lvm
index c183f09d04..39eed00675 100644
--- a/lib/lvm
+++ b/lib/lvm
@@ -103,14 +103,17 @@ function _create_lvm_volume_group {
 function init_lvm_volume_group {
     local vg=$1
     local size=$2
-    # Start with a clean volume group
-    _create_lvm_volume_group $vg $size
 
+    # Start the lvmetad and tgtd services
     if is_fedora || is_suse; then
-        # service is not started by default
+        # services is not started by default
+        start_service lvm2-lvmetad
         start_service tgtd
     fi
 
+    # Start with a clean volume group
+    _create_lvm_volume_group $vg $size
+
     # Remove iscsi targets
     sudo tgtadm --op show --mode target | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true