if not size_str:
size_str = self._calculate_thin_pool_size()
- cmd = ['lvcreate', '-T', '-L', size_str, vg_pool_name]
+ cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '-T', '-L', size_str,
+ vg_pool_name]
LOG.debug("Creating thin pool '%(pool)s' with size %(size)s of "
"total %(free)sg", {'pool': vg_pool_name,
'size': size_str,
if lv_type == 'thin':
pool_path = '%s/%s' % (self.vg_name, self.vg_thin_pool)
- cmd = ['lvcreate', '-T', '-V', size_str, '-n', name, pool_path]
+ cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '-T', '-V', size_str, '-n',
+ name, pool_path]
else:
- cmd = ['lvcreate', '-n', name, self.vg_name, '-L', size_str]
+ cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '-n', name, self.vg_name,
+ '-L', size_str]
if mirror_count > 0:
cmd.extend(['-m', mirror_count, '--nosync',
LOG.error(_LE("Trying to create snapshot by non-existent LV: %s"),
source_lv_name)
raise exception.VolumeDeviceNotFound(device=source_lv_name)
- cmd = ['lvcreate', '--name', name,
- '--snapshot', '%s/%s' % (self.vg_name, source_lv_name)]
+ cmd = LVM.LVM_CMD_PREFIX + ['lvcreate', '--name', name, '--snapshot',
+ '%s/%s' % (self.vg_name, source_lv_name)]
if lv_type != 'thin':
size = source_lvref['size']
cmd.extend(['-L', '%sg' % (size)])
if self.lv_has_snapshot(lv_name):
self.deactivate_lv(lv_name)
try:
- self._execute('lvextend', '-L', new_size,
- '%s/%s' % (self.vg_name, lv_name),
- root_helper=self._root_helper,
+ cmd = LVM.LVM_CMD_PREFIX + ['lvextend', '-L', new_size,
+ '%s/%s' % (self.vg_name, lv_name)]
+ self._execute(*cmd, root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error extending Volume'))
with mock.patch.object(self.vg, '_execute') as executor:
self.vg.pv_resize('fake-pv', '50G')
executor.assert_called_once_with(
+ 'env',
+ 'LC_ALL=C',
'pvresize',
'--setphysicalvolumesize',
'50G', 'fake-pv',
executor = mock.MagicMock()
self.thin_vg._execute = executor
self.thin_vg.extend_thin_pool()
- executor.assert_called_once_with('lvextend',
+ executor.assert_called_once_with('env', 'LC_ALL=C', 'lvextend',
'-L', '9.5g',
'fake-vg/fake-vg-pool',
root_helper=self.vg._root_helper,
return 'lvcreate, -T, -L, ' in cmd_string
def act(cmd):
- vgname = cmd[4].split('/')[0]
- lvname = cmd[4].split('/')[1]
- if cmd[3][-1] == 'g':
- lv_size = int(float(cmd[3][0:-1]) * units.Gi)
- elif cmd[3][-1] == 'B':
- lv_size = int(cmd[3][0:-1])
+ vgname = cmd[6].split('/')[0]
+ lvname = cmd[6].split('/')[1]
+ if cmd[5][-1] == 'g':
+ lv_size = int(float(cmd[5][0:-1]) * units.Gi)
+ elif cmd[5][-1] == 'B':
+ lv_size = int(cmd[5][0:-1])
else:
- lv_size = int(cmd[3])
+ lv_size = int(cmd[5])
self._volumes[vgname]['vgs'][vgname]['lvs'][lvname] = lv_size
return check, act
def act(cmd):
cmd_string = ', '.join(cmd)
- vgname = cmd[6].split('/')[0]
- poolname = cmd[6].split('/')[1]
- lvname = cmd[5]
+ vgname = cmd[8].split('/')[0]
+ poolname = cmd[8].split('/')[1]
+ lvname = cmd[7]
if poolname not in self._volumes[vgname]['vgs'][vgname]['lvs']:
raise AssertionError('thin-lv creation attempted before '
'thin-pool creation: %s'
% cmd_string)
- if cmd[3][-1] == 'g':
- lv_size = int(float(cmd[3][0:-1]) * units.Gi)
- elif cmd[3][-1] == 'B':
- lv_size = int(cmd[3][0:-1])
+ if cmd[5][-1] == 'g':
+ lv_size = int(float(cmd[5][0:-1]) * units.Gi)
+ elif cmd[5][-1] == 'B':
+ lv_size = int(cmd[5][0:-1])
else:
- lv_size = int(cmd[3])
+ lv_size = int(cmd[5])
self._volumes[vgname]['vgs'][vgname]['lvs'][lvname] = lv_size
return check, act
def act(cmd):
cmd_string = ', '.join(cmd)
- vgname = cmd[4].split('/')[0]
- lvname = cmd[4].split('/')[1]
- snapname = cmd[2]
+ vgname = cmd[6].split('/')[0]
+ lvname = cmd[6].split('/')[1]
+ snapname = cmd[4]
if lvname not in self._volumes[vgname]['vgs'][vgname]['lvs']:
raise AssertionError('snap creation attempted on non-existent '
'thin-lv: %s' % cmd_string)
def act(cmd):
cmd_string = ', '.join(cmd)
- vgname = cmd[3].split('/')[0]
- lvname = cmd[3].split('/')[1]
- if cmd[2][-1] == 'g':
- size = int(float(cmd[2][0:-1]) * units.Gi)
- elif cmd[2][-1] == 'B':
- size = int(cmd[2][0:-1])
+ vgname = cmd[5].split('/')[0]
+ lvname = cmd[5].split('/')[1]
+ if cmd[4][-1] == 'g':
+ size = int(float(cmd[4][0:-1]) * units.Gi)
+ elif cmd[4][-1] == 'B':
+ size = int(cmd[4][0:-1])
else:
- size = int(cmd[2])
+ size = int(cmd[4])
if vgname not in self._volumes:
raise AssertionError('Cannot extend inexistant volume'
': %s' % cmd_string)
:raises: putils.ProcessExecutionError
"""
try:
- self._execute('pvresize',
- '--setphysicalvolumesize', new_size_str,
- pv_name,
- root_helper=self._root_helper,
+ cmd = lvm.LVM.LVM_CMD_PREFIX + ['pvresize',
+ '--setphysicalvolumesize',
+ new_size_str, pv_name]
+ self._execute(*cmd, root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
LOG.exception(_LE('Error resizing Physical Volume'))
new_size_str = self._calculate_thin_pool_size()
try:
- self._execute('lvextend',
- '-L', new_size_str,
- "%s/%s-pool" % (self.vg_name, self.vg_name),
+ cmd = lvm.LVM.LVM_CMD_PREFIX + ['lvextend', '-L', new_size_str,
+ "%s/%s-pool" % (self.vg_name,
+ self.vg_name)]
+ self._execute(*cmd,
root_helper=self._root_helper,
run_as_root=True)
except putils.ProcessExecutionError as err:
scsi_id: CommandFilter, /lib/udev/scsi_id, root
# cinder/volumes/drivers/srb.py: 'pvresize', '--setphysicalvolumesize', sizestr, pvname
-pvresize: CommandFilter, pvresize, root
+pvresize: EnvFilter, env, root, LC_ALL=C, pvresize
+pvresize_lvmconf: EnvFilter, env, root, LVM_SYSTEM_DIR=, LC_ALL=C, pvresize
# cinder/brick/local_dev/lvm.py: 'vgcreate', vg_name, pv_list
vgcreate: CommandFilter, vgcreate, root
# cinder/volumes/drivers/srb.py: 'vgchange', '-ay', vgname
vgchange: CommandFilter, vgchange, root
-# cinder/volume/driver.py: 'lvcreate', '-L', sizestr, '-n', volume_name,..
-# cinder/volume/driver.py: 'lvcreate', '-L', ...
-lvcreate: CommandFilter, lvcreate, root
+# cinder/brick/local_dev/lvm.py: 'lvcreate', '-L', sizestr, '-n', volume_name,..
+# cinder/brick/local_dev/lvm.py: 'lvcreate', '-L', ...
+lvcreate: EnvFilter, env, root, LC_ALL=C, lvcreate
+lvcreate_lvmconf: EnvFilter, env, root, LVM_SYSTEM_DIR=, LC_ALL=C, lvcreate
# cinder/volume/driver.py: 'dd', 'if=%s' % srcstr, 'of=%s' % deststr,...
dd: CommandFilter, dd, root
# cinder/volume/driver.py: 'lvrename', '%(vg)s', '%(orig)s' '(new)s'...
lvrename: CommandFilter, lvrename, root
-# cinder/volume/driver.py: 'lvextend', '-L' '%(new_size)s', '%(lv_name)s' ...
-# cinder/volume/driver.py: 'lvextend', '-L' '%(new_size)s', '%(thin_pool)s' ...
-lvextend: CommandFilter, lvextend, root
+# cinder/brick/local_dev/lvm.py: 'lvextend', '-L' '%(new_size)s', '%(lv_name)s' ...
+# cinder/brick/local_dev/lvm.py: 'lvextend', '-L' '%(new_size)s', '%(thin_pool)s' ...
+lvextend: EnvFilter, env, root, LC_ALL=C, lvextend
+lvextend_lvmconf: EnvFilter, env, root, LVM_SYSTEM_DIR=, LC_ALL=C, lvextend
# cinder/brick/local_dev/lvm.py: 'lvchange -a y -K <lv>'
lvchange: CommandFilter, lvchange, root
--- /dev/null
+---
+upgrade:
+ - It is required to copy new rootwrap.d/volume.filters file into /etc/cinder/rootwrap.d directory.
+fixes:
+ - Fixed bug causing snapshot creation to fail on systems with LC_NUMERIC set to locale using ',' as decimal separator.