Remove udevadm from rootwrap

Use oslo.privsep for udevadm

Change-Id: Ib89354c9555c4b2c9f5a8331a788d7fe4ac46694
Signed-off-by: Chuck Short <chucks@redhat.com>
This commit is contained in:
Chuck Short 2018-09-18 11:35:26 -04:00
parent ab911c1b47
commit dd5f136442
3 changed files with 28 additions and 5 deletions

View File

@ -28,6 +28,7 @@ from oslo_utils import excutils
from six import moves
from cinder import exception
import cinder.privsep.lvm
from cinder import utils
@ -705,9 +706,7 @@ class LVM(executor.Executor):
"""
def run_udevadm_settle():
self._execute('udevadm', 'settle',
root_helper=self._root_helper, run_as_root=True,
check_exit_code=False)
cinder.privsep.lvm.udevadm_settle()
# LV removal seems to be a race with other writers or udev in
# some cases (see LP #1270192), so we enable retry deactivation

26
cinder/privsep/lvm.py Normal file
View File

@ -0,0 +1,26 @@
# Copyright 2018 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Helpers for lvm related routines
"""
from oslo_concurrency import processutils
import cinder.privsep
@cinder.privsep.sys_admin_pctxt.entrypoint
def udevadm_settle():
processutils.execute('udevadm', 'settle')

View File

@ -103,8 +103,6 @@ ln: CommandFilter, ln, root
qemu-img: EnvFilter, env, root, LC_ALL=C, qemu-img
qemu-img_convert: CommandFilter, qemu-img, root
udevadm: CommandFilter, udevadm, root
# cinder/volume/nfs.py
stat: CommandFilter, stat, root
mount: CommandFilter, mount, root