File 0001-Robustify-skipactivation-detection.patch of Package openstack-cinder

From 32404788855746fe13a6be0b63158fcd434c9d0e Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Wed, 15 Jan 2014 15:45:01 +0100
Subject: [PATCH] Robustify skipactivation detection

When lvchange is not in the $PATH for non-root user,
this code otherwise traces.

Change-Id: I308bd97cb729e83677f18a693274265a182d794c
Closes-Bug: #1269445
---
 cinder/brick/local_dev/lvm.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: cinder-2013.2.4.dev25.gdd70877/cinder/brick/local_dev/lvm.py
===================================================================
--- cinder-2013.2.4.dev25.gdd70877.orig/cinder/brick/local_dev/lvm.py
+++ cinder-2013.2.4.dev25.gdd70877/cinder/brick/local_dev/lvm.py
@@ -228,11 +228,16 @@ class LVM(executor.Executor):
         if self._supports_lvchange_ignoreskipactivation is not None:
             return self._supports_lvchange_ignoreskipactivation
 
-        cmd = ['lvchange', '--help']
-        (out, err) = self._execute(*cmd)
-
         self._supports_lvchange_ignoreskipactivation = False
 
+        try:
+            cmd = ['lvchange', '--help']
+            (out, err) = self._execute(
+                *cmd, root_helper=self._root_helper, run_as_root=True)
+        except (putils.ProcessExecutionError, OSError):
+            LOG.debug(_("Ignoring error during testing whether lvchange "
+                        "can ignore skip activation"))
+
         lines = out.split('\n')
         for line in lines:
             if '-K' in line and '--ignoreactivationskip' in line:
openSUSE Build Service is sponsored by