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
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