Use oslo.utils
oslo.utils library now provides the functionality previously in oslo-incubator's excutils, importutils, network_utils, strutils timeutils, units etc. Some of these outdated modules will still be around for a while until all other oslo modules that use them have been updated in future commits. Change-Id: Idee8600dfe42e5977b8fb824e91afff7e9119981
This commit is contained in:
parent
1d77d79f81
commit
7d341e267f
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.utils import strutils
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
@ -22,7 +23,6 @@ from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import rpc
|
||||
from cinder import volume
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
from xml.parsers import expat
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
import webob.exc
|
||||
|
||||
from cinder.api import extensions
|
||||
@ -27,7 +28,6 @@ from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LI
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import utils
|
||||
from cinder.volume import api as volume_api
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
"""The QoS specs extension"""
|
||||
|
||||
from oslo.utils import strutils
|
||||
import six
|
||||
import webob
|
||||
|
||||
@ -25,7 +26,6 @@ from cinder.api import xmlutil
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LI
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import rpc
|
||||
from cinder import utils
|
||||
from cinder.volume import qos_specs
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.utils import strutils
|
||||
import webob
|
||||
|
||||
from cinder.api import extensions
|
||||
@ -22,7 +23,6 @@ from cinder import db
|
||||
from cinder.db.sqlalchemy import api as sqlalchemy_api
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import quota
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
import webob.exc
|
||||
|
||||
from cinder.api import extensions
|
||||
@ -24,7 +25,6 @@ from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import utils
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
|
||||
from oslo import messaging
|
||||
from oslo.utils import strutils
|
||||
import webob
|
||||
|
||||
from cinder.api import extensions
|
||||
@ -22,7 +23,6 @@ from cinder.api import xmlutil
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import utils
|
||||
from cinder import volume
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
import os
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
@ -25,7 +26,6 @@ from cinder.api.openstack import wsgi
|
||||
from cinder.api import xmlutil
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
import cinder.policy
|
||||
|
||||
|
@ -25,6 +25,7 @@ import re
|
||||
import time
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import importutils
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
@ -32,7 +33,6 @@ from cinder.api.openstack import wsgi
|
||||
from cinder.api.views import limits as limits_views
|
||||
from cinder.api import xmlutil
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder import quota
|
||||
from cinder import wsgi as base_wsgi
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
"""The volumes snapshots api."""
|
||||
|
||||
from oslo.utils import strutils
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
@ -24,7 +25,6 @@ from cinder.api import xmlutil
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LI
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import utils
|
||||
from cinder import volume
|
||||
|
||||
|
@ -25,6 +25,7 @@ import re
|
||||
import time
|
||||
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import importutils
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
@ -32,7 +33,6 @@ from cinder.api.openstack import wsgi
|
||||
from cinder.api.views import limits as limits_views
|
||||
from cinder.api import xmlutil
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder import quota
|
||||
from cinder import wsgi as base_wsgi
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
"""The volumes snapshots api."""
|
||||
|
||||
from oslo.utils import strutils
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
@ -24,7 +25,6 @@ from cinder.api import xmlutil
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LI
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder import utils
|
||||
from cinder import volume
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from cinder.openstack.common import timeutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
|
||||
class ViewBuilder(object):
|
||||
|
@ -16,11 +16,11 @@
|
||||
# Importing full names to not pollute the namespace and cause possible
|
||||
# collisions with use of 'from cinder.backup import <foo>' elsewhere.
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder.common import config
|
||||
import cinder.openstack.common.importutils
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
API = cinder.openstack.common.importutils.import_class(CONF.backup_api_class)
|
||||
API = importutils.import_class(CONF.backup_api_class)
|
||||
|
@ -20,13 +20,13 @@ Handles all requests relating to the volume backups service.
|
||||
|
||||
from eventlet import greenthread
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from cinder.backup import rpcapi as backup_rpcapi
|
||||
from cinder import context
|
||||
from cinder.db import base
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LI, _LW
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
import cinder.policy
|
||||
from cinder import quota
|
||||
|
@ -50,14 +50,14 @@ import time
|
||||
|
||||
import eventlet
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import encodeutils
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.backup.driver import BackupDriver
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI, _LW
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import utils
|
||||
import cinder.volume.drivers.rbd as rbd_driver
|
||||
|
||||
@ -103,7 +103,7 @@ class VolumeMetadataBackup(object):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return strutils.safe_encode("backup.%s.meta" % self._backup_id)
|
||||
return encodeutils.safe_encode("backup.%s.meta" % self._backup_id)
|
||||
|
||||
@property
|
||||
def exists(self):
|
||||
@ -182,9 +182,9 @@ class CephBackupDriver(BackupDriver):
|
||||
self.rbd_stripe_count = 0
|
||||
self.rbd_stripe_unit = 0
|
||||
|
||||
self._ceph_backup_user = strutils.safe_encode(CONF.backup_ceph_user)
|
||||
self._ceph_backup_pool = strutils.safe_encode(CONF.backup_ceph_pool)
|
||||
self._ceph_backup_conf = strutils.safe_encode(CONF.backup_ceph_conf)
|
||||
self._ceph_backup_user = encodeutils.safe_encode(CONF.backup_ceph_user)
|
||||
self._ceph_backup_pool = encodeutils.safe_encode(CONF.backup_ceph_pool)
|
||||
self._ceph_backup_conf = encodeutils.safe_encode(CONF.backup_ceph_conf)
|
||||
|
||||
def _validate_string_args(self, *args):
|
||||
"""Ensure all args are non-None and non-empty."""
|
||||
@ -240,7 +240,8 @@ class CephBackupDriver(BackupDriver):
|
||||
conffile=self._ceph_backup_conf)
|
||||
try:
|
||||
client.connect()
|
||||
pool_to_open = strutils.safe_encode(pool or self._ceph_backup_pool)
|
||||
pool_to_open = encodeutils.safe_encode(pool or
|
||||
self._ceph_backup_pool)
|
||||
ioctx = client.open_ioctx(pool_to_open)
|
||||
return client, ioctx
|
||||
except self.rados.Error:
|
||||
@ -263,13 +264,13 @@ class CephBackupDriver(BackupDriver):
|
||||
"""
|
||||
# Ensure no unicode
|
||||
if diff_format:
|
||||
return strutils.safe_encode("volume-%s.backup.base" % volume_id)
|
||||
return encodeutils.safe_encode("volume-%s.backup.base" % volume_id)
|
||||
else:
|
||||
if backup_id is None:
|
||||
msg = _("Backup id required")
|
||||
raise exception.InvalidParameterValue(msg)
|
||||
return strutils.safe_encode("volume-%s.backup.%s" %
|
||||
(volume_id, backup_id))
|
||||
return encodeutils.safe_encode("volume-%s.backup.%s" %
|
||||
(volume_id, backup_id))
|
||||
|
||||
def _discard_bytes(self, volume, offset, length):
|
||||
"""Trim length bytes from offset.
|
||||
@ -472,7 +473,7 @@ class CephBackupDriver(BackupDriver):
|
||||
|
||||
# Since we have deleted the base image we can delete the source
|
||||
# volume backup snapshot.
|
||||
src_name = strutils.safe_encode(volume_id)
|
||||
src_name = encodeutils.safe_encode(volume_id)
|
||||
if src_name in self.rbd.RBD().list(client.ioctx):
|
||||
LOG.debug("Deleting source volume snapshot '%(snapshot)s' "
|
||||
"for backup %(basename)s." %
|
||||
@ -537,15 +538,15 @@ class CephBackupDriver(BackupDriver):
|
||||
if from_snap is not None:
|
||||
cmd1.extend(['--from-snap', from_snap])
|
||||
if src_snap:
|
||||
path = strutils.safe_encode("%s/%s@%s" %
|
||||
(src_pool, src_name, src_snap))
|
||||
path = encodeutils.safe_encode("%s/%s@%s" %
|
||||
(src_pool, src_name, src_snap))
|
||||
else:
|
||||
path = strutils.safe_encode("%s/%s" % (src_pool, src_name))
|
||||
path = encodeutils.safe_encode("%s/%s" % (src_pool, src_name))
|
||||
|
||||
cmd1.extend([path, '-'])
|
||||
|
||||
cmd2 = ['rbd', 'import-diff'] + dest_ceph_args
|
||||
rbd_path = strutils.safe_encode("%s/%s" % (dest_pool, dest_name))
|
||||
rbd_path = encodeutils.safe_encode("%s/%s" % (dest_pool, dest_name))
|
||||
cmd2.extend(['-', rbd_path])
|
||||
|
||||
ret, stderr = self._piped_execute(cmd1, cmd2)
|
||||
@ -758,8 +759,8 @@ class CephBackupDriver(BackupDriver):
|
||||
return backup_snaps
|
||||
|
||||
def _get_new_snap_name(self, backup_id):
|
||||
return strutils.safe_encode("backup.%s.snap.%s" %
|
||||
(backup_id, time.time()))
|
||||
return encodeutils.safe_encode("backup.%s.snap.%s" %
|
||||
(backup_id, time.time()))
|
||||
|
||||
def _get_backup_snap_name(self, rbd_image, name, backup_id):
|
||||
"""Return the name of the snapshot associated with backup_id.
|
||||
@ -933,7 +934,7 @@ class CephBackupDriver(BackupDriver):
|
||||
with rbd_driver.RADOSClient(self, self._ceph_backup_pool) as client:
|
||||
adjust_size = 0
|
||||
base_image = self.rbd.Image(client.ioctx,
|
||||
strutils.safe_encode(backup_base),
|
||||
encodeutils.safe_encode(backup_base),
|
||||
read_only=True)
|
||||
try:
|
||||
if restore_length != base_image.size():
|
||||
@ -943,8 +944,8 @@ class CephBackupDriver(BackupDriver):
|
||||
|
||||
if adjust_size:
|
||||
with rbd_driver.RADOSClient(self, src_pool) as client:
|
||||
dest_image = self.rbd.Image(client.ioctx,
|
||||
strutils.safe_encode(restore_vol))
|
||||
restore_vol_encode = encodeutils.safe_encode(restore_vol)
|
||||
dest_image = self.rbd.Image(client.ioctx, restore_vol_encode)
|
||||
try:
|
||||
LOG.debug("Adjusting restore vol size")
|
||||
dest_image.resize(adjust_size)
|
||||
|
@ -38,16 +38,16 @@ import socket
|
||||
|
||||
import eventlet
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
import six
|
||||
from swiftclient import client as swift
|
||||
|
||||
from cinder.backup.driver import BackupDriver
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI, _LW
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import units
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -35,6 +35,8 @@ Volume backups can be created, restored, deleted and listed.
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo import messaging
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder.backup import driver
|
||||
from cinder.backup import rpcapi as backup_rpcapi
|
||||
@ -42,8 +44,6 @@ from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI, _LW
|
||||
from cinder import manager
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import quota
|
||||
from cinder import rpc
|
||||
|
@ -22,10 +22,11 @@ import math
|
||||
import re
|
||||
import time
|
||||
|
||||
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 excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import oslo.config.cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
import cinder.openstack.common.importutils
|
||||
|
||||
_compute_opts = [
|
||||
oslo.config.cfg.StrOpt('compute_api_class',
|
||||
@ -28,7 +28,6 @@ oslo.config.cfg.CONF.register_opts(_compute_opts)
|
||||
|
||||
|
||||
def API():
|
||||
importutils = cinder.openstack.common.importutils
|
||||
compute_api_class = oslo.config.cfg.CONF.compute_api_class
|
||||
cls = importutils.import_class(compute_api_class)
|
||||
return cls()
|
||||
|
@ -16,12 +16,12 @@
|
||||
# Importing full names to not pollute the namespace and cause possible
|
||||
# collisions with use of 'from cinder.transfer import <foo>' elsewhere.
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder.common import config
|
||||
import cinder.openstack.common.importutils
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
API = cinder.openstack.common.importutils.import_class(
|
||||
API = importutils.import_class(
|
||||
CONF.consistencygroup_api_class)
|
||||
|
@ -21,13 +21,13 @@ Handles all requests relating to consistency groups.
|
||||
import functools
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder.db import base
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
import cinder.policy
|
||||
from cinder import quota
|
||||
from cinder.scheduler import rpcapi as scheduler_rpcapi
|
||||
|
@ -20,10 +20,11 @@
|
||||
import copy
|
||||
import uuid
|
||||
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import local
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import policy
|
||||
|
||||
|
||||
|
@ -18,8 +18,7 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cinder.openstack.common import importutils
|
||||
from oslo.utils import importutils
|
||||
|
||||
|
||||
db_driver_opt = cfg.StrOpt('db_driver',
|
||||
|
@ -30,6 +30,7 @@ from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo.db import options
|
||||
from oslo.db.sqlalchemy import session as db_session
|
||||
from oslo.utils import timeutils
|
||||
import osprofiler.sqlalchemy
|
||||
import sqlalchemy
|
||||
from sqlalchemy import or_
|
||||
@ -43,7 +44,6 @@ from cinder.db.sqlalchemy import models
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import uuidutils
|
||||
|
||||
|
||||
|
@ -21,13 +21,12 @@ SQLAlchemy models for cinder data.
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.db.sqlalchemy import models
|
||||
from oslo.utils import timeutils
|
||||
from sqlalchemy import Column, Integer, String, Text, schema
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import ForeignKey, DateTime, Boolean
|
||||
from sqlalchemy.orm import relationship, backref, validates
|
||||
|
||||
from cinder.openstack.common import timeutils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
BASE = declarative_base()
|
||||
|
@ -29,12 +29,13 @@ import time
|
||||
import glanceclient.exc
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import timeutils
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
|
||||
|
||||
glance_opts = [
|
||||
cfg.ListOpt('allowed_direct_url_schemes',
|
||||
|
@ -29,6 +29,8 @@ import os
|
||||
import tempfile
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
@ -36,8 +38,6 @@ 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.openstack.common import timeutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import utils
|
||||
from cinder.volume import utils as volume_utils
|
||||
|
||||
|
@ -14,8 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from cinder.openstack.common import importutils
|
||||
from oslo.utils import importutils
|
||||
|
||||
keymgr_opts = [
|
||||
cfg.StrOpt('api_class',
|
||||
|
@ -25,12 +25,12 @@ from barbicanclient import client as barbican_client
|
||||
from keystoneclient.auth import identity
|
||||
from keystoneclient import session
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.keymgr import key as keymgr_key
|
||||
from cinder.keymgr import key_mgr
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -1,160 +0,0 @@
|
||||
# Copyright 2012 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.
|
||||
|
||||
"""
|
||||
Network-related utilities and helper functions.
|
||||
"""
|
||||
|
||||
import socket
|
||||
|
||||
from six.moves.urllib import parse
|
||||
|
||||
from cinder.openstack.common.gettextutils import _LW
|
||||
from cinder.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def parse_host_port(address, default_port=None):
|
||||
"""Interpret a string as a host:port pair.
|
||||
|
||||
An IPv6 address MUST be escaped if accompanied by a port,
|
||||
because otherwise ambiguity ensues: 2001:db8:85a3::8a2e:370:7334
|
||||
means both [2001:db8:85a3::8a2e:370:7334] and
|
||||
[2001:db8:85a3::8a2e:370]:7334.
|
||||
|
||||
>>> parse_host_port('server01:80')
|
||||
('server01', 80)
|
||||
>>> parse_host_port('server01')
|
||||
('server01', None)
|
||||
>>> parse_host_port('server01', default_port=1234)
|
||||
('server01', 1234)
|
||||
>>> parse_host_port('[::1]:80')
|
||||
('::1', 80)
|
||||
>>> parse_host_port('[::1]')
|
||||
('::1', None)
|
||||
>>> parse_host_port('[::1]', default_port=1234)
|
||||
('::1', 1234)
|
||||
>>> parse_host_port('2001:db8:85a3::8a2e:370:7334', default_port=1234)
|
||||
('2001:db8:85a3::8a2e:370:7334', 1234)
|
||||
|
||||
"""
|
||||
if address[0] == '[':
|
||||
# Escaped ipv6
|
||||
_host, _port = address[1:].split(']')
|
||||
host = _host
|
||||
if ':' in _port:
|
||||
port = _port.split(':')[1]
|
||||
else:
|
||||
port = default_port
|
||||
else:
|
||||
if address.count(':') == 1:
|
||||
host, port = address.split(':')
|
||||
else:
|
||||
# 0 means ipv4, >1 means ipv6.
|
||||
# We prohibit unescaped ipv6 addresses with port.
|
||||
host = address
|
||||
port = default_port
|
||||
|
||||
return (host, None if port is None else int(port))
|
||||
|
||||
|
||||
class ModifiedSplitResult(parse.SplitResult):
|
||||
"""Split results class for urlsplit."""
|
||||
|
||||
# NOTE(dims): The functions below are needed for Python 2.6.x.
|
||||
# We can remove these when we drop support for 2.6.x.
|
||||
@property
|
||||
def hostname(self):
|
||||
netloc = self.netloc.split('@', 1)[-1]
|
||||
host, port = parse_host_port(netloc)
|
||||
return host
|
||||
|
||||
@property
|
||||
def port(self):
|
||||
netloc = self.netloc.split('@', 1)[-1]
|
||||
host, port = parse_host_port(netloc)
|
||||
return port
|
||||
|
||||
|
||||
def urlsplit(url, scheme='', allow_fragments=True):
|
||||
"""Parse a URL using urlparse.urlsplit(), splitting query and fragments.
|
||||
This function papers over Python issue9374 when needed.
|
||||
|
||||
The parameters are the same as urlparse.urlsplit.
|
||||
"""
|
||||
scheme, netloc, path, query, fragment = parse.urlsplit(
|
||||
url, scheme, allow_fragments)
|
||||
if allow_fragments and '#' in path:
|
||||
path, fragment = path.split('#', 1)
|
||||
if '?' in path:
|
||||
path, query = path.split('?', 1)
|
||||
return ModifiedSplitResult(scheme, netloc,
|
||||
path, query, fragment)
|
||||
|
||||
|
||||
def set_tcp_keepalive(sock, tcp_keepalive=True,
|
||||
tcp_keepidle=None,
|
||||
tcp_keepalive_interval=None,
|
||||
tcp_keepalive_count=None):
|
||||
"""Set values for tcp keepalive parameters
|
||||
|
||||
This function configures tcp keepalive parameters if users wish to do
|
||||
so.
|
||||
:param tcp_keepalive: Boolean, turn on or off tcp_keepalive. If users are
|
||||
not sure, this should be True, and default values will be used.
|
||||
|
||||
:param tcp_keepidle: time to wait before starting to send keepalive probes
|
||||
|
||||
:param tcp_keepalive_interval: time between successive probes, once the
|
||||
initial wait time is over
|
||||
|
||||
:param tcp_keepalive_count: number of probes to send before the connection
|
||||
is killed
|
||||
"""
|
||||
|
||||
# NOTE(praneshp): Despite keepalive being a tcp concept, the level is
|
||||
# still SOL_SOCKET. This is a quirk.
|
||||
if isinstance(tcp_keepalive, bool):
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, tcp_keepalive)
|
||||
else:
|
||||
raise TypeError("tcp_keepalive must be a boolean")
|
||||
|
||||
if not tcp_keepalive:
|
||||
return
|
||||
|
||||
# These options aren't available in the OS X version of eventlet,
|
||||
# Idle + Count * Interval effectively gives you the total timeout.
|
||||
if tcp_keepidle is not None:
|
||||
if hasattr(socket, 'TCP_KEEPIDLE'):
|
||||
sock.setsockopt(socket.IPPROTO_TCP,
|
||||
socket.TCP_KEEPIDLE,
|
||||
tcp_keepidle)
|
||||
else:
|
||||
LOG.warning(_LW('tcp_keepidle not available on your system'))
|
||||
if tcp_keepalive_interval is not None:
|
||||
if hasattr(socket, 'TCP_KEEPINTVL'):
|
||||
sock.setsockopt(socket.IPPROTO_TCP,
|
||||
socket.TCP_KEEPINTVL,
|
||||
tcp_keepalive_interval)
|
||||
else:
|
||||
LOG.warning(_LW('tcp_keepintvl not available on your system'))
|
||||
if tcp_keepalive_count is not None:
|
||||
if hasattr(socket, 'TCP_KEEPCNT'):
|
||||
sock.setsockopt(socket.IPPROTO_TCP,
|
||||
socket.TCP_KEEPCNT,
|
||||
tcp_keepalive_count)
|
||||
else:
|
||||
LOG.warning(_LW('tcp_keepknt not available on your system'))
|
@ -1,38 +0,0 @@
|
||||
# Copyright 2013 IBM Corp
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Unit constants
|
||||
"""
|
||||
|
||||
#Binary unit constants.
|
||||
Ki = 1024
|
||||
Mi = 1024 ** 2
|
||||
Gi = 1024 ** 3
|
||||
Ti = 1024 ** 4
|
||||
Pi = 1024 ** 5
|
||||
Ei = 1024 ** 6
|
||||
Zi = 1024 ** 7
|
||||
Yi = 1024 ** 8
|
||||
|
||||
#Decimal unit constants.
|
||||
k = 1000
|
||||
M = 1000 ** 2
|
||||
G = 1000 ** 3
|
||||
T = 1000 ** 4
|
||||
P = 1000 ** 5
|
||||
E = 1000 ** 6
|
||||
Z = 1000 ** 7
|
||||
Y = 1000 ** 8
|
@ -20,14 +20,14 @@
|
||||
import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -14,11 +14,10 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import cinder.openstack.common.importutils
|
||||
from oslo.utils import importutils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
cls = CONF.replication_api_class
|
||||
API = cinder.openstack.common.importutils.import_class(cls)
|
||||
API = importutils.import_class(cls)
|
||||
|
@ -20,11 +20,11 @@ Scheduler base class that all Schedulers should inherit from
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder import db
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.volume import rpcapi as volume_rpcapi
|
||||
|
||||
|
||||
|
@ -10,13 +10,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.utils import excutils
|
||||
import taskflow.engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
from cinder import exception
|
||||
from cinder import flow_utils
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import rpc
|
||||
from cinder import utils
|
||||
|
@ -20,6 +20,7 @@ Manage hosts in the current zone.
|
||||
import UserDict
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
@ -27,7 +28,6 @@ from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common.scheduler import filters
|
||||
from cinder.openstack.common.scheduler import weights
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import utils
|
||||
from cinder.volume import utils as vol_utils
|
||||
|
||||
|
@ -21,6 +21,8 @@ Scheduler Service
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo import messaging
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
@ -28,8 +30,6 @@ from cinder import exception
|
||||
from cinder import flow_utils
|
||||
from cinder.i18n import _
|
||||
from cinder import manager
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import quota
|
||||
from cinder import rpc
|
||||
|
@ -25,10 +25,10 @@ import json
|
||||
import os
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
|
||||
|
||||
scheduler_json_config_location_opt = cfg.StrOpt(
|
||||
|
@ -25,6 +25,7 @@ import random
|
||||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exc
|
||||
from oslo import messaging
|
||||
from oslo.utils import importutils
|
||||
import osprofiler.notifier
|
||||
from osprofiler import profiler
|
||||
import osprofiler.web
|
||||
@ -33,7 +34,6 @@ from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import loopingcall
|
||||
from cinder.openstack.common import processutils
|
||||
|
@ -32,6 +32,8 @@ import mock
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from oslo.messaging import conffixture as messaging_conffixture
|
||||
from oslo.utils import strutils
|
||||
from oslo.utils import timeutils
|
||||
import stubout
|
||||
import testtools
|
||||
from testtools import matchers
|
||||
@ -40,8 +42,6 @@ from cinder.common import config # noqa Need to register global_opts
|
||||
from cinder.db import migration
|
||||
from cinder.db.sqlalchemy import api as sqla_api
|
||||
from cinder.openstack.common import log as oslo_logging
|
||||
from cinder.openstack.common import strutils
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import rpc
|
||||
from cinder import service
|
||||
from cinder.tests import conf_fixture
|
||||
|
@ -15,6 +15,7 @@ import tempfile
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import timeutils
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
@ -23,7 +24,6 @@ from cinder.brick.local_dev import lvm as brick_lvm
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import test
|
||||
from cinder.tests.api import fakes
|
||||
from cinder.tests.api.v2 import stubs
|
||||
|
@ -16,10 +16,10 @@
|
||||
import datetime
|
||||
|
||||
from lxml import etree
|
||||
from oslo.utils import timeutils
|
||||
|
||||
import cinder.api.contrib.availability_zones
|
||||
import cinder.context
|
||||
from cinder.openstack.common import timeutils
|
||||
import cinder.test
|
||||
import cinder.volume.api
|
||||
|
||||
|
@ -21,6 +21,7 @@ import json
|
||||
from xml.dom import minidom
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
import webob
|
||||
|
||||
# needed for stubs to work
|
||||
@ -30,7 +31,6 @@ from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import test
|
||||
from cinder.tests.api import fakes
|
||||
from cinder.tests import utils
|
||||
|
@ -16,13 +16,13 @@
|
||||
import datetime
|
||||
|
||||
from lxml import etree
|
||||
from oslo.utils import timeutils
|
||||
import webob.exc
|
||||
|
||||
from cinder.api.contrib import hosts as os_hosts
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import test
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from oslo.utils import timeutils
|
||||
import webob.exc
|
||||
|
||||
from cinder.api.contrib import services
|
||||
@ -23,7 +24,6 @@ from cinder.api import extensions
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import policy
|
||||
from cinder import test
|
||||
from cinder.tests.api import fakes
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from oslo.utils import timeutils
|
||||
import routes
|
||||
import webob
|
||||
import webob.dec
|
||||
@ -28,7 +29,6 @@ from cinder.api.v2 import limits
|
||||
from cinder.api.v2 import router
|
||||
from cinder.api import versions
|
||||
from cinder import context
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import wsgi
|
||||
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
import uuid
|
||||
|
||||
from lxml import etree
|
||||
from oslo.utils import timeutils
|
||||
import webob
|
||||
|
||||
from cinder.api.v1 import types
|
||||
from cinder.api.views import types as views_types
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import test
|
||||
from cinder.tests.api import fakes
|
||||
from cinder.volume import volume_types
|
||||
|
@ -16,12 +16,12 @@
|
||||
import uuid
|
||||
|
||||
from lxml import etree
|
||||
from oslo.utils import timeutils
|
||||
import webob
|
||||
|
||||
from cinder.api.v2 import types
|
||||
from cinder.api.views import types as views_types
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import test
|
||||
from cinder.tests.api import fakes
|
||||
from cinder.volume import volume_types
|
||||
|
@ -16,7 +16,8 @@
|
||||
Fakes For Scheduler tests.
|
||||
"""
|
||||
|
||||
from cinder.openstack.common import timeutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder.scheduler import filter_scheduler
|
||||
from cinder.scheduler import host_manager
|
||||
|
||||
|
@ -18,10 +18,10 @@ Tests For HostManager
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder import exception
|
||||
from cinder.openstack.common.scheduler import filters
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.scheduler import host_manager
|
||||
from cinder import test
|
||||
|
||||
@ -84,7 +84,7 @@ class HostManagerTestCase(test.TestCase):
|
||||
self.assertEqual(expected, mock_func.call_args_list)
|
||||
self.assertEqual(set(result), set(self.fake_hosts))
|
||||
|
||||
@mock.patch('cinder.openstack.common.timeutils.utcnow')
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
def test_update_service_capabilities(self, _mock_utcnow):
|
||||
service_states = self.host_manager.service_states
|
||||
self.assertDictMatch(service_states, {})
|
||||
|
@ -278,7 +278,7 @@ class SchedulerDriverModuleTestCase(test.TestCase):
|
||||
self.context = context.RequestContext('fake_user', 'fake_project')
|
||||
|
||||
@mock.patch('cinder.db.volume_update')
|
||||
@mock.patch('cinder.openstack.common.timeutils.utcnow')
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
def test_volume_host_update_db(self, _mock_utcnow, _mock_vol_update):
|
||||
_mock_utcnow.return_value = 'fake-now'
|
||||
driver.volume_update_db(self.context, 31337, 'fake_host')
|
||||
|
@ -21,14 +21,14 @@ import tempfile
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder.backup import manager
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import test
|
||||
from cinder.tests.backup.fake_service_with_verify import\
|
||||
get_backup_driver
|
||||
|
@ -20,12 +20,12 @@ import mock
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.brick.initiator import connector
|
||||
from cinder import exception
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder import utils
|
||||
from cinder.volume import configuration as conf
|
||||
|
@ -14,9 +14,9 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder import context
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder import test
|
||||
|
||||
|
||||
|
@ -17,14 +17,14 @@ import copy
|
||||
import json
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
import requests
|
||||
|
||||
from cinder import context
|
||||
from cinder.db.sqlalchemy.models import VolumeMetadata
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.fusionio.ioControl import FIOconnection
|
||||
|
@ -27,6 +27,7 @@ from mox import IgnoreArg
|
||||
from mox import IsA
|
||||
from mox import stubout
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import brick
|
||||
from cinder import compute
|
||||
@ -37,7 +38,6 @@ 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.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder import utils
|
||||
from cinder.volume import configuration as conf
|
||||
|
@ -19,13 +19,13 @@ import tempfile
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
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.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder import utils
|
||||
from cinder.volume import configuration as conf
|
||||
|
@ -20,11 +20,11 @@ import mock
|
||||
import ast
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.tests import fake_hp_3par_client as hp3parclient
|
||||
from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon
|
||||
|
@ -15,11 +15,11 @@
|
||||
#
|
||||
"""Unit tests for OpenStack Cinder volume drivers."""
|
||||
import mock
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.tests import fake_hp_lefthand_client as hplefthandclient
|
||||
from cinder.volume.drivers.san.hp import hp_lefthand_iscsi
|
||||
|
@ -23,11 +23,11 @@ NAS based IBM GPFS Storage Systems).
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.ibm import ibmnas
|
||||
|
@ -21,13 +21,13 @@ import tempfile
|
||||
import mock
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import fileutils
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder import utils
|
||||
from cinder.volume import utils as volume_utils
|
||||
|
@ -21,10 +21,10 @@ import base64
|
||||
import urllib2
|
||||
|
||||
import mox as mox_lib
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers import nexenta
|
||||
|
@ -22,11 +22,11 @@ import mox as mox_lib
|
||||
from mox import IgnoreArg
|
||||
from mox import IsA
|
||||
from mox import stubout
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers import nfs
|
||||
|
@ -17,9 +17,9 @@ import httplib
|
||||
import re
|
||||
|
||||
import mock
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.prophetstor import dpl_iscsi as DPLDRIVER
|
||||
|
@ -17,10 +17,10 @@ import json
|
||||
import urllib2
|
||||
|
||||
import mock
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume.drivers import pure
|
||||
|
||||
|
@ -20,6 +20,7 @@ import datetime
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
|
||||
from cinder import backup
|
||||
from cinder import context
|
||||
@ -27,7 +28,6 @@ from cinder import db
|
||||
from cinder.db.sqlalchemy import api as sqa_api
|
||||
from cinder.db.sqlalchemy import models as sqa_models
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder import quota
|
||||
from cinder import test
|
||||
import cinder.tests.image.fake
|
||||
|
@ -21,14 +21,14 @@ import os
|
||||
import tempfile
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.tests.image import fake as fake_image
|
||||
from cinder.tests.test_volume import DriverTestCase
|
||||
|
@ -17,11 +17,11 @@ Tests for Volume replication code.
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder import test
|
||||
from cinder.tests import utils as test_utils
|
||||
|
||||
|
@ -22,11 +22,11 @@ import shutil
|
||||
import tempfile
|
||||
|
||||
import mox as mox_lib
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder import utils
|
||||
from cinder.volume import configuration as conf
|
||||
|
@ -19,9 +19,10 @@ import contextlib
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume.drivers.sheepdog import SheepdogDriver
|
||||
|
||||
|
@ -15,12 +15,12 @@
|
||||
# under the License.
|
||||
|
||||
import mox
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.solidfire import SolidFireDriver
|
||||
|
@ -23,15 +23,15 @@ import re
|
||||
import time
|
||||
|
||||
import mock
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import importutils
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.tests import utils as testutils
|
||||
from cinder import utils
|
||||
|
@ -22,6 +22,7 @@ import uuid
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import timeutils
|
||||
import paramiko
|
||||
import six
|
||||
|
||||
@ -30,7 +31,6 @@ 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.openstack.common import timeutils
|
||||
from cinder import ssh_utils
|
||||
from cinder import test
|
||||
from cinder import utils
|
||||
@ -390,7 +390,7 @@ class GenericUtilsTestCase(test.TestCase):
|
||||
self.assertEqual(fake_execute.uid, 2)
|
||||
self.assertEqual(fake_execute.uid, os.getuid())
|
||||
|
||||
@mock.patch('cinder.openstack.common.timeutils.utcnow')
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
def test_service_is_up(self, mock_utcnow):
|
||||
fts_func = datetime.datetime.fromtimestamp
|
||||
fake_now = 1000
|
||||
|
@ -18,8 +18,8 @@ Unit tests for datastore module.
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume.drivers.vmware import datastore as ds_sel
|
||||
from cinder.volume.drivers.vmware import error_util
|
||||
|
@ -22,10 +22,10 @@ import os
|
||||
|
||||
import mock
|
||||
import mox
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder import exception
|
||||
from cinder.image import glance
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration
|
||||
from cinder.volume.drivers.vmware import api
|
||||
|
@ -18,8 +18,8 @@ Test suite for VMware VMDK driver volumeops module.
|
||||
"""
|
||||
|
||||
import mock
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume.drivers.vmware import error_util
|
||||
from cinder.volume.drivers.vmware import vim_util
|
||||
|
@ -31,6 +31,9 @@ import mock
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import importutils
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
from stevedore import extension
|
||||
from taskflow.engines.action_engine import engine
|
||||
|
||||
@ -43,10 +46,7 @@ from cinder import exception
|
||||
from cinder.image import image_utils
|
||||
from cinder import keymgr
|
||||
from cinder.openstack.common import fileutils
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import units
|
||||
import cinder.policy
|
||||
from cinder import quota
|
||||
from cinder import test
|
||||
|
@ -20,11 +20,11 @@ import re
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder import context
|
||||
from cinder import db
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder import test
|
||||
|
@ -19,8 +19,9 @@ import mock
|
||||
|
||||
from json import JSONEncoder
|
||||
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.zfssa import restclient as client
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
import paramiko
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
|
@ -18,9 +18,9 @@
|
||||
"""Unit tests for Cisco FC zone driver."""
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder import exception
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
|
@ -18,10 +18,9 @@
|
||||
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import cinder.openstack.common.importutils
|
||||
from oslo.utils import importutils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
API = cinder.openstack.common.importutils.import_class(CONF.transfer_api_class)
|
||||
API = importutils.import_class(CONF.transfer_api_class)
|
||||
|
@ -23,11 +23,11 @@ import hmac
|
||||
import os
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from cinder.db import base
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import quota
|
||||
from cinder.volume import api as volume_api
|
||||
|
@ -36,16 +36,16 @@ from xml.sax import expatreader
|
||||
from xml.sax import saxutils
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import importutils
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from cinder.brick.initiator import connector
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import importutils
|
||||
from cinder.openstack.common import lockutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder.openstack.common import timeutils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -17,11 +17,11 @@
|
||||
# Importing full names to not pollute the namespace and cause possible
|
||||
# collisions with use of 'from cinder.volume import <foo>' elsewhere.
|
||||
|
||||
from oslo.utils import importutils
|
||||
|
||||
from cinder.common import config
|
||||
import cinder.openstack.common.importutils as import_utils
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
API = import_utils.import_class(CONF.volume_api_class)
|
||||
API = importutils.import_class(CONF.volume_api_class)
|
||||
|
@ -24,6 +24,8 @@ import datetime
|
||||
import functools
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
@ -33,9 +35,7 @@ from cinder import flow_utils
|
||||
from cinder.i18n import _
|
||||
from cinder.image import glance
|
||||
from cinder import keymgr
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import timeutils
|
||||
from cinder.openstack.common import uuidutils
|
||||
import cinder.policy
|
||||
from cinder import quota
|
||||
|
@ -20,11 +20,11 @@ Drivers for volumes.
|
||||
import time
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import fileutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils
|
||||
|
@ -28,13 +28,13 @@ import urllib2
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import units
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
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 units
|
||||
from cinder.volume import driver
|
||||
from cinder.volume import volume_types
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
import json
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
import requests
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder.volume.drivers.san import san
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -23,17 +23,17 @@ import time
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils as json
|
||||
from oslo.utils import excutils
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from cinder import exception
|
||||
from cinder.exception import EMCVnxCLICmdError
|
||||
from cinder.i18n import _, _LE, _LI, _LW
|
||||
from cinder.openstack.common import excutils
|
||||
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.openstack.common import timeutils
|
||||
from cinder import utils
|
||||
from cinder.volume.configuration import Configuration
|
||||
from cinder.volume.drivers.san import san
|
||||
|
@ -22,10 +22,10 @@ import eventlet
|
||||
from eventlet import greenthread
|
||||
import greenlet
|
||||
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 excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder import ssh_utils
|
||||
|
@ -26,13 +26,13 @@ import time
|
||||
from xml.dom.minidom import parseString
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
import six
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LW
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import loopingcall
|
||||
from cinder.openstack.common import units
|
||||
from cinder.volume import volume_types
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -24,13 +24,13 @@ import random
|
||||
import uuid
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
import requests
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import loopingcall
|
||||
from cinder.openstack.common import units
|
||||
from cinder.volume.drivers.san.san import SanISCSIDriver
|
||||
from cinder.volume import qos_specs
|
||||
from cinder.volume import volume_types
|
||||
|
@ -19,6 +19,7 @@ import stat
|
||||
import time
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.brick.remotefs import remotefs as remotefs_brick
|
||||
from cinder import compute
|
||||
@ -29,7 +30,6 @@ 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.openstack.common import units
|
||||
from cinder import utils
|
||||
from cinder.volume.drivers import remotefs as remotefs_drv
|
||||
|
||||
|
@ -22,10 +22,10 @@ iSCSI Cinder Volume driver for Hitachi Unified Storage (HUS) platform.
|
||||
from xml.etree import ElementTree as ETree
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import utils
|
||||
from cinder.volume import driver
|
||||
|
@ -20,8 +20,9 @@ Hitachi Unified Storage (HUS-HNAS) platform. Backend operations.
|
||||
|
||||
import re
|
||||
|
||||
from oslo.utils import units
|
||||
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder import utils
|
||||
|
||||
LOG = logging.getLogger("cinder.volume.driver")
|
||||
|
@ -21,12 +21,12 @@ iSCSI Cinder Volume driver for Hitachi Unified Storage (HUS-HNAS) platform.
|
||||
from xml.etree import ElementTree as ETree
|
||||
|
||||
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
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import units
|
||||
from cinder.volume import driver
|
||||
from cinder.volume.drivers.hds.hnas_backend import HnasBackend
|
||||
from cinder.volume import utils
|
||||
|
@ -22,14 +22,14 @@ import time
|
||||
from xml.etree import ElementTree as ETree
|
||||
|
||||
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
|
||||
from cinder.image import image_utils
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils
|
||||
from cinder.openstack.common import units
|
||||
from cinder.volume.drivers.hds.hnas_backend import HnasBackend
|
||||
from cinder.volume.drivers import nfs
|
||||
|
||||
|
@ -16,11 +16,11 @@ import inspect
|
||||
import os
|
||||
import shlex
|
||||
|
||||
from oslo.utils import excutils
|
||||
import six
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import lockutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder.openstack.common import processutils as putils
|
||||
|
@ -21,13 +21,13 @@ import re
|
||||
import threading
|
||||
|
||||
from oslo.config import cfg
|
||||
from oslo.utils import excutils
|
||||
import six
|
||||
|
||||
from cinder.db.sqlalchemy import api
|
||||
from cinder.db.sqlalchemy import models
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.openstack.common import excutils
|
||||
from cinder.openstack.common import log as logging
|
||||
from cinder import utils
|
||||
from cinder.volume.drivers.hitachi import hbsd_basiclib as basic_lib
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user