Browse Source

Replace 'lvconvert' from rootwrap

Use oslo.privsep to run the lvconvert command.

Change-Id: I6c2dce7beb1c3f8bb777066f62ced134f763e640
Signed-off-by: Charles Short <chucks@redhat.com>
changes/20/634020/4
Charles Short 3 years ago
parent
commit
ec6eaa21fd
  1. 4
      cinder/brick/local_dev/lvm.py
  2. 6
      cinder/privsep/lvm.py
  3. 3
      etc/cinder/rootwrap.d/volume.filters

4
cinder/brick/local_dev/lvm.py

@ -747,10 +747,8 @@ class LVM(executor.Executor):
:param snapshot_name: Name of snapshot to revert
"""
cmd = ['lvconvert', '--merge', '%s/%s' % (self.vg_name, snapshot_name)]
try:
self._execute(*cmd, root_helper=self._root_helper,
run_as_root=True)
cinder.privsep.lvm.lvconvert(self.vg_name, snapshot_name)
except putils.ProcessExecutionError as err:
LOG.exception('Error Revert Volume')
LOG.error('Cmd :%s', err.cmd)

6
cinder/privsep/lvm.py

@ -36,3 +36,9 @@ def lvrename(vg_name, lv_name, new_name):
def create_vg(vg_name, pv_list):
cmd = ['vgcreate', vg_name, ','.join(pv_list)]
processutils.execute(*cmd)
@cinder.privsep.sys_admin_pctxt.entrypoint
def lvconvert(vg_name, snapshot_name):
processutils.execute(
'lvconvert', '--merge', '%s/%s' % (vg_name, snapshot_name))

3
etc/cinder/rootwrap.d/volume.filters

@ -68,9 +68,6 @@ lvextend_lvmconf_fdwarn: EnvFilter, env, root, LVM_SYSTEM_DIR=, LC_ALL=C, LVM_SU
# cinder/brick/local_dev/lvm.py: 'lvchange -a y -K <lv>'
lvchange: CommandFilter, lvchange, root
# cinder/brick/local_dev/lvm.py: 'lvconvert', '--merge', snapshot_name
lvconvert: CommandFilter, lvconvert, root
# cinder/volume/driver.py: 'iscsiadm', '-m', 'discovery', '-t',...
# cinder/volume/driver.py: 'iscsiadm', '-m', 'node', '-T', ...
iscsiadm: CommandFilter, iscsiadm, root

Loading…
Cancel
Save