diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index 69636bbf445..3455a6af6e3 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -860,9 +860,7 @@ class LVM(executor.Executor): """Change the name of an existing volume.""" try: - self._execute('lvrename', self.vg_name, lv_name, new_name, - root_helper=self._root_helper, - run_as_root=True) + cinder.privsep.lvm.lvrename(self.vg_name, lv_name, new_name) except putils.ProcessExecutionError as err: LOG.exception('Error renaming logical volume') LOG.error('Cmd :%s', err.cmd) diff --git a/cinder/privsep/lvm.py b/cinder/privsep/lvm.py index a460520dbe9..aeb47fd6a44 100644 --- a/cinder/privsep/lvm.py +++ b/cinder/privsep/lvm.py @@ -24,3 +24,9 @@ import cinder.privsep @cinder.privsep.sys_admin_pctxt.entrypoint def udevadm_settle(): processutils.execute('udevadm', 'settle') + + +@cinder.privsep.sys_admin_pctxt.entrypoint +def lvrename(vg_name, lv_name, new_name): + processutils.execute( + 'lvrename', vg_name, lv_name, new_name) diff --git a/etc/cinder/rootwrap.d/volume.filters b/etc/cinder/rootwrap.d/volume.filters index aea64036cf2..56204440f89 100644 --- a/etc/cinder/rootwrap.d/volume.filters +++ b/etc/cinder/rootwrap.d/volume.filters @@ -62,9 +62,6 @@ dd: CommandFilter, dd, root # cinder/volume/driver.py: 'lvremove', '-f', %s/%s % ... lvremove: CommandFilter, lvremove, root -# cinder/volume/driver.py: 'lvrename', '%(vg)s', '%(orig)s' '(new)s'... -lvrename: CommandFilter, lvrename, 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