]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use lvm_conf_file directory for LVM_SYSTEM_DIR value.
authorFergal Mc Carthy <fergal.mccarthy@hpe.com>
Tue, 22 Sep 2015 21:24:25 +0000 (17:24 -0400)
committerFergal Mc Carthy <fergal.mccarthy@hpe.com>
Tue, 13 Oct 2015 17:17:35 +0000 (13:17 -0400)
Currently when LVM_SYSTEM_DIR is added to LVM.LVM_CMD_PREFIX it is
hardcoded as /etc/cinder.

However the configuration option lvm_conf_file could specify a file
located in an arbitrary directory, not just /etc/cinder, so we should
be using the path to the directory containing the specified lvm.conf
file as the value for LVM_SYSTEM_DIR.

Change-Id: I702fdfb3640ef99255fda0fda4d39d0a80ce9dcc
Closes-Bug: #1498651

cinder/brick/local_dev/lvm.py

index 509086e46e71d5bcea9b4c01efc67238f82e239b..b4d832e5589aafeddbeab4f755add9406a75637b 100644 (file)
@@ -72,11 +72,13 @@ class LVM(executor.Executor):
         self.vg_provisioned_capacity = 0.0
 
         # Ensure LVM_SYSTEM_DIR has been added to LVM.LVM_CMD_PREFIX
-        # before the first LVM command is executed.
+        # before the first LVM command is executed, and use the directory
+        # where the specified lvm_conf file is located as the value.
         if lvm_conf and os.path.isfile(lvm_conf):
+            lvm_sys_dir = os.path.dirname(lvm_conf)
             LVM.LVM_CMD_PREFIX = ['env',
                                   'LC_ALL=C',
-                                  'LVM_SYSTEM_DIR=/etc/cinder']
+                                  'LVM_SYSTEM_DIR=' + lvm_sys_dir]
 
         if create_vg and physical_volumes is not None:
             self.pv_list = physical_volumes