import os
import stat
+from oslo.concurrency import processutils
from oslo.config import cfg
from cinder.backup.driver import BackupDriver
from cinder import exception
from cinder.i18n import _LE, _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
LOG = logging.getLogger(__name__)
and root_helper settings, so this provides that hook.
"""
-from cinder.openstack.common import processutils as putils
+from oslo.concurrency import processutils as putils
class Executor(object):
import socket
import time
+from oslo.concurrency import lockutils
+from oslo.concurrency import processutils as putils
+
from cinder.brick import exception
from cinder.brick import executor
from cinder.brick.initiator import host_driver
from cinder.brick.initiator import linuxscsi
from cinder.brick.remotefs import remotefs
from cinder.i18n import _, _LE
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
-from cinder.openstack.common import processutils as putils
LOG = logging.getLogger(__name__)
import errno
+from oslo.concurrency import processutils as putils
+
from cinder.brick.initiator import linuxscsi
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
LOG = logging.getLogger(__name__)
import os
import re
+from oslo.concurrency import processutils as putils
+
from cinder.brick import executor
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
LOG = logging.getLogger(__name__)
import stat
import time
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
import six
from cinder.i18n import _, _LE, _LI, _LW
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder import utils
LOG = logging.getLogger(__name__)
import re
import time
+from oslo.concurrency import processutils as putils
from oslo.utils import excutils
from cinder.brick import exception
from cinder.brick import executor
from cinder.i18n import _, _LE, _LW
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
LOG = logging.getLogger(__name__)
import os
import re
+from oslo.concurrency import processutils as putils
import six
from cinder.brick import exception
from cinder.i18n import _, _LI
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
LOG = logging.getLogger(__name__)
import os
import tempfile
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import timeutils
from oslo.utils import units
from cinder.openstack.common import fileutils
from cinder.openstack.common import imageutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume import utils as volume_utils
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 OpenStack Foundation.
-# All Rights Reserved.
-#
-# 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.
-
-
-import errno
-import functools
-import os
-import shutil
-import tempfile
-import time
-import weakref
-
-from eventlet import semaphore
-from oslo.config import cfg
-
-from cinder.openstack.common import fileutils
-from cinder.openstack.common.gettextutils import _
-from cinder.openstack.common import local
-from cinder.openstack.common import log as logging
-
-
-LOG = logging.getLogger(__name__)
-
-
-util_opts = [
- cfg.BoolOpt('disable_process_locking', default=False,
- help='Whether to disable inter-process locks'),
- cfg.StrOpt('lock_path',
- help=('Directory to use for lock files. Default to a '
- 'temp directory'))
-]
-
-
-CONF = cfg.CONF
-CONF.register_opts(util_opts)
-
-
-def set_defaults(lock_path):
- cfg.set_defaults(util_opts, lock_path=lock_path)
-
-
-class _InterProcessLock(object):
- """Lock implementation which allows multiple locks, working around
- issues like bugs.debian.org/cgi-bin/bugreport.cgi?bug=632857 and does
- not require any cleanup. Since the lock is always held on a file
- descriptor rather than outside of the process, the lock gets dropped
- automatically if the process crashes, even if __exit__ is not executed.
-
- There are no guarantees regarding usage by multiple green threads in a
- single process here. This lock works only between processes. Exclusive
- access between local threads should be achieved using the semaphores
- in the @synchronized decorator.
-
- Note these locks are released when the descriptor is closed, so it's not
- safe to close the file descriptor while another green thread holds the
- lock. Just opening and closing the lock file can break synchronisation,
- so lock files must be accessed only using this abstraction.
- """
-
- def __init__(self, name):
- self.lockfile = None
- self.fname = name
-
- def __enter__(self):
- self.lockfile = open(self.fname, 'w')
-
- while True:
- try:
- # Using non-blocking locks since green threads are not
- # patched to deal with blocking locking calls.
- # Also upon reading the MSDN docs for locking(), it seems
- # to have a laughable 10 attempts "blocking" mechanism.
- self.trylock()
- return self
- except IOError as e:
- if e.errno in (errno.EACCES, errno.EAGAIN):
- # external locks synchronise things like iptables
- # updates - give it some time to prevent busy spinning
- time.sleep(0.01)
- else:
- raise
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- try:
- self.unlock()
- self.lockfile.close()
- except IOError:
- LOG.exception(_("Could not release the acquired lock `%s`"),
- self.fname)
-
- def trylock(self):
- raise NotImplementedError()
-
- def unlock(self):
- raise NotImplementedError()
-
-
-class _WindowsLock(_InterProcessLock):
- def trylock(self):
- msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_NBLCK, 1)
-
- def unlock(self):
- msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_UNLCK, 1)
-
-
-class _PosixLock(_InterProcessLock):
- def trylock(self):
- fcntl.lockf(self.lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
-
- def unlock(self):
- fcntl.lockf(self.lockfile, fcntl.LOCK_UN)
-
-
-if os.name == 'nt':
- import msvcrt
- InterProcessLock = _WindowsLock
-else:
- import fcntl
- InterProcessLock = _PosixLock
-
-_semaphores = weakref.WeakValueDictionary()
-
-
-def synchronized(name, lock_file_prefix, external=False, lock_path=None):
- """Synchronization decorator.
-
- Decorating a method like so::
-
- @synchronized('mylock')
- def foo(self, *args):
- ...
-
- ensures that only one thread will execute the foo method at a time.
-
- Different methods can share the same lock::
-
- @synchronized('mylock')
- def foo(self, *args):
- ...
-
- @synchronized('mylock')
- def bar(self, *args):
- ...
-
- This way only one of either foo or bar can be executing at a time.
-
- :param lock_file_prefix: The lock_file_prefix argument is used to provide
- lock files on disk with a meaningful prefix. The prefix should end with a
- hyphen ('-') if specified.
-
- :param external: The external keyword argument denotes whether this lock
- should work across multiple processes. This means that if two different
- workers both run a method decorated with @synchronized('mylock',
- external=True), only one of them will execute at a time.
-
- :param lock_path: The lock_path keyword argument is used to specify a
- special location for external lock files to live. If nothing is set, then
- CONF.lock_path is used as a default.
- """
-
- def wrap(f):
- @functools.wraps(f)
- def inner(*args, **kwargs):
- # NOTE(soren): If we ever go natively threaded, this will be racy.
- # See http://stackoverflow.com/questions/5390569/dyn
- # amically-allocating-and-destroying-mutexes
- sem = _semaphores.get(name, semaphore.Semaphore())
- if name not in _semaphores:
- # this check is not racy - we're already holding ref locally
- # so GC won't remove the item and there was no IO switch
- # (only valid in greenthreads)
- _semaphores[name] = sem
-
- with sem:
- LOG.debug(_('Got semaphore "%(lock)s" for method '
- '"%(method)s"...'), {'lock': name,
- 'method': f.__name__})
-
- # NOTE(mikal): I know this looks odd
- if not hasattr(local.strong_store, 'locks_held'):
- local.strong_store.locks_held = []
- local.strong_store.locks_held.append(name)
-
- try:
- if external and not CONF.disable_process_locking:
- LOG.debug(_('Attempting to grab file lock "%(lock)s" '
- 'for method "%(method)s"...'),
- {'lock': name, 'method': f.__name__})
- cleanup_dir = False
-
- # We need a copy of lock_path because it is non-local
- local_lock_path = lock_path
- if not local_lock_path:
- local_lock_path = CONF.lock_path
-
- if not local_lock_path:
- cleanup_dir = True
- local_lock_path = tempfile.mkdtemp()
-
- if not os.path.exists(local_lock_path):
- fileutils.ensure_tree(local_lock_path)
-
- # NOTE(mikal): the lock name cannot contain directory
- # separators
- safe_name = name.replace(os.sep, '_')
- lock_file_name = '%s%s' % (lock_file_prefix, safe_name)
- lock_file_path = os.path.join(local_lock_path,
- lock_file_name)
-
- try:
- lock = InterProcessLock(lock_file_path)
- with lock:
- LOG.debug(_('Got file lock "%(lock)s" at '
- '%(path)s for method '
- '"%(method)s"...'),
- {'lock': name,
- 'path': lock_file_path,
- 'method': f.__name__})
- retval = f(*args, **kwargs)
- finally:
- LOG.debug(_('Released file lock "%(lock)s" at '
- '%(path)s for method "%(method)s"...'),
- {'lock': name,
- 'path': lock_file_path,
- 'method': f.__name__})
- # NOTE(vish): This removes the tempdir if we needed
- # to create one. This is used to
- # cleanup the locks left behind by unit
- # tests.
- if cleanup_dir:
- shutil.rmtree(local_lock_path)
- else:
- retval = f(*args, **kwargs)
-
- finally:
- local.strong_store.locks_held.remove(name)
-
- return retval
- return inner
- return wrap
-
-
-def synchronized_with_prefix(lock_file_prefix):
- """Partial object generator for the synchronization decorator.
-
- Redefine @synchronized in each project like so::
-
- (in nova/utils.py)
- from nova.openstack.common import lockutils
-
- synchronized = lockutils.synchronized_with_prefix('nova-')
-
-
- (in nova/foo.py)
- from nova import utils
-
- @utils.synchronized('mylock')
- def bar(self, *args):
- ...
-
- The lock_file_prefix argument is used to provide lock files on disk with a
- meaningful prefix. The prefix should end with a hyphen ('-') if specified.
- """
-
- return functools.partial(synchronized, lock_file_prefix=lock_file_prefix)
+++ /dev/null
-# Copyright 2011 OpenStack Foundation.
-# All Rights Reserved.
-#
-# 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.
-
-"""
-System-level utilities and helper functions.
-"""
-
-import errno
-import logging
-import multiprocessing
-import os
-import random
-import shlex
-import signal
-
-from eventlet.green import subprocess
-from eventlet import greenthread
-import six
-
-from cinder.openstack.common.gettextutils import _
-from cinder.openstack.common import strutils
-
-
-LOG = logging.getLogger(__name__)
-
-
-class InvalidArgumentError(Exception):
- def __init__(self, message=None):
- super(InvalidArgumentError, self).__init__(message)
-
-
-class UnknownArgumentError(Exception):
- def __init__(self, message=None):
- super(UnknownArgumentError, self).__init__(message)
-
-
-class ProcessExecutionError(Exception):
- def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None,
- description=None):
- self.exit_code = exit_code
- self.stderr = stderr
- self.stdout = stdout
- self.cmd = cmd
- self.description = description
-
- if description is None:
- description = _("Unexpected error while running command.")
- if exit_code is None:
- exit_code = '-'
- message = _('%(description)s\n'
- 'Command: %(cmd)s\n'
- 'Exit code: %(exit_code)s\n'
- 'Stdout: %(stdout)r\n'
- 'Stderr: %(stderr)r') % {'description': description,
- 'cmd': cmd,
- 'exit_code': exit_code,
- 'stdout': stdout,
- 'stderr': stderr}
- super(ProcessExecutionError, self).__init__(message)
-
-
-class NoRootWrapSpecified(Exception):
- def __init__(self, message=None):
- super(NoRootWrapSpecified, self).__init__(message)
-
-
-def _subprocess_setup():
- # Python installs a SIGPIPE handler by default. This is usually not what
- # non-Python subprocesses expect.
- signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
-
-def execute(*cmd, **kwargs):
- """Helper method to shell out and execute a command through subprocess.
-
- Allows optional retry.
-
- :param cmd: Passed to subprocess.Popen.
- :type cmd: string
- :param process_input: Send to opened process.
- :type process_input: string
- :param env_variables: Environment variables and their values that
- will be set for the process.
- :type env_variables: dict
- :param check_exit_code: Single bool, int, or list of allowed exit
- codes. Defaults to [0]. Raise
- :class:`ProcessExecutionError` unless
- program exits with one of these code.
- :type check_exit_code: boolean, int, or [int]
- :param delay_on_retry: True | False. Defaults to True. If set to True,
- wait a short amount of time before retrying.
- :type delay_on_retry: boolean
- :param attempts: How many times to retry cmd.
- :type attempts: int
- :param run_as_root: True | False. Defaults to False. If set to True,
- the command is prefixed by the command specified
- in the root_helper kwarg.
- :type run_as_root: boolean
- :param root_helper: command to prefix to commands called with
- run_as_root=True
- :type root_helper: string
- :param shell: whether or not there should be a shell used to
- execute this command. Defaults to false.
- :type shell: boolean
- :param loglevel: log level for execute commands.
- :type loglevel: int. (Should be logging.DEBUG or logging.INFO)
- :returns: (stdout, stderr) from process execution
- :raises: :class:`UnknownArgumentError` on
- receiving unknown arguments
- :raises: :class:`ProcessExecutionError`
- """
-
- process_input = kwargs.pop('process_input', None)
- env_variables = kwargs.pop('env_variables', None)
- check_exit_code = kwargs.pop('check_exit_code', [0])
- ignore_exit_code = False
- delay_on_retry = kwargs.pop('delay_on_retry', True)
- attempts = kwargs.pop('attempts', 1)
- run_as_root = kwargs.pop('run_as_root', False)
- root_helper = kwargs.pop('root_helper', '')
- shell = kwargs.pop('shell', False)
- loglevel = kwargs.pop('loglevel', logging.DEBUG)
-
- if isinstance(check_exit_code, bool):
- ignore_exit_code = not check_exit_code
- check_exit_code = [0]
- elif isinstance(check_exit_code, int):
- check_exit_code = [check_exit_code]
-
- if kwargs:
- raise UnknownArgumentError(_('Got unknown keyword args: %r') % kwargs)
-
- if run_as_root and hasattr(os, 'geteuid') and os.geteuid() != 0:
- if not root_helper:
- raise NoRootWrapSpecified(
- message=_('Command requested root, but did not '
- 'specify a root helper.'))
- cmd = shlex.split(root_helper) + list(cmd)
-
- cmd = map(str, cmd)
- sanitized_cmd = strutils.mask_password(' '.join(cmd))
-
- while attempts > 0:
- attempts -= 1
- try:
- LOG.log(loglevel, _('Running cmd (subprocess): %s'), sanitized_cmd)
- _PIPE = subprocess.PIPE # pylint: disable=E1101
-
- if os.name == 'nt':
- preexec_fn = None
- close_fds = False
- else:
- preexec_fn = _subprocess_setup
- close_fds = True
-
- obj = subprocess.Popen(cmd,
- stdin=_PIPE,
- stdout=_PIPE,
- stderr=_PIPE,
- close_fds=close_fds,
- preexec_fn=preexec_fn,
- shell=shell,
- env=env_variables)
- result = None
- for _i in six.moves.range(20):
- # NOTE(russellb) 20 is an arbitrary number of retries to
- # prevent any chance of looping forever here.
- try:
- if process_input is not None:
- result = obj.communicate(process_input)
- else:
- result = obj.communicate()
- except OSError as e:
- if e.errno in (errno.EAGAIN, errno.EINTR):
- continue
- raise
- break
- obj.stdin.close() # pylint: disable=E1101
- _returncode = obj.returncode # pylint: disable=E1101
- LOG.log(loglevel, 'Result was %s' % _returncode)
- if not ignore_exit_code and _returncode not in check_exit_code:
- (stdout, stderr) = result
- sanitized_stdout = strutils.mask_password(stdout)
- sanitized_stderr = strutils.mask_password(stderr)
- raise ProcessExecutionError(exit_code=_returncode,
- stdout=sanitized_stdout,
- stderr=sanitized_stderr,
- cmd=sanitized_cmd)
- return result
- except ProcessExecutionError:
- if not attempts:
- raise
- else:
- LOG.log(loglevel, _('%r failed. Retrying.'), sanitized_cmd)
- if delay_on_retry:
- greenthread.sleep(random.randint(20, 200) / 100.0)
- finally:
- # NOTE(termie): this appears to be necessary to let the subprocess
- # call clean something up in between calls, without
- # it two execute calls in a row hangs the second one
- greenthread.sleep(0)
-
-
-def trycmd(*args, **kwargs):
- """A wrapper around execute() to more easily handle warnings and errors.
-
- Returns an (out, err) tuple of strings containing the output of
- the command's stdout and stderr. If 'err' is not empty then the
- command can be considered to have failed.
-
- :discard_warnings True | False. Defaults to False. If set to True,
- then for succeeding commands, stderr is cleared
-
- """
- discard_warnings = kwargs.pop('discard_warnings', False)
-
- try:
- out, err = execute(*args, **kwargs)
- failed = False
- except ProcessExecutionError as exn:
- out, err = '', six.text_type(exn)
- failed = True
-
- if not failed and discard_warnings and err:
- # Handle commands that output to stderr but otherwise succeed
- err = ''
-
- return out, err
-
-
-def ssh_execute(ssh, cmd, process_input=None,
- addl_env=None, check_exit_code=True):
- sanitized_cmd = strutils.mask_password(cmd)
- LOG.debug('Running cmd (SSH): %s', sanitized_cmd)
- if addl_env:
- raise InvalidArgumentError(_('Environment not supported over SSH'))
-
- if process_input:
- # This is (probably) fixable if we need it...
- raise InvalidArgumentError(_('process_input not supported over SSH'))
-
- stdin_stream, stdout_stream, stderr_stream = ssh.exec_command(cmd)
- channel = stdout_stream.channel
-
- # NOTE(justinsb): This seems suspicious...
- # ...other SSH clients have buffering issues with this approach
- stdout = stdout_stream.read()
- sanitized_stdout = strutils.mask_password(stdout)
- stderr = stderr_stream.read()
- sanitized_stderr = strutils.mask_password(stderr)
-
- stdin_stream.close()
-
- exit_status = channel.recv_exit_status()
-
- # exit_status == -1 if no exit code was returned
- if exit_status != -1:
- LOG.debug('Result was %s' % exit_status)
- if check_exit_code and exit_status != 0:
- raise ProcessExecutionError(exit_code=exit_status,
- stdout=sanitized_stdout,
- stderr=sanitized_stderr,
- cmd=sanitized_cmd)
-
- return (sanitized_stdout, sanitized_stderr)
-
-
-def get_worker_count():
- """Utility to get the default worker count.
-
- @return: The number of CPUs if that can be determined, else a default
- worker count of 1 is returned.
- """
- try:
- return multiprocessing.cpu_count()
- except NotImplementedError:
- return 1
import os
import random
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo import messaging
from cinder.i18n import _
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
-from cinder.openstack.common import processutils
from cinder.openstack.common import service
from cinder import rpc
from cinder import version
import logging
import os
import shutil
-import tempfile
import uuid
import fixtures
import mock
import mox
+from oslo.concurrency import lockutils
from oslo.config import cfg
+from oslo.config import fixture as config_fixture
from oslo.messaging import conffixture as messaging_conffixture
from oslo.utils import strutils
from oslo.utils import timeutils
self.override_config('fatal_exception_format_errors', True)
# This will be cleaned up by the NestedTempfile fixture
- self.override_config('lock_path', tempfile.mkdtemp())
+ lock_path = self.useFixture(fixtures.TempDir()).path
+ self.fixture = self.useFixture(
+ config_fixture.Config(lockutils.CONF))
+ self.fixture.config(lock_path=lock_path,
+ group='oslo_concurrency')
self.override_config('policy_file',
os.path.join(
os.path.abspath(
# under the License.
import ast
-import tempfile
+import fixtures
+from oslo.concurrency import lockutils
from oslo.config import cfg
+from oslo.config import fixture as config_fixture
from oslo.serialization import jsonutils
from oslo.utils import timeutils
import webob
def setUp(self):
super(AdminActionsTest, self).setUp()
- self.tempdir = tempfile.mkdtemp()
+ self.tempdir = self.useFixture(fixtures.TempDir()).path
+ self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF))
+ self.fixture.config(lock_path=self.tempdir,
+ group='oslo_concurrency')
+ self.fixture.config(disable_process_locking=True,
+ group='oslo_concurrency')
self.flags(rpc_backend='cinder.openstack.common.rpc.impl_fake')
- self.flags(lock_path=self.tempdir,
- disable_process_locking=True)
self.volume_api = volume_api.API()
cast_as_call.mock_cast_as_call(self.volume_api.volume_rpcapi.client)
import string
import time
+from oslo.concurrency import processutils as putils
+
from cinder.brick import exception
from cinder.brick.initiator import connector
from cinder.brick.initiator import host_driver
from cinder.i18n import _
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
-from cinder.openstack.common import processutils as putils
from cinder import test
LOG = logging.getLogger(__name__)
# under the License.
import mox
+from oslo.concurrency import processutils
from cinder.brick import exception
from cinder.brick.local_dev import lvm as brick
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume import configuration as conf
import re
from eventlet import greenthread
+from oslo.concurrency import processutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
LOG = logging.getLogger(__name__)
import uuid
import mock
+from oslo.concurrency import processutils
from oslo.serialization import jsonutils
import six
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume.drivers import rbd as rbddriver
import os
import posix
+from oslo.concurrency import processutils as putils
+
from cinder.backup.drivers import tsm
from cinder import context
from cinder import db
from cinder import exception
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder import test
from cinder import utils
import re
import mock
+from oslo.concurrency import processutils
from cinder import exception
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers.emc.emc_cli_fc import EMCCLIFCDriver
fake_cli.assert_has_calls(expect_cmd)
@mock.patch(
- "cinder.openstack.common.processutils.execute",
+ "oslo.concurrency.processutils.execute",
mock.Mock(
return_value=(
"fakeportal iqn.1992-04.fake.com:fake.apm00123907237.a8", 0)))
return None
@mock.patch(
- "cinder.openstack.common.processutils.execute",
+ "oslo.concurrency.processutils.execute",
mock.Mock(
return_value=(
"fakeportal iqn.1992-04.fake.com:fake.apm00123907237.a8", 0)))
import time
import mox
+from oslo.concurrency import processutils
import paramiko
from cinder import context
from cinder import exception
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers import eqlx
from mox import IgnoreArg
from mox import IsA
from mox import stubout
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
from oslo.utils import units
from cinder.i18n import _
from cinder.image import image_utils
from cinder.openstack.common import imageutils
-from cinder.openstack.common import processutils as putils
from cinder import test
from cinder import utils
from cinder.volume import configuration as conf
import tempfile
import mock
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder import exception
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder import utils
from cinder.volume import configuration as conf
@mock.patch('cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver.'
'_ssh_operation')
- @mock.patch('cinder.openstack.common.processutils.execute')
+ @mock.patch('oslo.concurrency.processutils.execute')
def test_create_ibmnas_snap_mount_point_provided(self, mock_ssh,
mock_execute):
"""Create ibmnas snap if mount point is provided."""
@mock.patch('cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver.'
'_ssh_operation')
- @mock.patch('cinder.openstack.common.processutils.execute')
+ @mock.patch('oslo.concurrency.processutils.execute')
def test_create_ibmnas_snap_nas_gpfs(self, mock_execute, mock_ssh):
"""Create ibmnas snap if mount point is provided."""
self.TEST_EXTEND_SIZE_IN_GB)
@mock.patch('cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver._run_ssh')
- @mock.patch('cinder.openstack.common.processutils.execute')
+ @mock.patch('oslo.concurrency.processutils.execute')
def test_delete_snapfiles(self, mock_execute, mock_ssh):
"""Delete_snapfiles test case."""
self.TEST_MNT_POINT)
@mock.patch('cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver._run_ssh')
- @mock.patch('cinder.openstack.common.processutils.execute')
+ @mock.patch('oslo.concurrency.processutils.execute')
def test_delete_snapfiles_nas_gpfs(self, mock_execute, mock_ssh):
"""Delete_snapfiles for gpfs-nas platform test case."""
'_get_provider_location')
@mock.patch('cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver.'
'_get_mount_point_for_share')
- @mock.patch('cinder.openstack.common.processutils.execute')
+ @mock.patch('oslo.concurrency.processutils.execute')
def test_delete_snapshot(self, mock_execute, mock_mount, mock_provider):
"""Delete snapshot simple test case."""
import mock
import mox
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder import exception
from cinder.image import image_utils
from cinder.openstack.common import fileutils
-from cinder.openstack.common import processutils
from cinder import test
from cinder import utils
from cinder.volume import utils as volume_utils
import platform
import mock
+from oslo.concurrency import processutils as putils
-from cinder.openstack.common import processutils as putils
from cinder import test
from cinder import version
from cinder.volume.drivers.netapp import utils as na_utils
import urllib2
import mock
+from oslo.concurrency import processutils
from oslo.utils import units
from cinder import exception
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume.drivers import pure
import mock
import mox
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.db import exception as db_exc
from cinder import db
from cinder import exception
from cinder import manager
-from cinder.openstack.common import processutils
from cinder import service
from cinder import test
from cinder import wsgi
import os
import tempfile
+from oslo.concurrency import processutils
from oslo.utils import units
from cinder.image import image_utils
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume.drivers.sheepdog import SheepdogDriver
import time
import mock
+from oslo.concurrency import processutils
from oslo.utils import excutils
from oslo.utils import importutils
from oslo.utils import units
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder.tests import utils as testutils
from cinder import utils
import uuid
import mock
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
from oslo.utils import timeutils
import paramiko
from cinder.brick.initiator import connector
from cinder.brick.initiator import linuxfc
from cinder import exception
-from cinder.openstack.common import processutils as putils
from cinder import ssh_utils
from cinder import test
from cinder import utils
import re
import mock
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import importutils
from cinder import db
from cinder import exception
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder.tests import fake_notifier
from cinder import utils
import mock
from mock import patch
+from oslo.concurrency import processutils
from cinder import exception
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import test
from cinder.zonemanager.drivers.brocade.brcd_fc_zone_client_cli \
import BrcdFCZoneClientCLI
"""Unit tests for Cisco fc zone client cli."""
from mock import patch
+from oslo.concurrency import processutils
from cinder import exception
-from cinder.openstack.common import processutils
from cinder import test
from cinder.zonemanager.drivers.cisco.cisco_fc_zone_client_cli \
import CiscoFCZoneClientCLI
"""Unit tests for Cisco FC zone driver."""
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import importutils
from cinder import exception
-from cinder.openstack.common import processutils
from cinder import test
from cinder.volume import configuration as conf
from xml.sax import expatreader
from xml.sax import saxutils
+from oslo.concurrency import lockutils
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from cinder.brick.initiator import connector
from cinder import exception
from cinder.i18n import _
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
CONF = cfg.CONF
import time
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import excutils
from cinder.image import image_utils
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume import iscsi
from cinder.volume import rpcapi as volume_rpcapi
import urllib
import urllib2
+from oslo.concurrency import lockutils
from oslo.config import cfg
from oslo.serialization import jsonutils
from oslo.utils import units
from cinder import exception
from cinder.i18n import _
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume import volume_types
import re
import time
+from oslo.concurrency import lockutils
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.serialization import jsonutils as json
from oslo.utils import excutils
from cinder import exception
from cinder.exception import EMCVnxCLICmdError
from cinder.i18n import _, _LE, _LI, _LW
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume.configuration import Configuration
from cinder.volume.drivers.san import san
import eventlet
from eventlet import greenthread
import greenlet
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import excutils
from cinder import exception
from cinder.i18n import _, _LE, _LW, _LI
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import ssh_utils
from cinder import utils
from cinder.volume.drivers.san import SanISCSIDriver
FC Drivers for ETERNUS DX arrays based on SMI-S.
"""
+from oslo.concurrency import lockutils
import six
from cinder import context
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume.drivers import fujitsu_eternus_dx_common
ISCSI Drivers for ETERNUS DX arrays based on SMI-S.
"""
+from oslo.concurrency import lockutils
import six
from cinder import context
from cinder import exception
from cinder.i18n import _
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume.drivers import fujitsu_eternus_dx_common
import stat
import time
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder.image import image_utils
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume.drivers import remotefs as remotefs_drv
import time
from xml.etree import ElementTree as ETree
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import units
from cinder.i18n import _, _LE, _LI
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder.volume.drivers.hds.hnas_backend import HnasBackend
from cinder.volume.drivers import nfs
import os
import shlex
+from oslo.concurrency import lockutils
+from oslo.concurrency import processutils as putils
from oslo.utils import excutils
import six
from cinder import exception
from cinder.i18n import _
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder import utils
SMPL = 1
import threading
import time
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
from oslo.utils import excutils
import six
from cinder.i18n import _
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
-from cinder.openstack.common import processutils as putils
from cinder import utils
from cinder.volume.drivers.hitachi import hbsd_basiclib as basic_lib
import re
import shutil
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder.image import image_utils
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume import driver
import os
import re
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder.i18n import _, _LI, _LW
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume.drivers import nfs
from cinder.volume.drivers.remotefs import nas_opts
import re
+from oslo.concurrency import processutils
+
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
LOG = logging.getLogger(__name__)
import os
import socket
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder.image import image_utils
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume import driver
from cinder.volume import utils as volutils
import time
import uuid
+from oslo.concurrency import processutils
from oslo.utils import excutils
from oslo.utils import units
import six
from cinder.i18n import _, _LE, _LI, _LW
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume.drivers.netapp.api import NaApiError
from cinder.volume.drivers.netapp.api import NaElement
import socket
import uuid
+from oslo.concurrency import processutils as putils
from oslo.utils import timeutils
import six
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder import utils
from cinder import version
from cinder.volume.drivers.netapp.api import NaApiError
import errno
import os
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
from oslo.utils import units
from cinder.i18n import _
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder import utils
from cinder.volume.drivers import remotefs
import urllib2
import uuid
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import units
from cinder import exception
from cinder.i18n import _LE, _LI, _LW
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume.drivers.san import san
import re
import tempfile
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
from oslo.utils import units
from cinder.i18n import _, _LE, _LI, _LW
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder.volume import driver
LOG = logging.getLogger(__name__)
"""
from lxml import etree
+from oslo.concurrency import processutils
from oslo.utils import units
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder.volume.drivers.san.san import SanISCSIDriver
import random
from eventlet import greenthread
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import excutils
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import ssh_utils
from cinder import utils
from cinder.volume import driver
import re
import tempfile
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import units
from cinder.i18n import _, _LE
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder.volume import driver
import os
import re
+from oslo.concurrency import processutils as putils
from oslo.config import cfg
from oslo.utils import units
from cinder.i18n import _
from cinder.image import image_utils
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder import utils
from cinder.volume.drivers import remotefs as remotefs_drv
import traceback
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import timeutils
import taskflow.engines
from cinder.i18n import _, _LE, _LI
from cinder.image import glance
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import utils
from cinder.volume.flows import common
from cinder.volume import utils as volume_utils
import os
import re
+from oslo.concurrency import processutils as putils
+
from cinder.brick.iscsi import iscsi
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils as putils
from cinder.volume import utils
LOG = logging.getLogger(__name__)
import math
from Crypto.Random import random
+from oslo.concurrency import processutils
from oslo.config import cfg
from oslo.utils import strutils
from oslo.utils import timeutils
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import rpc
from cinder import utils
import re
from eventlet import greenthread
+from oslo.concurrency import processutils
from oslo.utils import excutils
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import ssh_utils
from cinder import utils
import cinder.zonemanager.drivers.brocade.fc_zone_constants as ZoneConstant
"""
+from oslo.concurrency import lockutils
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import importutils
from cinder import exception
from cinder.i18n import _
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.zonemanager.drivers.brocade import brcd_fabric_opts as fabric_opts
from cinder.zonemanager.drivers.fc_zone_driver import FCZoneDriver
import random
from eventlet import greenthread
+from oslo.concurrency import processutils
from oslo.utils import excutils
import six
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import ssh_utils
from cinder import utils
from cinder.zonemanager.drivers.cisco import cisco_fabric_opts as fabric_opts
import re
from eventlet import greenthread
+from oslo.concurrency import processutils
from oslo.utils import excutils
import six
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import log as logging
-from cinder.openstack.common import processutils
from cinder import ssh_utils
from cinder import utils
import cinder.zonemanager.drivers.cisco.fc_zone_constants as ZoneConstant
:zone_name_prefix: Used by: class: 'FCZoneDriver'. Defaults to 'openstack'
"""
+from oslo.concurrency import lockutils
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import importutils
from cinder import exception
from cinder.i18n import _
-from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging
from cinder.zonemanager.drivers.cisco import cisco_fabric_opts as fabric_opts
from cinder.zonemanager.drivers.fc_zone_driver import FCZoneDriver
#backdoor_port=<None>
-#
-# Options defined in cinder.openstack.common.lockutils
-#
-
-# Whether to disable inter-process locks (boolean value)
-#disable_process_locking=false
-
-# Directory to use for lock files. Default to a temp directory
-# (string value)
-#lock_path=<None>
-
-
#
# Options defined in cinder.openstack.common.log
#
module=install_venv_common
module=jsonutils
module=local
-module=lockutils
module=log
module=log_handler
module=loopingcall
module=middleware
module=periodic_task
module=policy
-module=processutils
module=request_utils
module=scheduler
module=scheduler.filters
lxml>=2.3
netaddr>=0.7.12
oslo.config>=1.4.0 # Apache-2.0
+oslo.concurrency>=0.1.0 # Apache-2.0
oslo.db>=1.0.0 # Apache-2.0
oslo.messaging>=1.4.0
oslo.rootwrap>=1.3.0