Merge "Remove umount from volume.filters"

This commit is contained in:
Zuul 2018-12-20 17:03:45 +00:00 committed by Gerrit Code Review
commit ea844fbee8
3 changed files with 31 additions and 2 deletions

29
cinder/privsep/fs.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright 2018 Red Hat, Inc
# Copyright 2017 Rackspace Australia
# Copyright 2018 Michael Still and Aptira
#
# 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 filesystem related routines.
"""
from oslo_concurrency import processutils
import cinder.privsep
@cinder.privsep.sys_admin_pctxt.entrypoint
def umount(mountpoint):
processutils.execute('umount', mountpoint, attempts=1, delay_on_retry=True)

View File

@ -28,6 +28,7 @@ from cinder import db
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
import cinder.privsep.fs
from cinder.volume.drivers.nexenta import jsonrpc from cinder.volume.drivers.nexenta import jsonrpc
from cinder.volume.drivers.nexenta import options from cinder.volume.drivers.nexenta import options
from cinder.volume.drivers.nexenta import utils from cinder.volume.drivers.nexenta import utils
@ -451,7 +452,7 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921
mount_path = self.remote_path(volume).strip( mount_path = self.remote_path(volume).strip(
'/%s' % self.VOLUME_FILE_NAME) '/%s' % self.VOLUME_FILE_NAME)
if mount_path in self._remotefsclient._read_mounts(): if mount_path in self._remotefsclient._read_mounts():
self._execute('umount', mount_path, run_as_root=True) cinder.privsep.fs.umount(mount_path)
try: try:
props = nms.folder.get_child_props(folder, 'origin') or {} props = nms.folder.get_child_props(folder, 'origin') or {}
nms.folder.destroy(folder, '-r') nms.folder.destroy(folder, '-r')

View File

@ -114,7 +114,6 @@ netapp_nfs_find: RegExpFilter, find, root, find, ^[/]*([^/\0]+(/+)?)*$, -maxdept
# cinder/volume/drivers/glusterfs.py # cinder/volume/drivers/glusterfs.py
chgrp: CommandFilter, chgrp, root chgrp: CommandFilter, chgrp, root
umount: CommandFilter, umount, root
# cinder/brick/initiator/connector.py: # cinder/brick/initiator/connector.py:
ls: CommandFilter, ls, root ls: CommandFilter, ls, root