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
This commit is contained in:
Fergal Mc Carthy 2015-09-22 17:24:25 -04:00
parent 7fb767f2d6
commit 6f05f11945
1 changed files with 4 additions and 2 deletions

View 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