From 6f05f11945ddb4378e29be2e3bc923ebe07b035e Mon Sep 17 00:00:00 2001 From: Fergal Mc Carthy Date: Tue, 22 Sep 2015 17:24:25 -0400 Subject: [PATCH] Use lvm_conf_file directory for LVM_SYSTEM_DIR value. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index 509086e46..b4d832e55 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -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 -- 2.45.2