summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ceilometer/alarm/evaluator/__init__.py2
-rw-r--r--ceilometer/alarm/evaluator/threshold.py3
-rw-r--r--ceilometer/alarm/partition/coordination.py3
-rw-r--r--ceilometer/alarm/service.py4
-rw-r--r--ceilometer/alarm/storage/impl_hbase.py4
-rw-r--r--ceilometer/api/controllers/v2.py4
-rw-r--r--ceilometer/cli.py2
-rw-r--r--ceilometer/cmd/alarm.py2
-rw-r--r--ceilometer/collector.py2
-rw-r--r--ceilometer/compute/notifications/cpu.py2
-rw-r--r--ceilometer/compute/plugin.py3
-rw-r--r--ceilometer/compute/pollsters/net.py3
-rw-r--r--ceilometer/compute/pollsters/util.py2
-rw-r--r--ceilometer/compute/virt/hyperv/inspector.py2
-rw-r--r--ceilometer/compute/virt/vmware/inspector.py2
-rw-r--r--ceilometer/dispatcher/database.py2
-rw-r--r--ceilometer/event/converter.py2
-rw-r--r--ceilometer/hardware/plugin.py4
-rw-r--r--ceilometer/hardware/pollsters/util.py2
-rw-r--r--ceilometer/image/glance.py2
-rw-r--r--ceilometer/network/floatingip.py2
-rw-r--r--ceilometer/network/services/fwaas.py2
-rw-r--r--ceilometer/network/services/lbaas.py3
-rw-r--r--ceilometer/network/services/vpnaas.py2
-rw-r--r--ceilometer/network/statistics/__init__.py4
-rw-r--r--ceilometer/network/statistics/opencontrail/driver.py3
-rw-r--r--ceilometer/network/statistics/opendaylight/driver.py3
-rw-r--r--ceilometer/objectstore/swift.py2
-rw-r--r--ceilometer/objectstore/swift_middleware.py3
-rw-r--r--ceilometer/openstack/common/network_utils.py163
-rw-r--r--ceilometer/openstack/common/units.py38
-rw-r--r--ceilometer/publisher/__init__.py7
-rw-r--r--ceilometer/publisher/udp.py4
-rw-r--r--ceilometer/storage/base.py3
-rw-r--r--ceilometer/storage/impl_db2.py2
-rw-r--r--ceilometer/storage/impl_hbase.py6
-rw-r--r--ceilometer/storage/impl_mongodb.py2
-rw-r--r--ceilometer/storage/impl_sqlalchemy.py2
-rw-r--r--ceilometer/storage/models.py2
-rw-r--r--ceilometer/storage/mongo/utils.py4
-rw-r--r--ceilometer/storage/sqlalchemy/migrate_repo/versions/005_remove_resource_timestamp.py4
-rw-r--r--ceilometer/storage/sqlalchemy/migrate_repo/versions/029_sample_recorded_at.py3
-rw-r--r--ceilometer/storage/sqlalchemy/models.py2
-rw-r--r--ceilometer/tests/alarm/evaluator/test_base.py3
-rw-r--r--ceilometer/tests/alarm/evaluator/test_combination.py3
-rw-r--r--ceilometer/tests/alarm/evaluator/test_threshold.py2
-rw-r--r--ceilometer/tests/alarm/partition/test_coordination.py2
-rw-r--r--ceilometer/tests/alarm/test_notifier.py2
-rw-r--r--ceilometer/tests/alarm/test_rpc.py2
-rw-r--r--ceilometer/tests/api/v2/test_acl_scenarios.py2
-rw-r--r--ceilometer/tests/api/v2/test_complex_query_scenarios.py3
-rw-r--r--ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py2
-rw-r--r--ceilometer/tests/api/v2/test_event_scenarios.py3
-rw-r--r--ceilometer/tests/api/v2/test_list_events_scenarios.py2
-rw-r--r--ceilometer/tests/api/v2/test_list_resources_scenarios.py2
-rw-r--r--ceilometer/tests/api/v2/test_post_samples_scenarios.py2
-rw-r--r--ceilometer/tests/api/v2/test_query.py2
-rw-r--r--ceilometer/tests/base.py2
-rw-r--r--ceilometer/tests/compute/virt/hyperv/test_inspector.py2
-rw-r--r--ceilometer/tests/event/test_converter.py4
-rw-r--r--ceilometer/tests/hardware/inspector/test_inspector.py6
-rw-r--r--ceilometer/tests/hardware/inspector/test_snmp.py4
-rw-r--r--ceilometer/tests/network/statistics/test_statistics.py2
-rw-r--r--ceilometer/tests/pipeline_base.py2
-rw-r--r--ceilometer/tests/publisher/test_file.py12
-rw-r--r--ceilometer/tests/publisher/test_rpc_publisher.py26
-rw-r--r--ceilometer/tests/publisher/test_udp.py8
-rw-r--r--ceilometer/tests/storage/test_impl_sqlalchemy.py2
-rw-r--r--ceilometer/tests/storage/test_storage_scenarios.py2
-rw-r--r--ceilometer/tests/test_collector.py2
-rw-r--r--ceilometer/tests/test_notification.py2
-rw-r--r--ceilometer/transformer/conversions.py2
-rw-r--r--ceilometer/utils.py5
-rw-r--r--nova_tests/test_notifier.py3
-rw-r--r--openstack-common.conf6
-rw-r--r--requirements-py3.txt1
-rw-r--r--requirements.txt1
-rwxr-xr-xtools/make_test_data.py3
78 files changed, 123 insertions, 324 deletions
diff --git a/ceilometer/alarm/evaluator/__init__.py b/ceilometer/alarm/evaluator/__init__.py
index f09f478f..f1059f55 100644
--- a/ceilometer/alarm/evaluator/__init__.py
+++ b/ceilometer/alarm/evaluator/__init__.py
@@ -22,12 +22,12 @@ import datetime
from ceilometerclient import client as ceiloclient
from oslo.config import cfg
+from oslo.utils import timeutils
import pytz
import six
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
LOG = log.getLogger(__name__)
diff --git a/ceilometer/alarm/evaluator/threshold.py b/ceilometer/alarm/evaluator/threshold.py
index 7a328231..a15f9370 100644
--- a/ceilometer/alarm/evaluator/threshold.py
+++ b/ceilometer/alarm/evaluator/threshold.py
@@ -19,11 +19,12 @@
import datetime
import operator
+from oslo.utils import timeutils
+
from ceilometer.alarm import evaluator
from ceilometer.alarm.evaluator import utils
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
LOG = log.getLogger(__name__)
diff --git a/ceilometer/alarm/partition/coordination.py b/ceilometer/alarm/partition/coordination.py
index c0bbeb06..e8635895 100644
--- a/ceilometer/alarm/partition/coordination.py
+++ b/ceilometer/alarm/partition/coordination.py
@@ -19,10 +19,11 @@ import math
import random
import uuid
+from oslo.utils import timeutils
+
from ceilometer.alarm import rpc as rpc_alarm
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
LOG = log.getLogger(__name__)
diff --git a/ceilometer/alarm/service.py b/ceilometer/alarm/service.py
index 9bc98967..614d03f8 100644
--- a/ceilometer/alarm/service.py
+++ b/ceilometer/alarm/service.py
@@ -21,6 +21,7 @@ import abc
from ceilometerclient import client as ceiloclient
from oslo.config import cfg
+from oslo.utils import netutils
import six
from stevedore import extension
@@ -29,7 +30,6 @@ from ceilometer.alarm import rpc as rpc_alarm
from ceilometer import messaging
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import network_utils
from ceilometer.openstack.common import service as os_service
@@ -210,7 +210,7 @@ class AlarmNotifierService(os_service.Service):
def _handle_action(self, action, alarm_id, previous,
current, reason, reason_data):
try:
- action = network_utils.urlsplit(action)
+ action = netutils.urlsplit(action)
except Exception:
LOG.error(
_("Unable to parse action %(action)s for alarm %(alarm_id)s"),
diff --git a/ceilometer/alarm/storage/impl_hbase.py b/ceilometer/alarm/storage/impl_hbase.py
index efdcb472..d6440957 100644
--- a/ceilometer/alarm/storage/impl_hbase.py
+++ b/ceilometer/alarm/storage/impl_hbase.py
@@ -16,13 +16,13 @@ import datetime
import os
import happybase
+from oslo.utils import netutils
from six.moves.urllib import parse as urlparse
from ceilometer.alarm.storage import base
from ceilometer.alarm.storage import models
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import network_utils
from ceilometer.storage.hbase import inmemory as hbase_inmemory
from ceilometer.storage.hbase import utils as hbase_utils
from ceilometer import utils
@@ -140,7 +140,7 @@ class Connection(base.Connection):
database name, so we are not looking for these in the url.
"""
opts = {}
- result = network_utils.urlsplit(url)
+ result = netutils.urlsplit(url)
opts['table_prefix'] = urlparse.parse_qs(
result.query).get('table_prefix', [None])[0]
opts['dbtype'] = result.scheme
diff --git a/ceilometer/api/controllers/v2.py b/ceilometer/api/controllers/v2.py
index be5900fe..b4592abd 100644
--- a/ceilometer/api/controllers/v2.py
+++ b/ceilometer/api/controllers/v2.py
@@ -37,6 +37,8 @@ import pytz
import uuid
from oslo.config import cfg
+from oslo.utils import strutils
+from oslo.utils import timeutils
import pecan
from pecan import rest
import six
@@ -50,8 +52,6 @@ from ceilometer import messaging
from ceilometer.openstack.common import context
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import strutils
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
from ceilometer import storage
from ceilometer import utils
diff --git a/ceilometer/cli.py b/ceilometer/cli.py
index 541bebb6..b66f3af0 100644
--- a/ceilometer/cli.py
+++ b/ceilometer/cli.py
@@ -29,9 +29,9 @@ import eventlet
# oslo.messaging use threading.local
eventlet.monkey_patch(socket=True, select=True, thread=True)
from oslo.config import cfg
+from oslo.utils import timeutils
from ceilometer.openstack.common import context
-from ceilometer.openstack.common import timeutils
from ceilometer import pipeline
from ceilometer import sample
from ceilometer import service
diff --git a/ceilometer/cmd/alarm.py b/ceilometer/cmd/alarm.py
index 63def1c7..37ef1f34 100644
--- a/ceilometer/cmd/alarm.py
+++ b/ceilometer/cmd/alarm.py
@@ -15,9 +15,9 @@
# under the License.
from oslo.config import cfg
+from oslo.utils import importutils
from ceilometer.alarm import service as alarm_service
-from ceilometer.openstack.common import importutils
from ceilometer.openstack.common import service as os_service
from ceilometer import service
diff --git a/ceilometer/collector.py b/ceilometer/collector.py
index 18bae245..6da4371a 100644
--- a/ceilometer/collector.py
+++ b/ceilometer/collector.py
@@ -19,13 +19,13 @@ import socket
import msgpack
from oslo.config import cfg
+from oslo.utils import units
from ceilometer import dispatcher
from ceilometer import messaging
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
from ceilometer.openstack.common import service as os_service
-from ceilometer.openstack.common import units
OPTS = [
cfg.StrOpt('udp_address',
diff --git a/ceilometer/compute/notifications/cpu.py b/ceilometer/compute/notifications/cpu.py
index 7af186da..f4cd2c07 100644
--- a/ceilometer/compute/notifications/cpu.py
+++ b/ceilometer/compute/notifications/cpu.py
@@ -17,11 +17,11 @@
"""Converters for producing compute CPU sample messages from notification
events.
"""
+from oslo.utils import timeutils
from ceilometer.compute import notifications
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
LOG = log.getLogger(__name__)
diff --git a/ceilometer/compute/plugin.py b/ceilometer/compute/plugin.py
index a6b6942b..a4995c32 100644
--- a/ceilometer/compute/plugin.py
+++ b/ceilometer/compute/plugin.py
@@ -18,9 +18,10 @@
"""
import abc
+
+from oslo.utils import timeutils
import six
-from ceilometer.openstack.common import timeutils
from ceilometer import plugin
diff --git a/ceilometer/compute/pollsters/net.py b/ceilometer/compute/pollsters/net.py
index c95c23f5..ba56ad92 100644
--- a/ceilometer/compute/pollsters/net.py
+++ b/ceilometer/compute/pollsters/net.py
@@ -19,12 +19,13 @@
import copy
+from oslo.utils import timeutils
+
from ceilometer.compute import plugin
from ceilometer.compute.pollsters import util
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
LOG = log.getLogger(__name__)
diff --git a/ceilometer/compute/pollsters/util.py b/ceilometer/compute/pollsters/util.py
index f979f715..0492c19a 100644
--- a/ceilometer/compute/pollsters/util.py
+++ b/ceilometer/compute/pollsters/util.py
@@ -16,9 +16,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import timeutils
from ceilometer.compute import util as compute_util
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
diff --git a/ceilometer/compute/virt/hyperv/inspector.py b/ceilometer/compute/virt/hyperv/inspector.py
index 6cb2a696..183b0ca2 100644
--- a/ceilometer/compute/virt/hyperv/inspector.py
+++ b/ceilometer/compute/virt/hyperv/inspector.py
@@ -17,11 +17,11 @@
"""Implementation of Inspector abstraction for Hyper-V"""
from oslo.config import cfg
+from oslo.utils import units
from ceilometer.compute.virt.hyperv import utilsv2
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import units
CONF = cfg.CONF
LOG = log.getLogger(__name__)
diff --git a/ceilometer/compute/virt/vmware/inspector.py b/ceilometer/compute/virt/vmware/inspector.py
index f08cbf63..22fab9a8 100644
--- a/ceilometer/compute/virt/vmware/inspector.py
+++ b/ceilometer/compute/virt/vmware/inspector.py
@@ -16,12 +16,12 @@
"""Implementation of Inspector abstraction for VMware vSphere"""
from oslo.config import cfg
+from oslo.utils import units
from oslo.vmware import api
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.compute.virt.vmware import vsphere_operations
from ceilometer.openstack.common.gettextutils import _
-from ceilometer.openstack.common import units
opt_group = cfg.OptGroup(name='vmware',
diff --git a/ceilometer/dispatcher/database.py b/ceilometer/dispatcher/database.py
index 7bb13c52..0093b1ba 100644
--- a/ceilometer/dispatcher/database.py
+++ b/ceilometer/dispatcher/database.py
@@ -14,11 +14,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import timeutils
from ceilometer import dispatcher
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils as publisher_utils
from ceilometer import storage
diff --git a/ceilometer/event/converter.py b/ceilometer/event/converter.py
index d6c9466c..89a0d00e 100644
--- a/ceilometer/event/converter.py
+++ b/ceilometer/event/converter.py
@@ -20,12 +20,12 @@ import os
import jsonpath_rw
from oslo.config import cfg
+from oslo.utils import timeutils
import six
import yaml
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer.storage import models
OPTS = [
diff --git a/ceilometer/hardware/plugin.py b/ceilometer/hardware/plugin.py
index 363ffb04..83c5e4a3 100644
--- a/ceilometer/hardware/plugin.py
+++ b/ceilometer/hardware/plugin.py
@@ -21,13 +21,13 @@
import abc
import itertools
+from oslo.utils import netutils
import six
from ceilometer.central import plugin
from ceilometer.hardware import inspector as insloader
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import network_utils
LOG = log.getLogger(__name__)
@@ -54,7 +54,7 @@ class HardwarePollster(plugin.CentralPollster):
h_cache = cache.setdefault(self.CACHE_KEY, {})
sample_iters = []
for res in resources:
- parsed_url = network_utils.urlsplit(res)
+ parsed_url = netutils.urlsplit(res)
inspector = self._get_inspector(parsed_url)
func = getattr(inspector, self.INSPECT_METHOD)
diff --git a/ceilometer/hardware/pollsters/util.py b/ceilometer/hardware/pollsters/util.py
index ac1b40dc..37f77a3f 100644
--- a/ceilometer/hardware/pollsters/util.py
+++ b/ceilometer/hardware/pollsters/util.py
@@ -20,9 +20,9 @@
import copy
+from oslo.utils import timeutils
from six.moves.urllib import parse as urlparse
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
diff --git a/ceilometer/image/glance.py b/ceilometer/image/glance.py
index 85bf6851..0d2d619b 100644
--- a/ceilometer/image/glance.py
+++ b/ceilometer/image/glance.py
@@ -22,9 +22,9 @@ import itertools
import glanceclient
from oslo.config import cfg
+from oslo.utils import timeutils
from ceilometer.central import plugin
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
diff --git a/ceilometer/network/floatingip.py b/ceilometer/network/floatingip.py
index 5228fa80..46536d6e 100644
--- a/ceilometer/network/floatingip.py
+++ b/ceilometer/network/floatingip.py
@@ -17,12 +17,12 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import timeutils
from ceilometer.central import plugin
from ceilometer import nova_client
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
LOG = log.getLogger(__name__)
diff --git a/ceilometer/network/services/fwaas.py b/ceilometer/network/services/fwaas.py
index 74967b7a..0d093c10 100644
--- a/ceilometer/network/services/fwaas.py
+++ b/ceilometer/network/services/fwaas.py
@@ -14,11 +14,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import timeutils
from ceilometer.network.services import base
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
LOG = log.getLogger(__name__)
diff --git a/ceilometer/network/services/lbaas.py b/ceilometer/network/services/lbaas.py
index 27826226..da743595 100644
--- a/ceilometer/network/services/lbaas.py
+++ b/ceilometer/network/services/lbaas.py
@@ -17,12 +17,13 @@
import abc
import collections
+
+from oslo.utils import timeutils
import six
from ceilometer.network.services import base
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
LOG = log.getLogger(__name__)
diff --git a/ceilometer/network/services/vpnaas.py b/ceilometer/network/services/vpnaas.py
index a7a3891c..0696dd12 100644
--- a/ceilometer/network/services/vpnaas.py
+++ b/ceilometer/network/services/vpnaas.py
@@ -14,11 +14,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import timeutils
from ceilometer.network.services import base
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
LOG = log.getLogger(__name__)
diff --git a/ceilometer/network/statistics/__init__.py b/ceilometer/network/statistics/__init__.py
index 76d2dd22..9a0d0d6f 100644
--- a/ceilometer/network/statistics/__init__.py
+++ b/ceilometer/network/statistics/__init__.py
@@ -15,12 +15,12 @@
import abc
+from oslo.utils import netutils
import six
from six.moves.urllib import parse as urlparse
from stevedore import driver as _driver
from ceilometer.central import plugin
-from ceilometer.openstack.common import network_utils
from ceilometer import sample
@@ -45,7 +45,7 @@ class _Base(plugin.CentralPollster):
@staticmethod
def _parse_my_resource(resource):
- parse_url = network_utils.urlsplit(resource)
+ parse_url = netutils.urlsplit(resource)
params = urlparse.parse_qs(parse_url.query)
parts = urlparse.ParseResult(parse_url.scheme,
diff --git a/ceilometer/network/statistics/opencontrail/driver.py b/ceilometer/network/statistics/opencontrail/driver.py
index 56552f91..a64cabb2 100644
--- a/ceilometer/network/statistics/opencontrail/driver.py
+++ b/ceilometer/network/statistics/opencontrail/driver.py
@@ -13,13 +13,12 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
+from oslo.utils import timeutils
from six.moves.urllib import parse as urlparse
from ceilometer.network.statistics import driver
from ceilometer.network.statistics.opencontrail import client
from ceilometer import neutron_client
-from ceilometer.openstack.common import timeutils
class OpencontrailDriver(driver.Driver):
diff --git a/ceilometer/network/statistics/opendaylight/driver.py b/ceilometer/network/statistics/opendaylight/driver.py
index 999c385c..492ab58c 100644
--- a/ceilometer/network/statistics/opendaylight/driver.py
+++ b/ceilometer/network/statistics/opendaylight/driver.py
@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
+from oslo.utils import timeutils
import six
from six import moves
from six.moves.urllib import parse as urlparse
@@ -21,7 +21,6 @@ from ceilometer.network.statistics import driver
from ceilometer.network.statistics.opendaylight import client
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import utils
diff --git a/ceilometer/objectstore/swift.py b/ceilometer/objectstore/swift.py
index 972c6793..7053b2e6 100644
--- a/ceilometer/objectstore/swift.py
+++ b/ceilometer/objectstore/swift.py
@@ -21,13 +21,13 @@ from __future__ import absolute_import
from keystoneclient import exceptions
from oslo.config import cfg
+from oslo.utils import timeutils
import six.moves.urllib.parse as urlparse
from swiftclient import client as swift
from ceilometer.central import plugin
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
diff --git a/ceilometer/objectstore/swift_middleware.py b/ceilometer/objectstore/swift_middleware.py
index f7b8a016..ce41711a 100644
--- a/ceilometer/objectstore/swift_middleware.py
+++ b/ceilometer/objectstore/swift_middleware.py
@@ -41,9 +41,10 @@ before "proxy-server" and add the following filter in the file:
from __future__ import absolute_import
+from oslo.utils import timeutils
+
from ceilometer.openstack.common import context
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import pipeline
from ceilometer import sample
from ceilometer import service
diff --git a/ceilometer/openstack/common/network_utils.py b/ceilometer/openstack/common/network_utils.py
deleted file mode 100644
index 1c422499..00000000
--- a/ceilometer/openstack/common/network_utils.py
+++ /dev/null
@@ -1,163 +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 logging
-import socket
-
-from six.moves.urllib import parse
-
-from ceilometer.openstack.common.gettextutils import _LW
-
-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)
- >>> parse_host_port(None)
- (None, None)
- """
- if not address:
- return (None, None)
-
- 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'))
diff --git a/ceilometer/openstack/common/units.py b/ceilometer/openstack/common/units.py
deleted file mode 100644
index 4817da50..00000000
--- a/ceilometer/openstack/common/units.py
+++ /dev/null
@@ -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
diff --git a/ceilometer/publisher/__init__.py b/ceilometer/publisher/__init__.py
index 8fdeaa05..acee885f 100644
--- a/ceilometer/publisher/__init__.py
+++ b/ceilometer/publisher/__init__.py
@@ -1,6 +1,6 @@
#
# Copyright 2013 Intel Corp.
-# Copyright 2013 eNovance
+# Copyright 2013-2014 eNovance
#
# Author: Yunhong Jiang <yunhong.jiang@intel.com>
# Julien Danjou <julien@danjou.info>
@@ -19,11 +19,10 @@
import abc
+from oslo.utils import netutils
import six
from stevedore import driver
-from ceilometer.openstack.common import network_utils
-
def get_publisher(url, namespace='ceilometer.publisher'):
"""Get publisher driver and load it.
@@ -31,7 +30,7 @@ def get_publisher(url, namespace='ceilometer.publisher'):
:param URL: URL for the publisher
:param namespace: Namespace to use to look for drivers.
"""
- parse_result = network_utils.urlsplit(url)
+ parse_result = netutils.urlsplit(url)
loaded_driver = driver.DriverManager(namespace, parse_result.scheme)
return loaded_driver.driver(parse_result)
diff --git a/ceilometer/publisher/udp.py b/ceilometer/publisher/udp.py
index 6baac074..46797a1a 100644
--- a/ceilometer/publisher/udp.py
+++ b/ceilometer/publisher/udp.py
@@ -22,10 +22,10 @@ import socket
import msgpack
from oslo.config import cfg
+from oslo.utils import netutils
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import network_utils
from ceilometer import publisher
from ceilometer.publisher import utils
@@ -37,7 +37,7 @@ LOG = log.getLogger(__name__)
class UDPPublisher(publisher.PublisherBase):
def __init__(self, parsed_url):
- self.host, self.port = network_utils.parse_host_port(
+ self.host, self.port = netutils.parse_host_port(
parsed_url.netloc,
default_port=cfg.CONF.collector.udp_port)
self.socket = socket.socket(socket.AF_INET,
diff --git a/ceilometer/storage/base.py b/ceilometer/storage/base.py
index 769e3a44..fd0f072e 100644
--- a/ceilometer/storage/base.py
+++ b/ceilometer/storage/base.py
@@ -21,11 +21,10 @@ import datetime
import inspect
import math
+from oslo.utils import timeutils
import six
from six import moves
-from ceilometer.openstack.common import timeutils
-
def iter_period(start, end, period):
"""Split a time from start to end in periods of a number of seconds.
diff --git a/ceilometer/storage/impl_db2.py b/ceilometer/storage/impl_db2.py
index 4f21f195..899b5df0 100644
--- a/ceilometer/storage/impl_db2.py
+++ b/ceilometer/storage/impl_db2.py
@@ -28,11 +28,11 @@ import sys
import bson.code
import bson.objectid
+from oslo.utils import timeutils
import pymongo
import six
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import storage
from ceilometer.storage import base
from ceilometer.storage import models
diff --git a/ceilometer/storage/impl_hbase.py b/ceilometer/storage/impl_hbase.py
index 5da90720..24b12bf4 100644
--- a/ceilometer/storage/impl_hbase.py
+++ b/ceilometer/storage/impl_hbase.py
@@ -18,12 +18,12 @@ import os
import time
import happybase
+from oslo.utils import netutils
+from oslo.utils import timeutils
from six.moves.urllib import parse as urlparse
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import network_utils
-from ceilometer.openstack.common import timeutils
from ceilometer.storage import base
from ceilometer.storage.hbase import inmemory as hbase_inmemory
from ceilometer.storage.hbase import utils as hbase_utils
@@ -205,7 +205,7 @@ class Connection(base.Connection):
database name, so we are not looking for these in the url.
"""
opts = {}
- result = network_utils.urlsplit(url)
+ result = netutils.urlsplit(url)
opts['table_prefix'] = urlparse.parse_qs(
result.query).get('table_prefix', [None])[0]
opts['dbtype'] = result.scheme
diff --git a/ceilometer/storage/impl_mongodb.py b/ceilometer/storage/impl_mongodb.py
index 3110850f..2b432767 100644
--- a/ceilometer/storage/impl_mongodb.py
+++ b/ceilometer/storage/impl_mongodb.py
@@ -30,11 +30,11 @@ import uuid
import bson.code
import bson.objectid
from oslo.config import cfg
+from oslo.utils import timeutils
import pymongo
import six
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import storage
from ceilometer.storage import base
from ceilometer.storage import models
diff --git a/ceilometer/storage/impl_sqlalchemy.py b/ceilometer/storage/impl_sqlalchemy.py
index 94feb5ff..53ac5a8d 100644
--- a/ceilometer/storage/impl_sqlalchemy.py
+++ b/ceilometer/storage/impl_sqlalchemy.py
@@ -22,6 +22,7 @@ import operator
import os
from oslo.config import cfg
+from oslo.utils import timeutils
import six
from sqlalchemy import and_
from sqlalchemy import distinct
@@ -33,7 +34,6 @@ from ceilometer.openstack.common.db.sqlalchemy import migration
import ceilometer.openstack.common.db.sqlalchemy.session as sqlalchemy_session
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import storage
from ceilometer.storage import base
from ceilometer.storage import models as api_models
diff --git a/ceilometer/storage/models.py b/ceilometer/storage/models.py
index fe874fb9..9f707c52 100644
--- a/ceilometer/storage/models.py
+++ b/ceilometer/storage/models.py
@@ -16,8 +16,8 @@
# under the License.
"""Model classes for use in the storage API.
"""
+from oslo.utils import timeutils
-from ceilometer.openstack.common import timeutils
from ceilometer.storage import base
diff --git a/ceilometer/storage/mongo/utils.py b/ceilometer/storage/mongo/utils.py
index fe337651..5f2ad07b 100644
--- a/ceilometer/storage/mongo/utils.py
+++ b/ceilometer/storage/mongo/utils.py
@@ -22,13 +22,13 @@
import time
from oslo.config import cfg
+from oslo.utils import netutils
import pymongo
import six
import weakref
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import network_utils
LOG = log.getLogger(__name__)
@@ -171,7 +171,7 @@ class ConnectionPool(object):
client = self._pool.get(pool_key)()
if client:
return client
- splitted_url = network_utils.urlsplit(url)
+ splitted_url = netutils.urlsplit(url)
log_data = {'db': splitted_url.scheme,
'nodelist': connection_options['nodelist']}
LOG.info(_('Connecting to %(db)s on %(nodelist)s') % log_data)
diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/005_remove_resource_timestamp.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/005_remove_resource_timestamp.py
index 0dd422c3..0659fd84 100644
--- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/005_remove_resource_timestamp.py
+++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/005_remove_resource_timestamp.py
@@ -14,11 +14,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
+from oslo.utils import timeutils
from sqlalchemy import MetaData, Table, Column, DateTime
-from ceilometer.openstack.common import timeutils
-
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/029_sample_recorded_at.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/029_sample_recorded_at.py
index ee9f2dc7..722d7107 100644
--- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/029_sample_recorded_at.py
+++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/029_sample_recorded_at.py
@@ -10,10 +10,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
+from oslo.utils import timeutils
import sqlalchemy
-from ceilometer.openstack.common import timeutils
from ceilometer.storage.sqlalchemy import models
diff --git a/ceilometer/storage/sqlalchemy/models.py b/ceilometer/storage/sqlalchemy/models.py
index 97374b4b..a494a8bc 100644
--- a/ceilometer/storage/sqlalchemy/models.py
+++ b/ceilometer/storage/sqlalchemy/models.py
@@ -19,6 +19,7 @@ SQLAlchemy models for Ceilometer data.
import json
+from oslo.utils import timeutils
import six
from sqlalchemy import (Column, Integer, String, ForeignKey, Index,
UniqueConstraint, BigInteger, join)
@@ -30,7 +31,6 @@ from sqlalchemy.orm import column_property
from sqlalchemy.orm import relationship
from sqlalchemy.types import TypeDecorator
-from ceilometer.openstack.common import timeutils
from ceilometer.storage import models as api_models
from ceilometer import utils
diff --git a/ceilometer/tests/alarm/evaluator/test_base.py b/ceilometer/tests/alarm/evaluator/test_base.py
index 63499798..0f4239c1 100644
--- a/ceilometer/tests/alarm/evaluator/test_base.py
+++ b/ceilometer/tests/alarm/evaluator/test_base.py
@@ -17,11 +17,12 @@
"""class for tests in ceilometer/alarm/evaluator/__init__.py
"""
import datetime
+
import mock
+from oslo.utils import timeutils
from oslotest import base
from ceilometer.alarm import evaluator
-from ceilometer.openstack.common import timeutils
class TestEvaluatorBaseClass(base.BaseTestCase):
diff --git a/ceilometer/tests/alarm/evaluator/test_combination.py b/ceilometer/tests/alarm/evaluator/test_combination.py
index 504caa03..c59ba3a1 100644
--- a/ceilometer/tests/alarm/evaluator/test_combination.py
+++ b/ceilometer/tests/alarm/evaluator/test_combination.py
@@ -21,9 +21,10 @@ import mock
import pytz
import uuid
+from oslo.utils import timeutils
+
from ceilometer.alarm.evaluator import combination
from ceilometer.alarm.storage import models
-from ceilometer.openstack.common import timeutils
from ceilometer.tests.alarm.evaluator import base
from ceilometerclient import exc
from ceilometerclient.v2 import alarms
diff --git a/ceilometer/tests/alarm/evaluator/test_threshold.py b/ceilometer/tests/alarm/evaluator/test_threshold.py
index 6a4ca197..d02b7b55 100644
--- a/ceilometer/tests/alarm/evaluator/test_threshold.py
+++ b/ceilometer/tests/alarm/evaluator/test_threshold.py
@@ -21,11 +21,11 @@ import mock
import pytz
import uuid
+from oslo.utils import timeutils
from six import moves
from ceilometer.alarm.evaluator import threshold
from ceilometer.alarm.storage import models
-from ceilometer.openstack.common import timeutils
from ceilometer.tests.alarm.evaluator import base
from ceilometerclient import exc
from ceilometerclient.v2 import statistics
diff --git a/ceilometer/tests/alarm/partition/test_coordination.py b/ceilometer/tests/alarm/partition/test_coordination.py
index 242855a7..c9dbcd74 100644
--- a/ceilometer/tests/alarm/partition/test_coordination.py
+++ b/ceilometer/tests/alarm/partition/test_coordination.py
@@ -22,11 +22,11 @@ import uuid
import mock
from oslo.config import fixture as fixture_config
+from oslo.utils import timeutils
from six import moves
from ceilometer.alarm.partition import coordination
from ceilometer.alarm.storage import models
-from ceilometer.openstack.common import timeutils
from ceilometer.tests import base as tests_base
diff --git a/ceilometer/tests/alarm/test_notifier.py b/ceilometer/tests/alarm/test_notifier.py
index e5f66847..f4cbd0b8 100644
--- a/ceilometer/tests/alarm/test_notifier.py
+++ b/ceilometer/tests/alarm/test_notifier.py
@@ -211,7 +211,7 @@ class TestAlarmNotifier(tests_base.BaseTestCase):
raise Exception("Evil urlsplit!")
def test_notify_alarm_invalid_url(self):
- with mock.patch('ceilometer.openstack.common.network_utils.urlsplit',
+ with mock.patch('oslo.utils.netutils.urlsplit',
self._fake_urlsplit):
LOG = mock.MagicMock()
with mock.patch('ceilometer.alarm.service.LOG', LOG):
diff --git a/ceilometer/tests/alarm/test_rpc.py b/ceilometer/tests/alarm/test_rpc.py
index 0e73000d..1a54b02f 100644
--- a/ceilometer/tests/alarm/test_rpc.py
+++ b/ceilometer/tests/alarm/test_rpc.py
@@ -20,12 +20,12 @@ import uuid
from ceilometerclient.v2 import alarms
import eventlet
from oslo.config import fixture as fixture_config
+from oslo.utils import timeutils
import six
from ceilometer.alarm import rpc as rpc_alarm
from ceilometer.alarm.storage import models
from ceilometer import messaging
-from ceilometer.openstack.common import timeutils
from ceilometer.tests import base as tests_base
diff --git a/ceilometer/tests/api/v2/test_acl_scenarios.py b/ceilometer/tests/api/v2/test_acl_scenarios.py
index 3b95ef26..feb30719 100644
--- a/ceilometer/tests/api/v2/test_acl_scenarios.py
+++ b/ceilometer/tests/api/v2/test_acl_scenarios.py
@@ -19,11 +19,11 @@
import datetime
import json
+from oslo.utils import timeutils
import webtest
from ceilometer.api import app
from ceilometer.api.controllers import v2 as v2_api
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer.tests import api as acl
diff --git a/ceilometer/tests/api/v2/test_complex_query_scenarios.py b/ceilometer/tests/api/v2/test_complex_query_scenarios.py
index 70c346e1..0040d173 100644
--- a/ceilometer/tests/api/v2/test_complex_query_scenarios.py
+++ b/ceilometer/tests/api/v2/test_complex_query_scenarios.py
@@ -20,8 +20,9 @@
import datetime
+from oslo.utils import timeutils
+
from ceilometer.alarm.storage import models
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer.tests.api import v2 as tests_api
diff --git a/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py b/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py
index dce587c3..e962f7ff 100644
--- a/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py
+++ b/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py
@@ -20,8 +20,8 @@
import datetime
import mock
+from oslo.utils import timeutils
-from ceilometer.openstack.common import timeutils
from ceilometer.storage import models
from ceilometer.tests.api import v2
from ceilometer.tests import db as tests_db
diff --git a/ceilometer/tests/api/v2/test_event_scenarios.py b/ceilometer/tests/api/v2/test_event_scenarios.py
index 0e8c50c9..a07e2dd0 100644
--- a/ceilometer/tests/api/v2/test_event_scenarios.py
+++ b/ceilometer/tests/api/v2/test_event_scenarios.py
@@ -16,7 +16,8 @@
import datetime
-from ceilometer.openstack.common import timeutils
+from oslo.utils import timeutils
+
from ceilometer.storage import models
from ceilometer.tests.api import v2
from ceilometer.tests import db as tests_db
diff --git a/ceilometer/tests/api/v2/test_list_events_scenarios.py b/ceilometer/tests/api/v2/test_list_events_scenarios.py
index da1c05a0..6a6e60ab 100644
--- a/ceilometer/tests/api/v2/test_list_events_scenarios.py
+++ b/ceilometer/tests/api/v2/test_list_events_scenarios.py
@@ -20,10 +20,10 @@
import datetime
import mock
+from oslo.utils import timeutils
import six
import webtest.app
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer.tests.api import v2
diff --git a/ceilometer/tests/api/v2/test_list_resources_scenarios.py b/ceilometer/tests/api/v2/test_list_resources_scenarios.py
index 2a43135e..6789d0b6 100644
--- a/ceilometer/tests/api/v2/test_list_resources_scenarios.py
+++ b/ceilometer/tests/api/v2/test_list_resources_scenarios.py
@@ -20,9 +20,9 @@
import datetime
import json
+from oslo.utils import timeutils
import six
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer.tests.api import v2
diff --git a/ceilometer/tests/api/v2/test_post_samples_scenarios.py b/ceilometer/tests/api/v2/test_post_samples_scenarios.py
index 05be0420..1f3ceab7 100644
--- a/ceilometer/tests/api/v2/test_post_samples_scenarios.py
+++ b/ceilometer/tests/api/v2/test_post_samples_scenarios.py
@@ -21,9 +21,9 @@ import copy
import datetime
import mock
+from oslo.utils import timeutils
from oslotest import mockpatch
-from ceilometer.openstack.common import timeutils
from ceilometer.tests.api import v2
from ceilometer.tests import db as tests_db
diff --git a/ceilometer/tests/api/v2/test_query.py b/ceilometer/tests/api/v2/test_query.py
index 6d428e8f..c23f5d38 100644
--- a/ceilometer/tests/api/v2/test_query.py
+++ b/ceilometer/tests/api/v2/test_query.py
@@ -18,12 +18,12 @@ import datetime
import fixtures
import mock
+from oslo.utils import timeutils
from oslotest import base
from oslotest import mockpatch
import wsme
from ceilometer.api.controllers import v2 as api
-from ceilometer.openstack.common import timeutils
from ceilometer import storage
from ceilometer.tests import base as tests_base
diff --git a/ceilometer/tests/base.py b/ceilometer/tests/base.py
index 9fe7f3d3..a43d8566 100644
--- a/ceilometer/tests/base.py
+++ b/ceilometer/tests/base.py
@@ -22,13 +22,13 @@ import os.path
import eventlet
import oslo.messaging.conffixture
+from oslo.utils import timeutils
from oslotest import base
from oslotest import mockpatch
import six
from testtools import testcase
from ceilometer import messaging
-from ceilometer.openstack.common import timeutils
class BaseTestCase(base.BaseTestCase):
diff --git a/ceilometer/tests/compute/virt/hyperv/test_inspector.py b/ceilometer/tests/compute/virt/hyperv/test_inspector.py
index 6402cd59..0f2424c6 100644
--- a/ceilometer/tests/compute/virt/hyperv/test_inspector.py
+++ b/ceilometer/tests/compute/virt/hyperv/test_inspector.py
@@ -18,10 +18,10 @@ Tests for Hyper-V inspector.
"""
import mock
+from oslo.utils import units
from oslotest import base
from ceilometer.compute.virt.hyperv import inspector as hyperv_inspector
-from ceilometer.openstack.common import units
class TestHyperVInspection(base.BaseTestCase):
diff --git a/ceilometer/tests/event/test_converter.py b/ceilometer/tests/event/test_converter.py
index 30cdf961..22504445 100644
--- a/ceilometer/tests/event/test_converter.py
+++ b/ceilometer/tests/event/test_converter.py
@@ -546,7 +546,7 @@ class TestEventDefinition(ConverterBase):
edef = converter.EventDefinition(cfg, self.fake_plugin_mgr)
self.assertTrue(edef.is_catchall)
- @mock.patch('ceilometer.openstack.common.timeutils.utcnow')
+ @mock.patch('oslo.utils.timeutils.utcnow')
def test_extract_when(self, mock_utcnow):
now = datetime.datetime.utcnow()
modified = now + datetime.timedelta(minutes=1)
@@ -623,7 +623,7 @@ class TestNotificationConverter(ConverterBase):
host='cydonia')
self.fake_plugin_mgr = {}
- @mock.patch('ceilometer.openstack.common.timeutils.utcnow')
+ @mock.patch('oslo.utils.timeutils.utcnow')
def test_converter_missing_keys(self, mock_utcnow):
# test a malformed notification
now = datetime.datetime.utcnow()
diff --git a/ceilometer/tests/hardware/inspector/test_inspector.py b/ceilometer/tests/hardware/inspector/test_inspector.py
index b4bf20f1..75c0deba 100644
--- a/ceilometer/tests/hardware/inspector/test_inspector.py
+++ b/ceilometer/tests/hardware/inspector/test_inspector.py
@@ -14,20 +14,20 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import netutils
from ceilometer.hardware import inspector
-from ceilometer.openstack.common import network_utils
from ceilometer.tests import base
class TestHardwareInspector(base.BaseTestCase):
def test_get_inspector(self):
- url = network_utils.urlsplit("snmp://")
+ url = netutils.urlsplit("snmp://")
driver = inspector.get_inspector(url)
self.assertTrue(driver)
def test_get_inspector_illegal(self):
- url = network_utils.urlsplit("illegal://")
+ url = netutils.urlsplit("illegal://")
self.assertRaises(RuntimeError,
inspector.get_inspector,
url)
diff --git a/ceilometer/tests/hardware/inspector/test_snmp.py b/ceilometer/tests/hardware/inspector/test_snmp.py
index 1d2b052e..617d74f1 100644
--- a/ceilometer/tests/hardware/inspector/test_snmp.py
+++ b/ceilometer/tests/hardware/inspector/test_snmp.py
@@ -16,10 +16,10 @@
# under the License.
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py
"""
+from oslo.utils import netutils
from oslotest import mockpatch
from ceilometer.hardware.inspector import snmp
-from ceilometer.openstack.common import network_utils
from ceilometer.tests import base as test_base
from ceilometer.tests.hardware.inspector import base
@@ -250,7 +250,7 @@ class TestSNMPInspector(Base, test_base.BaseTestCase):
def setUp(self):
super(TestSNMPInspector, self).setUp()
self.inspector = snmp.SNMPInspector()
- self.host = network_utils.urlsplit("snmp://localhost")
+ self.host = netutils.urlsplit("snmp://localhost")
self.inspector.MAPPING = self.mapping
self.useFixture(mockpatch.PatchObject(
self.inspector._cmdGen, 'getCmd', new=faux_getCmd))
diff --git a/ceilometer/tests/network/statistics/test_statistics.py b/ceilometer/tests/network/statistics/test_statistics.py
index fd55d336..3493a875 100644
--- a/ceilometer/tests/network/statistics/test_statistics.py
+++ b/ceilometer/tests/network/statistics/test_statistics.py
@@ -15,11 +15,11 @@
import datetime
+from oslo.utils import timeutils
from oslotest import base
from ceilometer.network import statistics
from ceilometer.network.statistics import driver
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
diff --git a/ceilometer/tests/pipeline_base.py b/ceilometer/tests/pipeline_base.py
index 16acfa12..aa72c432 100644
--- a/ceilometer/tests/pipeline_base.py
+++ b/ceilometer/tests/pipeline_base.py
@@ -22,12 +22,12 @@ import datetime
import traceback
import mock
+from oslo.utils import timeutils
from oslotest import base
from oslotest import mockpatch
import six
from stevedore import extension
-from ceilometer.openstack.common import timeutils
from ceilometer import pipeline
from ceilometer import publisher
from ceilometer.publisher import test as test_publisher
diff --git a/ceilometer/tests/publisher/test_file.py b/ceilometer/tests/publisher/test_file.py
index 19c6ea72..b924d20c 100644
--- a/ceilometer/tests/publisher/test_file.py
+++ b/ceilometer/tests/publisher/test_file.py
@@ -1,5 +1,5 @@
#
-# Copyright 2013 eNovance
+# Copyright 2013-2014 eNovance
#
# Author: Julien Danjou <julien@danjou.info>
#
@@ -22,9 +22,9 @@ import logging.handlers
import os
import tempfile
+from oslo.utils import netutils
from oslotest import base
-from ceilometer.openstack.common import network_utils as utils
from ceilometer.publisher import file
from ceilometer import sample
@@ -71,8 +71,8 @@ class TestFilePublisher(base.BaseTestCase):
# Test valid configurations
tempdir = tempfile.mkdtemp()
name = '%s/log_file' % tempdir
- parsed_url = utils.urlsplit('file://%s?max_bytes=50&backup_count=3'
- % name)
+ parsed_url = netutils.urlsplit('file://%s?max_bytes=50&backup_count=3'
+ % name)
publisher = file.FilePublisher(parsed_url)
publisher.publish_samples(None,
self.test_data)
@@ -90,7 +90,7 @@ class TestFilePublisher(base.BaseTestCase):
# Test missing max bytes, backup count configurations
tempdir = tempfile.mkdtemp()
name = '%s/log_file_plain' % tempdir
- parsed_url = utils.urlsplit('file://%s' % name)
+ parsed_url = netutils.urlsplit('file://%s' % name)
publisher = file.FilePublisher(parsed_url)
publisher.publish_samples(None,
self.test_data)
@@ -112,7 +112,7 @@ class TestFilePublisher(base.BaseTestCase):
def test_file_publisher_invalid(self):
# Test invalid max bytes, backup count configurations
tempdir = tempfile.mkdtemp()
- parsed_url = utils.urlsplit(
+ parsed_url = netutils.urlsplit(
'file://%s/log_file_bad'
'?max_bytes=yus&backup_count=5y' % tempdir)
publisher = file.FilePublisher(parsed_url)
diff --git a/ceilometer/tests/publisher/test_rpc_publisher.py b/ceilometer/tests/publisher/test_rpc_publisher.py
index 6a2b55cf..427be665 100644
--- a/ceilometer/tests/publisher/test_rpc_publisher.py
+++ b/ceilometer/tests/publisher/test_rpc_publisher.py
@@ -24,10 +24,10 @@ import mock
from oslo.config import fixture as fixture_config
import oslo.messaging
import oslo.messaging._drivers.common
+from oslo.utils import netutils
from ceilometer import messaging
from ceilometer.openstack.common import context
-from ceilometer.openstack.common import network_utils
from ceilometer.publisher import rpc
from ceilometer import sample
from ceilometer.tests import base as tests_base
@@ -100,7 +100,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_no_mock(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://'))
+ netutils.urlsplit('rpc://'))
endpoint = mock.MagicMock(['record_metering_data'])
collector = messaging.get_rpc_server(
@@ -127,7 +127,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_publish_target(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?target=custom_procedure_call'))
+ netutils.urlsplit('rpc://?target=custom_procedure_call'))
cast_context = mock.MagicMock()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
prepare.return_value = cast_context
@@ -141,7 +141,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_with_per_meter_topic(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?per_meter_topic=1'))
+ netutils.urlsplit('rpc://?per_meter_topic=1'))
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
publisher.publish_samples(mock.MagicMock(),
self.test_data)
@@ -169,7 +169,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_concurrency(self):
"""Test concurrent access to the local queue of the rpc publisher."""
- publisher = rpc.RPCPublisher(network_utils.urlsplit('rpc://'))
+ publisher = rpc.RPCPublisher(netutils.urlsplit('rpc://'))
cast_context = mock.MagicMock()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
@@ -199,7 +199,7 @@ class TestPublish(tests_base.BaseTestCase):
@mock.patch('ceilometer.publisher.rpc.LOG')
def test_published_with_no_policy(self, mylog):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://'))
+ netutils.urlsplit('rpc://'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
prepare.side_effect = side_effect
@@ -217,7 +217,7 @@ class TestPublish(tests_base.BaseTestCase):
@mock.patch('ceilometer.publisher.rpc.LOG')
def test_published_with_policy_block(self, mylog):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=default'))
+ netutils.urlsplit('rpc://?policy=default'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
prepare.side_effect = side_effect
@@ -233,7 +233,7 @@ class TestPublish(tests_base.BaseTestCase):
@mock.patch('ceilometer.publisher.rpc.LOG')
def test_published_with_policy_incorrect(self, mylog):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=notexist'))
+ netutils.urlsplit('rpc://?policy=notexist'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
prepare.side_effect = side_effect
@@ -249,7 +249,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_with_policy_drop_and_rpc_down(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=drop'))
+ netutils.urlsplit('rpc://?policy=drop'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
prepare.side_effect = side_effect
@@ -261,7 +261,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_with_policy_queue_and_rpc_down(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=queue'))
+ netutils.urlsplit('rpc://?policy=queue'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
prepare.side_effect = side_effect
@@ -275,7 +275,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_with_policy_queue_and_rpc_down_up(self):
self.rpc_unreachable = True
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=queue'))
+ netutils.urlsplit('rpc://?policy=queue'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
@@ -299,7 +299,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_with_policy_sized_queue_and_rpc_down(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=queue&max_queue_length=3'))
+ netutils.urlsplit('rpc://?policy=queue&max_queue_length=3'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
@@ -326,7 +326,7 @@ class TestPublish(tests_base.BaseTestCase):
def test_published_with_policy_default_sized_queue_and_rpc_down(self):
publisher = rpc.RPCPublisher(
- network_utils.urlsplit('rpc://?policy=queue'))
+ netutils.urlsplit('rpc://?policy=queue'))
side_effect = oslo.messaging._drivers.common.RPCException()
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
diff --git a/ceilometer/tests/publisher/test_udp.py b/ceilometer/tests/publisher/test_udp.py
index 751b517d..bc3b297f 100644
--- a/ceilometer/tests/publisher/test_udp.py
+++ b/ceilometer/tests/publisher/test_udp.py
@@ -1,5 +1,5 @@
#
-# Copyright 2013 eNovance
+# Copyright 2013-2014 eNovance
#
# Author: Julien Danjou <julien@danjou.info>
#
@@ -22,9 +22,9 @@ import datetime
import mock
import msgpack
from oslo.config import fixture as fixture_config
+from oslo.utils import netutils
from oslotest import base
-from ceilometer.openstack.common import network_utils
from ceilometer.publisher import udp
from ceilometer.publisher import utils
from ceilometer import sample
@@ -118,7 +118,7 @@ class TestUDPPublisher(base.BaseTestCase):
with mock.patch('socket.socket',
self._make_fake_socket(self.data_sent)):
publisher = udp.UDPPublisher(
- network_utils.urlsplit('udp://somehost'))
+ netutils.urlsplit('udp://somehost'))
publisher.publish_samples(None,
self.test_data)
@@ -152,6 +152,6 @@ class TestUDPPublisher(base.BaseTestCase):
with mock.patch('socket.socket',
self._make_broken_socket):
publisher = udp.UDPPublisher(
- network_utils.urlsplit('udp://localhost'))
+ netutils.urlsplit('udp://localhost'))
publisher.publish_samples(None,
self.test_data)
diff --git a/ceilometer/tests/storage/test_impl_sqlalchemy.py b/ceilometer/tests/storage/test_impl_sqlalchemy.py
index 7d5ba931..b58fd22c 100644
--- a/ceilometer/tests/storage/test_impl_sqlalchemy.py
+++ b/ceilometer/tests/storage/test_impl_sqlalchemy.py
@@ -26,9 +26,9 @@ import datetime
import repr
import mock
+from oslo.utils import timeutils
from ceilometer.alarm.storage import impl_sqlalchemy as impl_sqla_alarm
-from ceilometer.openstack.common import timeutils
from ceilometer.storage import impl_sqlalchemy
from ceilometer.storage import models
from ceilometer.storage.sqlalchemy import models as sql_models
diff --git a/ceilometer/tests/storage/test_storage_scenarios.py b/ceilometer/tests/storage/test_storage_scenarios.py
index 2a929ec1..af014bf0 100644
--- a/ceilometer/tests/storage/test_storage_scenarios.py
+++ b/ceilometer/tests/storage/test_storage_scenarios.py
@@ -23,9 +23,9 @@ import datetime
import operator
import mock
+from oslo.utils import timeutils
from ceilometer.alarm.storage import models as alarm_models
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer import storage
diff --git a/ceilometer/tests/test_collector.py b/ceilometer/tests/test_collector.py
index 64a32ba9..ea4d067a 100644
--- a/ceilometer/tests/test_collector.py
+++ b/ceilometer/tests/test_collector.py
@@ -21,6 +21,7 @@ import mock
import msgpack
from oslo.config import fixture as fixture_config
import oslo.messaging
+from oslo.utils import timeutils
from oslotest import mockpatch
from stevedore import extension
@@ -28,7 +29,6 @@ from ceilometer import collector
from ceilometer import dispatcher
from ceilometer import messaging
from ceilometer.openstack.common import context
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer.tests import base as tests_base
diff --git a/ceilometer/tests/test_notification.py b/ceilometer/tests/test_notification.py
index 6d4ed2a9..c105d9a0 100644
--- a/ceilometer/tests/test_notification.py
+++ b/ceilometer/tests/test_notification.py
@@ -21,6 +21,7 @@ import mock
from oslo.config import fixture as fixture_config
import oslo.messaging
import oslo.messaging.conffixture
+from oslo.utils import timeutils
from stevedore import extension
import yaml
@@ -29,7 +30,6 @@ from ceilometer import messaging
from ceilometer import notification
from ceilometer.openstack.common import context
from ceilometer.openstack.common import fileutils
-from ceilometer.openstack.common import timeutils
from ceilometer.publisher import test as test_publisher
from ceilometer.tests import base as tests_base
diff --git a/ceilometer/transformer/conversions.py b/ceilometer/transformer/conversions.py
index 0d4c185d..ec994677 100644
--- a/ceilometer/transformer/conversions.py
+++ b/ceilometer/transformer/conversions.py
@@ -18,11 +18,11 @@
import collections
import re
+from oslo.utils import timeutils
import six
from ceilometer.openstack.common.gettextutils import _
from ceilometer.openstack.common import log
-from ceilometer.openstack.common import timeutils
from ceilometer import sample
from ceilometer import transformer
diff --git a/ceilometer/utils.py b/ceilometer/utils.py
index b26d99f5..674c8a2f 100644
--- a/ceilometer/utils.py
+++ b/ceilometer/utils.py
@@ -24,11 +24,10 @@ import datetime
import decimal
import multiprocessing
+from oslo.utils import timeutils
+from oslo.utils import units
import six
-from ceilometer.openstack.common import timeutils
-from ceilometer.openstack.common import units
-
def recursive_keypairs(d, separator=':'):
"""Generator that produces sequence of keypairs for nested dictionaries."""
diff --git a/nova_tests/test_notifier.py b/nova_tests/test_notifier.py
index ec16c232..1e466f74 100644
--- a/nova_tests/test_notifier.py
+++ b/nova_tests/test_notifier.py
@@ -22,8 +22,10 @@ import contextlib
import datetime
import mock
+from oslo.utils import importutils
from oslotest import base
from oslotest import moxstubout
+
from stevedore import extension
## NOTE(dhellmann): These imports are not in the generally approved
@@ -40,7 +42,6 @@ from nova.objects import instance as nova_instance
from nova import config
from nova import context
from nova import db
-from nova.openstack.common import importutils
from nova.openstack.common import log as logging
# This option is used in the nova_notifier module, so make
diff --git a/openstack-common.conf b/openstack-common.conf
index 4817472a..ff4442fa 100644
--- a/openstack-common.conf
+++ b/openstack-common.conf
@@ -6,9 +6,7 @@ module=context
module=db
module=db.sqlalchemy
module=eventlet_backdoor
-module=excutils
module=gettextutils
-module=importutils
module=jsonutils
module=local
module=log
@@ -20,13 +18,9 @@ module=middleware.correlation_id
module=middleware.debug
module=middleware.request_id
module=middleware.sizelimit
-module=network_utils
module=policy
module=service
-module=strutils
module=threadgroup
-module=timeutils
-module=units
# The base module to hold the copy of openstack.common
base=ceilometer
diff --git a/requirements-py3.txt b/requirements-py3.txt
index 411560d8..0706d6fa 100644
--- a/requirements-py3.txt
+++ b/requirements-py3.txt
@@ -16,6 +16,7 @@ pbr>=0.6,!=0.7,<1.0
pecan>=0.5.0
posix_ipc
oslo.messaging>=1.3.0
+oslo.utils>=0.2.0
pysnmp>=4.2.1,<5.0.0
python-ceilometerclient>=1.0.6
python-glanceclient>=0.13.1
diff --git a/requirements.txt b/requirements.txt
index 689c16c9..c4b0ebf7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,6 +19,7 @@ pbr>=0.6,!=0.7,<1.0
pecan>=0.5.0
posix_ipc
oslo.messaging>=1.3.0
+oslo.utils>=0.2.0
pysnmp>=4.2.1,<5.0.0
python-ceilometerclient>=1.0.6
python-glanceclient>=0.13.1
diff --git a/tools/make_test_data.py b/tools/make_test_data.py
index c1918cba..9f3b069e 100755
--- a/tools/make_test_data.py
+++ b/tools/make_test_data.py
@@ -34,11 +34,12 @@ import random
import sys
from oslo.config import cfg
+from oslo.utils import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer import storage
-from ceilometer.openstack.common import timeutils
+
def make_test_data(conn, name, meter_type, unit, volume, random_min,
random_max, user_id, project_id, resource_id, start,