Use oslo.utils

oslo.utils library now provides the functionality previously in
oslo-incubator's excutils, importutils, network_utils, strutils
timeutils, units etc. Some modules already moved to oslo.utils
will still be around since other code in nova/openstack/common/
are using it and will be removed in a subsequent commit.

Change-Id: Idc716342535fdfa680963e0e073ddb46f5f1eb34
This commit is contained in:
Davanum Srinivas 2014-07-30 14:40:43 -07:00
parent 97f60c138c
commit 323fa6fef7
225 changed files with 324 additions and 522 deletions

View File

@ -20,6 +20,8 @@ Starting point for routing EC2 requests.
from eventlet.green import httplib
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
import six
import six.moves.urllib.parse as urlparse
import webob
@ -36,11 +38,9 @@ from nova.i18n import _
from nova.i18n import _LE
from nova.i18n import _LW
from nova.openstack.common import context as common_context
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import memorycache
from nova.openstack.common import timeutils
from nova import utils
from nova import wsgi

View File

@ -23,12 +23,12 @@ import datetime
from xml.dom import minidom
from lxml import etree
from oslo.utils import encodeutils
import six
from nova.api.ec2 import ec2utils
from nova import exception
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
LOG = logging.getLogger(__name__)
@ -137,6 +137,6 @@ class APIRequest(object):
xml.createTextNode(_database_to_isoformat(data)))
elif data is not None:
data_el.appendChild(xml.createTextNode(
strutils.safe_encode(six.text_type(data))))
encodeutils.safe_encode(six.text_type(data))))
return data_el

View File

@ -24,6 +24,7 @@ import base64
import time
from oslo.config import cfg
from oslo.utils import timeutils
from nova.api.ec2 import ec2utils
from nova.api.ec2 import inst_state
@ -45,7 +46,6 @@ from nova.network.security_group import neutron_driver
from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import quota
from nova import servicegroup
from nova import utils

View File

@ -17,6 +17,8 @@
import functools
import re
from oslo.utils import timeutils
from nova import availability_zones
from nova import context
from nova import exception
@ -26,7 +28,6 @@ from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common import log as logging
from nova.openstack.common import memorycache
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
LOG = logging.getLogger(__name__)

View File

@ -21,6 +21,8 @@ import os
import posixpath
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from nova.api.ec2 import ec2utils
from nova.api.metadata import password
@ -31,10 +33,8 @@ from nova import context
from nova import network
from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import utils
from nova.virt import netutils

View File

@ -15,6 +15,7 @@
import os.path
import traceback
from oslo.utils import strutils
import six
import webob
from webob import exc
@ -28,7 +29,6 @@ from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
LOG = logging.getLogger(__name__)

View File

@ -17,6 +17,7 @@
import netaddr
from oslo.config import cfg
from oslo.utils import importutils
import webob
from nova.api.openstack import extensions
@ -24,7 +25,6 @@ from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova.i18n import _
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.virt.baremetal import db

View File

@ -18,6 +18,8 @@
from oslo.config import cfg
from oslo import messaging
from oslo.utils import strutils
from oslo.utils import timeutils
import six
from webob import exc
@ -29,8 +31,6 @@ from nova.cells import rpcapi as cells_rpcapi
from nova.compute import api as compute
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
from nova import rpc

View File

@ -15,6 +15,7 @@
"""Connect your vlan to the world."""
from oslo.config import cfg
from oslo.utils import timeutils
from webob import exc
from nova.api.openstack import extensions
@ -28,7 +29,6 @@ from nova import exception
from nova.i18n import _
from nova import network
from nova.openstack.common import fileutils
from nova.openstack.common import timeutils
from nova import utils
CONF = cfg.CONF

View File

@ -14,13 +14,13 @@
"""Disk Config extension."""
from oslo.utils import strutils
from webob import exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.i18n import _
from nova.openstack.common import strutils
ALIAS = 'OS-DCF'
XMLNS_DCF = "http://docs.openstack.org/compute/ext/disk_config/api/v1.1"

View File

@ -13,6 +13,7 @@
# under the License.
from oslo.utils import strutils
from webob import exc
from nova.api.openstack import common
@ -21,7 +22,6 @@ from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
from nova import utils
authorize = extensions.extension_authorizer('compute', 'evacuate')

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
import six.moves.urllib.parse as urlparse
import webob
@ -24,7 +25,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova import quota
from nova import utils

View File

@ -16,6 +16,7 @@
import datetime
import iso8601
from oslo.utils import timeutils
import six.moves.urllib.parse as urlparse
from webob import exc
@ -26,7 +27,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import instance as instance_obj
from nova.openstack.common import timeutils
authorize_show = extensions.extension_authorizer('compute',
'simple_tenant_usage:show')

View File

@ -15,6 +15,7 @@
"""The volumes extension."""
from oslo.utils import strutils
import webob
from webob import exc
@ -27,7 +28,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova.openstack.common import uuidutils
from nova import volume

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
import webob
from nova.api.openstack import common
@ -22,7 +23,6 @@ from nova.api.openstack import xmlutil
from nova.compute import flavors
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
from nova import utils

View File

@ -38,6 +38,7 @@ import math
import re
import time
from oslo.utils import importutils
import webob.dec
import webob.exc
@ -45,7 +46,6 @@ from nova.api.openstack.compute.views import limits as limits_views
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.i18n import _
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova import quota
from nova import utils

View File

@ -15,13 +15,13 @@
"""The legacy block device mappings extension."""
from oslo.utils import strutils
from webob import exc
from nova.api.openstack import extensions
from nova import block_device
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
ALIAS = "os-block-device-mapping-v1"
ATTRIBUTE_NAME = "block_device_mapping"

View File

@ -18,6 +18,7 @@
from oslo.config import cfg
from oslo import messaging
from oslo.utils import strutils
import six
from webob import exc
@ -29,7 +30,6 @@ from nova.cells import rpcapi as cells_rpcapi
from nova.compute import api as compute
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
from nova import rpc

View File

@ -14,6 +14,7 @@
from oslo.config import cfg
from oslo.utils import strutils
from webob import exc
from nova.api.openstack import common
@ -24,7 +25,6 @@ from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
from nova import utils
CONF = cfg.CONF

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
import webob
from nova.api.openstack import common
@ -22,7 +23,6 @@ from nova.api.openstack import wsgi
from nova.compute import flavors
from nova import exception
from nova.i18n import _
from nova.openstack.common import strutils
from nova import utils
ALIAS = 'flavors'

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
import webob
from webob import exc
@ -23,7 +24,6 @@ from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
from nova.openstack.common import strutils
ALIAS = "os-migrate-server"

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import strutils
import six.moves.urllib.parse as urlparse
import webob
@ -25,7 +26,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova import quota

View File

@ -19,6 +19,8 @@ import re
from oslo.config import cfg
from oslo import messaging
from oslo.utils import strutils
from oslo.utils import timeutils
import six
import stevedore
import webob
@ -38,8 +40,6 @@ from nova.i18n import _LW
from nova.image import glance
from nova import objects
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import policy
from nova import utils

View File

@ -16,6 +16,7 @@
import datetime
import iso8601
from oslo.utils import timeutils
import six.moves.urllib.parse as urlparse
from webob import exc
@ -24,7 +25,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import instance as instance_obj
from nova.openstack.common import timeutils
ALIAS = "os-simple-tenant-usage"
authorize_show = extensions.extension_authorizer('compute',

View File

@ -15,6 +15,7 @@
"""The volumes extension."""
from oslo.utils import strutils
import webob
from webob import exc
@ -24,7 +25,6 @@ from nova.api.openstack import wsgi
from nova import exception
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova import volume
ALIAS = "os-volumes"

View File

@ -20,6 +20,8 @@ import re
from oslo.config import cfg
from oslo import messaging
from oslo.utils import strutils
from oslo.utils import timeutils
import six
import webob
from webob import exc
@ -37,8 +39,6 @@ from nova.i18n import _
from nova.i18n import _LW
from nova import objects
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import policy
from nova import utils

View File

@ -15,11 +15,11 @@
from lxml import etree
from oslo.config import cfg
from oslo.utils import timeutils
from nova.api.openstack.compute.views import versions as views_versions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova.openstack.common import timeutils
CONF = cfg.CONF

View File

@ -14,9 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from nova.api.openstack import common
from nova.image import glance
from nova.openstack.common import timeutils
class ViewBuilder(common.ViewBuilder):

View File

@ -15,7 +15,7 @@
import datetime
from nova.openstack.common import timeutils
from oslo.utils import timeutils
class ViewBuilder(object):

View File

@ -16,6 +16,8 @@
import hashlib
from oslo.utils import timeutils
from nova.api.openstack import common
from nova.api.openstack.compute.views import addresses as views_addresses
from nova.api.openstack.compute.views import flavors as views_flavors
@ -24,7 +26,6 @@ from nova.compute import flavors
from nova.i18n import _LW
from nova.objects import base as obj_base
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import utils

View File

@ -18,6 +18,7 @@ import abc
import functools
import os
from oslo.utils import importutils
import six
import webob.dec
import webob.exc
@ -28,7 +29,6 @@ from nova.api.openstack import xmlutil
from nova import exception
from nova.i18n import _
from nova.i18n import _LW
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
import nova.policy

View File

@ -19,12 +19,12 @@ Internal implementation of request Body validating middleware.
import base64
import jsonschema
from oslo.utils import timeutils
import rfc3986
import six
from nova import exception
from nova.i18n import _
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils

View File

@ -16,11 +16,11 @@
import re
from oslo.config import cfg
from oslo.utils import strutils
from nova import exception
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova import utils
from nova.virt import driver

View File

@ -21,6 +21,8 @@ import time
from oslo.config import cfg
from oslo import messaging as oslo_messaging
from oslo.utils import importutils
from oslo.utils import timeutils
from nova.cells import messaging
from nova.cells import state as cells_state
@ -31,10 +33,8 @@ from nova.i18n import _
from nova import manager
from nova import objects
from nova.objects import base as base_obj
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import periodic_task
from nova.openstack.common import timeutils
cell_manager_opts = [
cfg.StrOpt('driver',

View File

@ -32,6 +32,9 @@ import traceback
from eventlet import queue
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import importutils
from oslo.utils import timeutils
import six
from nova.cells import state as cells_state
@ -48,11 +51,8 @@ from nova.i18n import _
from nova.network import model as network_model
from nova import objects
from nova.objects import base as objects_base
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import rpc
from nova import utils

View File

@ -23,6 +23,8 @@ import time
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.utils import timeutils
from oslo.utils import units
from nova.cells import rpc_driver
from nova import context
@ -32,8 +34,6 @@ from nova.i18n import _
from nova.openstack.common import fileutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.openstack.common import units
from nova import rpc
from nova import utils

View File

@ -19,11 +19,11 @@ downgrade its likelihood of being chosen for scheduling requests.
"""
from oslo.config import cfg
from oslo.utils import timeutils
from nova.cells import weights
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
LOG = logging.getLogger(__name__)

View File

@ -27,14 +27,15 @@ import threading
import time
from wsgiref import simple_server
from oslo.utils import excutils
from oslo.utils import units
from nova import config
from nova import context as nova_context
from nova.i18n import _
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import units
from nova import utils
from nova.virt.baremetal import baremetal_states
from nova.virt.baremetal import db

View File

@ -25,6 +25,7 @@ import sys
import traceback
from oslo.config import cfg
from oslo.utils import importutils
from nova.conductor import rpcapi as conductor_rpcapi
from nova import config
@ -35,7 +36,6 @@ from nova.i18n import _
from nova.network import rpcapi as network_rpcapi
from nova import objects
from nova.objects import base as objects_base
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova import rpc

View File

@ -62,6 +62,7 @@ import decorator
import netaddr
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
import six
from nova.api.ec2 import ec2utils
@ -75,7 +76,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import cliutils
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova import quota
from nova import rpc

View File

@ -14,11 +14,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import importutils
# Importing full names to not pollute the namespace and cause possible
# collisions with use of 'from nova.compute import <foo>' elsewhere.
import nova.cells.opts
import nova.exception
import nova.openstack.common.importutils
CELL_TYPE_TO_CLS_NAME = {'api': 'nova.compute.cells_api.ComputeCellsAPI',
@ -34,7 +35,6 @@ def _get_compute_api_class_name():
def API(*args, **kwargs):
importutils = nova.openstack.common.importutils
class_name = _get_compute_api_class_name()
return importutils.import_object(class_name, *args, **kwargs)
@ -43,7 +43,6 @@ def HostAPI(*args, **kwargs):
"""Returns the 'HostAPI' class from the same module as the configured
compute api
"""
importutils = nova.openstack.common.importutils
compute_api_class_name = _get_compute_api_class_name()
compute_api_class = importutils.import_class(compute_api_class_name)
class_name = compute_api_class.__module__ + ".HostAPI"
@ -54,7 +53,6 @@ def InstanceActionAPI(*args, **kwargs):
"""Returns the 'InstanceActionAPI' class from the same module as the
configured compute api.
"""
importutils = nova.openstack.common.importutils
compute_api_class_name = _get_compute_api_class_name()
compute_api_class = importutils.import_class(compute_api_class_name)
class_name = compute_api_class.__module__ + ".InstanceActionAPI"

View File

@ -26,6 +26,9 @@ import string
import uuid
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import strutils
from oslo.utils import timeutils
import six
from nova import availability_zones
@ -56,11 +59,8 @@ from nova import objects
from nova.objects import base as obj_base
from nova.objects import quotas as quotas_obj
from nova.objects import security_group as security_group_obj
from nova.openstack.common import excutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova.pci import pci_request
import nova.policy

View File

@ -23,6 +23,7 @@ import uuid
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.utils import strutils
import six
from nova import context
@ -31,7 +32,6 @@ from nova import exception
from nova.i18n import _
from nova.i18n import _LE
from nova.openstack.common import log as logging
from nova.openstack.common import strutils
from nova import utils
flavor_opts = [

View File

@ -40,6 +40,9 @@ from eventlet import greenthread
import eventlet.timeout
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import strutils
from oslo.utils import timeutils
import six
from nova import block_device
@ -72,12 +75,9 @@ from nova import objects
from nova.objects import base as obj_base
from nova.objects import instance as instance_obj
from nova.objects import quotas as quotas_obj
from nova.openstack.common import excutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import periodic_task
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
from nova import paths
from nova import rpc
from nova import safe_utils

View File

@ -24,12 +24,12 @@ import functools
import types
from oslo.config import cfg
from oslo.utils import timeutils
import six
from nova.i18n import _
from nova import loadables
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
compute_monitors_opts = [
cfg.MultiStrOpt('compute_available_monitors',

View File

@ -18,13 +18,13 @@ CPU monitor based on compute driver to retrieve CPU information
"""
from oslo.config import cfg
from oslo.utils import timeutils
from nova.compute import monitors
from nova.compute.monitors import cpu_monitor as monitor
from nova import exception
from nova.i18n import _
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
CONF = cfg.CONF
CONF.import_opt('compute_driver', 'nova.virt.driver')

View File

@ -21,6 +21,7 @@ model.
import copy
from oslo.config import cfg
from oslo.utils import importutils
from nova.compute import claims
from nova.compute import flavors
@ -33,7 +34,6 @@ from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.pci import pci_manager

View File

@ -18,6 +18,8 @@ import copy
import itertools
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import timeutils
import six
from nova.api.ec2 import ec2utils
@ -39,10 +41,8 @@ from nova.network.security_group import openstack_driver
from nova import notifications
from nova import objects
from nova.objects import base as nova_object
from nova.openstack.common import excutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import quota
from nova.scheduler import client as scheduler_client
from nova.scheduler import driver as scheduler_driver

View File

@ -19,11 +19,11 @@ import socket
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from nova.compute import rpcapi as compute_rpcapi
from nova import exception
from nova import manager
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova import utils

View File

@ -16,11 +16,11 @@
"""VMRC Console Manager."""
from oslo.config import cfg
from oslo.utils import importutils
from nova.compute import rpcapi as compute_rpcapi
from nova import exception
from nova import manager
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import driver as vmwareapi_conn

View File

@ -20,11 +20,11 @@ import signal
import jinja2
from oslo.config import cfg
from oslo.utils import excutils
from nova import context
from nova import db
from nova.i18n import _
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova import paths

View File

@ -19,6 +19,7 @@
import copy
from oslo.utils import timeutils
import six
from nova import exception
@ -26,7 +27,6 @@ from nova.i18n import _
from nova.openstack.common import context
from nova.openstack.common import local
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import policy

View File

@ -29,6 +29,8 @@ import string
import struct
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import timeutils
from pyasn1.codec.der import encoder as der_encoder
from pyasn1.type import univ
@ -36,11 +38,9 @@ from nova import context
from nova import db
from nova import exception
from nova.i18n import _
from nova.openstack.common import excutils
from nova.openstack.common import fileutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import timeutils
from nova import paths
from nova import utils

View File

@ -17,8 +17,7 @@
"""Base class for classes that need modular database access."""
from oslo.config import cfg
from nova.openstack.common import importutils
from oslo.utils import importutils
db_driver_opt = cfg.StrOpt('db_driver',
default='nova.db',

View File

@ -30,6 +30,8 @@ from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo.db.sqlalchemy import session as db_session
from oslo.db.sqlalchemy import utils as sqlalchemyutils
from oslo.utils import excutils
from oslo.utils import timeutils
import six
from sqlalchemy import and_
from sqlalchemy import Boolean
@ -58,9 +60,7 @@ import nova.context
from nova.db.sqlalchemy import models
from nova import exception
from nova.i18n import _
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import quota

View File

@ -14,6 +14,7 @@
# under the License.
from oslo.utils import timeutils
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
@ -24,8 +25,6 @@ from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy import Text
from nova.openstack.common import timeutils
def upgrade(engine):
meta = MetaData()

View File

@ -21,6 +21,7 @@ SQLAlchemy models for nova data.
from oslo.config import cfg
from oslo.db.sqlalchemy import models
from oslo.utils import timeutils
from sqlalchemy import Column, Index, Integer, BigInteger, Enum, String, schema
from sqlalchemy.dialects.mysql import MEDIUMTEXT
from sqlalchemy.ext.declarative import declarative_base
@ -28,7 +29,6 @@ from sqlalchemy import orm
from sqlalchemy import ForeignKey, DateTime, Boolean, Text, Float
from nova.db.sqlalchemy import types
from nova.openstack.common import timeutils
CONF = cfg.CONF
BASE = declarative_base()
@ -43,16 +43,6 @@ class NovaBase(models.SoftDeleteMixin,
models.ModelBase):
metadata = None
# TODO(ekudryashova): remove this after both nova and oslo.db
# will use oslo.utils library
# NOTE: Both projects(nova and oslo.db) use `timeutils.utcnow`, which
# returns specified time(if override_time is set). Time overriding is
# only used by unit tests, but in a lot of places, temporarily overriding
# this columns helps to avoid lots of calls of timeutils.set_override
# from different places in unit tests.
created_at = Column(DateTime, default=lambda: timeutils.utcnow())
updated_at = Column(DateTime, onupdate=lambda: timeutils.utcnow())
def save(self, session=None):
from nova.db.sqlalchemy import api

View File

@ -26,10 +26,10 @@ import functools
import sys
from oslo.config import cfg
from oslo.utils import excutils
import webob.exc
from nova.i18n import _
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova import safe_utils

View File

@ -26,6 +26,7 @@ import time
import glanceclient
import glanceclient.exc
from oslo.config import cfg
from oslo.utils import timeutils
import six
import six.moves.urllib.parse as urlparse
@ -34,7 +35,6 @@ from nova.i18n import _
import nova.image.download as image_xfers
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import utils

View File

@ -15,8 +15,7 @@
from oslo.config import cfg
from nova.openstack.common import importutils
from oslo.utils import importutils
keymgr_opts = [

View File

@ -42,8 +42,9 @@ import inspect
import os
import sys
from oslo.utils import importutils
from nova import exception
from nova.openstack.common import importutils
class BaseLoader(object):

View File

@ -15,10 +15,7 @@
# under the License.
import oslo.config.cfg
# Importing full names to not pollute the namespace and cause possible
# collisions with use of 'from nova.network import <foo>' elsewhere.
import nova.openstack.common.importutils
from oslo.utils import importutils
_network_opts = [
oslo.config.cfg.StrOpt('network_api_class',
@ -31,7 +28,6 @@ oslo.config.cfg.CONF.register_opts(_network_opts)
def API():
importutils = nova.openstack.common.importutils
network_api_class = oslo.config.cfg.CONF.network_api_class
if 'quantumv2' in network_api_class:
network_api_class = network_api_class.replace('quantumv2', 'neutronv2')

View File

@ -16,12 +16,13 @@
import functools
import inspect
from oslo.utils import excutils
from nova.db import base
from nova import hooks
from nova.i18n import _
from nova.network import model as network_model
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging

View File

@ -15,9 +15,9 @@
import sys
from oslo.config import cfg
from oslo.utils import importutils
from nova.i18n import _
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
driver_opts = [

View File

@ -17,6 +17,8 @@
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import importutils
import six
from nova import context
@ -25,8 +27,6 @@ from nova import exception
from nova.i18n import _
from nova.network import rpcapi as network_rpcapi
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import uuidutils

View File

@ -24,18 +24,18 @@ import re
import netaddr
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import importutils
from oslo.utils import timeutils
import six
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import fileutils
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import timeutils
from nova import paths
from nova import utils

View File

@ -35,6 +35,10 @@ import eventlet
import netaddr
from oslo.config import cfg
from oslo import messaging
from oslo.utils import excutils
from oslo.utils import importutils
from oslo.utils import strutils
from oslo.utils import timeutils
from nova import conductor
from nova import context
@ -50,12 +54,8 @@ from nova.network import rpcapi as network_rpcapi
from nova import objects
from nova.objects import base as obj_base
from nova.objects import quotas as quotas_obj
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import periodic_task
from nova.openstack.common import strutils
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import servicegroup
from nova import utils

View File

@ -20,6 +20,7 @@ import uuid
from neutronclient.common import exceptions as neutron_client_exc
from oslo.config import cfg
from oslo.utils import excutils
from nova.api.openstack import extensions
from nova.compute import flavors
@ -33,7 +34,6 @@ from nova.network import neutronv2
from nova.network.neutronv2 import constants
from nova.network.security_group import openstack_driver
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.openstack.common import uuidutils

View File

@ -18,6 +18,7 @@ import sys
from neutronclient.common import exceptions as n_exc
from neutronclient.neutron import v2_0 as neutronv20
from oslo.config import cfg
from oslo.utils import excutils
import six
from webob import exc
@ -27,7 +28,6 @@ from nova.i18n import _
from nova.network import neutronv2
from nova.network.security_group import security_group_base
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova.openstack.common import uuidutils
from nova import utils

View File

@ -14,8 +14,7 @@
# under the License.
from oslo.config import cfg
from nova.openstack.common import importutils
from oslo.utils import importutils
security_group_opts = [
cfg.StrOpt('security_group_api',

View File

@ -21,6 +21,8 @@ the system.
import datetime
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import timeutils
import six
from nova.compute import flavors
@ -32,9 +34,7 @@ from nova import network
from nova.network import model as network_model
from nova.objects import base as obj_base
from nova.openstack.common import context as common_context
from nova.openstack.common import excutils
from nova.openstack.common import log
from nova.openstack.common import timeutils
from nova import rpc
from nova import utils

View File

@ -22,6 +22,7 @@ import traceback
import netaddr
from oslo import messaging
from oslo.utils import timeutils
import six
from nova import context
@ -30,7 +31,6 @@ from nova.i18n import _, _LE
from nova import objects
from nova.objects import fields
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.openstack.common import versionutils

View File

@ -17,11 +17,11 @@ import datetime
import iso8601
import netaddr
from oslo.utils import timeutils
import six
from nova.i18n import _
from nova.network import model as network_model
from nova.openstack.common import timeutils
class KeyTypeError(TypeError):

View File

@ -12,12 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from nova import db
from nova import exception
from nova import objects
from nova.objects import base as obj_base
from nova.objects import fields
from nova.openstack.common import timeutils
from nova import utils

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from nova.cells import opts as cells_opts
from nova.cells import rpcapi as cells_rpcapi
from nova.compute import flavors
@ -23,7 +25,6 @@ from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import utils
from oslo.config import cfg

View File

@ -12,11 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
from nova import db
from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.openstack.common import timeutils
class InstanceAction(base.NovaPersistentObject, base.NovaObject):

View File

@ -18,7 +18,7 @@
from oslo.config import cfg
from nova.openstack.common import timeutils
from oslo.utils import timeutils
memcache_opts = [
cfg.ListOpt('memcached_servers',

View File

@ -1,159 +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 nova.openstack.common.gettextutils import _LW
from nova.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'))

View File

@ -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

View File

@ -19,15 +19,15 @@
import datetime
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
import six
from nova import db
from nova import exception
from nova.i18n import _
from nova import objects
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
LOG = logging.getLogger(__name__)

View File

@ -15,7 +15,7 @@
import functools
from nova.openstack.common import importutils
from oslo.utils import importutils
class LazyLoader(object):

View File

@ -22,6 +22,8 @@ Scheduler base class that all Schedulers should inherit from
import sys
from oslo.config import cfg
from oslo.utils import importutils
from oslo.utils import timeutils
from nova.compute import utils as compute_utils
from nova.compute import vm_states
@ -29,9 +31,7 @@ from nova import db
from nova import exception
from nova.i18n import _, _LW
from nova import notifications
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import rpc
from nova import servicegroup

View File

@ -44,13 +44,13 @@ the Open Attestation project at:
"""
from oslo.config import cfg
from oslo.utils import timeutils
import requests
from nova import context
from nova import db
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.scheduler import filters
LOG = logging.getLogger(__name__)

View File

@ -21,6 +21,7 @@ import collections
import UserDict
from oslo.config import cfg
from oslo.utils import timeutils
from nova.compute import task_states
from nova.compute import vm_states
@ -29,7 +30,6 @@ from nova import exception
from nova.i18n import _, _LW
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.pci import pci_stats
from nova.scheduler import filters
from nova.scheduler import weights

View File

@ -22,10 +22,10 @@ ram from a host / node as it is supporting Baremetal hosts, which can not be
subdivided into multiple instances.
"""
from oslo.config import cfg
from oslo.utils import timeutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
import nova.scheduler.base_baremetal_host_manager as bbhm
from nova.scheduler import host_manager

View File

@ -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 nova.compute import rpcapi as compute_rpcapi
from nova.compute import utils as compute_utils
@ -28,8 +30,6 @@ from nova.compute import vm_states
from nova import exception
from nova import manager
from nova import objects
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import periodic_task

View File

@ -24,12 +24,12 @@ import datetime
import os
from oslo.config import cfg
from oslo.utils import excutils
from oslo.utils import timeutils
from nova.i18n import _
from nova.openstack.common import excutils
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
scheduler_json_config_location_opt = cfg.StrOpt(

View File

@ -23,6 +23,7 @@ import sys
from oslo.config import cfg
from oslo import messaging
from oslo.utils import importutils
from nova import baserpc
from nova import conductor
@ -31,7 +32,6 @@ from nova import debugger
from nova import exception
from nova.i18n import _
from nova.objects import base as objects_base
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import processutils
from nova.openstack.common import service

View File

@ -19,9 +19,9 @@
import random
from oslo.config import cfg
from oslo.utils import importutils
from nova.i18n import _
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova import utils

View File

@ -14,13 +14,13 @@
# limitations under the License.
from oslo.config import cfg
from oslo.utils import timeutils
import six
from nova import conductor
from nova import context
from nova.i18n import _, _LE
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.servicegroup import api

View File

@ -18,13 +18,13 @@
# limitations under the License.
from oslo.config import cfg
from oslo.utils import timeutils
from nova import conductor
from nova import context
from nova.i18n import _, _LE
from nova.openstack.common import log as logging
from nova.openstack.common import memorycache
from nova.openstack.common import timeutils
from nova.servicegroup import api

View File

@ -18,10 +18,10 @@ import os
import eventlet
from oslo.config import cfg
from oslo.utils import importutils
from nova import exception
from nova.i18n import _, _LE
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import loopingcall
from nova.servicegroup import api

View File

@ -36,6 +36,7 @@ import uuid
import fixtures
from oslo.config import cfg
from oslo.messaging import conffixture as messaging_conffixture
from oslo.utils import timeutils
import testtools
from nova import context
@ -48,7 +49,6 @@ from nova.objects import base as objects_base
from nova.openstack.common.fixture import logging as log_fixture
from nova.openstack.common.fixture import moxstubout
from nova.openstack.common import log as nova_logging
from nova.openstack.common import timeutils
from nova import paths
from nova import rpc
from nova import service

View File

@ -18,8 +18,9 @@
import copy
from oslo.utils import timeutils
from nova.api.ec2 import apirequest
from nova.openstack.common import timeutils
from nova import test

View File

@ -28,6 +28,7 @@ import fixtures
import iso8601
import mock
from oslo.config import cfg
from oslo.utils import timeutils
from nova.api.ec2 import cloud
from nova.api.ec2 import ec2utils
@ -51,7 +52,6 @@ from nova import objects
from nova.objects import base as obj_base
from nova.openstack.common import log as logging
from nova.openstack.common import policy as common_policy
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import policy
from nova import test

View File

@ -17,6 +17,7 @@
import datetime
from oslo.config import cfg
from oslo.utils import timeutils
from nova.api.ec2 import cloud
from nova.api.ec2 import ec2utils
@ -24,7 +25,6 @@ from nova.compute import utils as compute_utils
from nova import context
from nova import db
from nova import exception
from nova.openstack.common import timeutils
from nova import test
from nova.tests import cast_as_call
from nova.tests import fake_network

View File

@ -18,6 +18,7 @@ from eventlet.green import httplib
from lxml import etree
import mox
from oslo.config import cfg
from oslo.utils import timeutils
import webob
import webob.dec
import webob.exc
@ -25,7 +26,6 @@ import webob.exc
from nova.api import ec2
from nova import context
from nova import exception
from nova.openstack.common import timeutils
from nova import test
from nova import wsgi

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.utils import timeutils
import webob
from nova.api.openstack import common
@ -24,7 +25,6 @@ import nova.context
from nova import exception
from nova import objects
from nova.openstack.common import jsonutils
from nova.openstack.common import timeutils
from nova.openstack.common import uuidutils
from nova import test
from nova.tests.api.openstack import fakes

View File

@ -16,6 +16,7 @@
import copy
from lxml import etree
from oslo.utils import timeutils
from webob import exc
from nova.api.openstack.compute.contrib import cells as cells_ext_v2
@ -25,7 +26,6 @@ from nova.api.openstack import xmlutil
from nova.cells import rpcapi as cells_rpcapi
from nova import context
from nova import exception
from nova.openstack.common import timeutils
from nova import rpc
from nova import test
from nova.tests.api.openstack import fakes

View File

@ -15,13 +15,13 @@
from lxml import etree
from oslo.config import cfg
from oslo.utils import timeutils
from webob import exc
from nova.api.openstack.compute.contrib import cloudpipe
from nova.api.openstack import wsgi
from nova.compute import utils as compute_utils
from nova import exception
from nova.openstack.common import timeutils
from nova import test
from nova.tests.api.openstack import fakes
from nova.tests import fake_network

Some files were not shown because too many files have changed in this diff Show More