Switch to oslo.utils
Change-Id: Iacfcbf49864198915f8c229bc552afb412b83b79
This commit is contained in:
parent
3006d5a77b
commit
14b4cdbb51
@ -22,12 +22,12 @@ import datetime
|
|||||||
|
|
||||||
from ceilometerclient import client as ceiloclient
|
from ceilometerclient import client as ceiloclient
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
import pytz
|
import pytz
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -19,11 +19,12 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.alarm import evaluator
|
from ceilometer.alarm import evaluator
|
||||||
from ceilometer.alarm.evaluator import utils
|
from ceilometer.alarm.evaluator import utils
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -19,10 +19,11 @@ import math
|
|||||||
import random
|
import random
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.alarm import rpc as rpc_alarm
|
from ceilometer.alarm import rpc as rpc_alarm
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -21,6 +21,7 @@ import abc
|
|||||||
|
|
||||||
from ceilometerclient import client as ceiloclient
|
from ceilometerclient import client as ceiloclient
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import netutils
|
||||||
import six
|
import six
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
@ -29,7 +30,6 @@ from ceilometer.alarm import rpc as rpc_alarm
|
|||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer.openstack.common import service as os_service
|
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,
|
def _handle_action(self, action, alarm_id, previous,
|
||||||
current, reason, reason_data):
|
current, reason, reason_data):
|
||||||
try:
|
try:
|
||||||
action = network_utils.urlsplit(action)
|
action = netutils.urlsplit(action)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
_("Unable to parse action %(action)s for alarm %(alarm_id)s"),
|
_("Unable to parse action %(action)s for alarm %(alarm_id)s"),
|
||||||
|
@ -16,13 +16,13 @@ import datetime
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import happybase
|
import happybase
|
||||||
|
from oslo.utils import netutils
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from ceilometer.alarm.storage import base
|
from ceilometer.alarm.storage import base
|
||||||
from ceilometer.alarm.storage import models
|
from ceilometer.alarm.storage import models
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
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 inmemory as hbase_inmemory
|
||||||
from ceilometer.storage.hbase import utils as hbase_utils
|
from ceilometer.storage.hbase import utils as hbase_utils
|
||||||
from ceilometer import 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.
|
database name, so we are not looking for these in the url.
|
||||||
"""
|
"""
|
||||||
opts = {}
|
opts = {}
|
||||||
result = network_utils.urlsplit(url)
|
result = netutils.urlsplit(url)
|
||||||
opts['table_prefix'] = urlparse.parse_qs(
|
opts['table_prefix'] = urlparse.parse_qs(
|
||||||
result.query).get('table_prefix', [None])[0]
|
result.query).get('table_prefix', [None])[0]
|
||||||
opts['dbtype'] = result.scheme
|
opts['dbtype'] = result.scheme
|
||||||
|
@ -37,6 +37,8 @@ import pytz
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import strutils
|
||||||
|
from oslo.utils import timeutils
|
||||||
import pecan
|
import pecan
|
||||||
from pecan import rest
|
from pecan import rest
|
||||||
import six
|
import six
|
||||||
@ -50,8 +52,6 @@ from ceilometer import messaging
|
|||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
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 sample
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer import utils
|
from ceilometer import utils
|
||||||
|
@ -29,9 +29,9 @@ import eventlet
|
|||||||
# oslo.messaging use threading.local
|
# oslo.messaging use threading.local
|
||||||
eventlet.monkey_patch(socket=True, select=True, thread=True)
|
eventlet.monkey_patch(socket=True, select=True, thread=True)
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import importutils
|
||||||
|
|
||||||
from ceilometer.alarm import service as alarm_service
|
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.openstack.common import service as os_service
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
|
|
||||||
|
@ -19,13 +19,13 @@ import socket
|
|||||||
|
|
||||||
import msgpack
|
import msgpack
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import units
|
||||||
|
|
||||||
from ceilometer import dispatcher
|
from ceilometer import dispatcher
|
||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import service as os_service
|
from ceilometer.openstack.common import service as os_service
|
||||||
from ceilometer.openstack.common import units
|
|
||||||
|
|
||||||
OPTS = [
|
OPTS = [
|
||||||
cfg.StrOpt('udp_address',
|
cfg.StrOpt('udp_address',
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
"""Converters for producing compute CPU sample messages from notification
|
"""Converters for producing compute CPU sample messages from notification
|
||||||
events.
|
events.
|
||||||
"""
|
"""
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.compute import notifications
|
from ceilometer.compute import notifications
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import plugin
|
from ceilometer import plugin
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,12 +19,13 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
from ceilometer.compute.pollsters import util
|
||||||
from ceilometer.compute.virt import inspector as virt_inspector
|
from ceilometer.compute.virt import inspector as virt_inspector
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.compute import util as compute_util
|
from ceilometer.compute import util as compute_util
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
"""Implementation of Inspector abstraction for Hyper-V"""
|
"""Implementation of Inspector abstraction for Hyper-V"""
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import units
|
||||||
|
|
||||||
from ceilometer.compute.virt.hyperv import utilsv2
|
from ceilometer.compute.virt.hyperv import utilsv2
|
||||||
from ceilometer.compute.virt import inspector as virt_inspector
|
from ceilometer.compute.virt import inspector as virt_inspector
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import units
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
"""Implementation of Inspector abstraction for VMware vSphere"""
|
"""Implementation of Inspector abstraction for VMware vSphere"""
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import units
|
||||||
from oslo.vmware import api
|
from oslo.vmware import api
|
||||||
|
|
||||||
from ceilometer.compute.virt import inspector as virt_inspector
|
from ceilometer.compute.virt import inspector as virt_inspector
|
||||||
from ceilometer.compute.virt.vmware import vsphere_operations
|
from ceilometer.compute.virt.vmware import vsphere_operations
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import units
|
|
||||||
|
|
||||||
|
|
||||||
opt_group = cfg.OptGroup(name='vmware',
|
opt_group = cfg.OptGroup(name='vmware',
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer import dispatcher
|
from ceilometer import dispatcher
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils as publisher_utils
|
from ceilometer.publisher import utils as publisher_utils
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
|
|
||||||
|
@ -20,12 +20,12 @@ import os
|
|||||||
|
|
||||||
import jsonpath_rw
|
import jsonpath_rw
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
|
|
||||||
OPTS = [
|
OPTS = [
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
import itertools
|
import itertools
|
||||||
|
from oslo.utils import netutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer.hardware import inspector as insloader
|
from ceilometer.hardware import inspector as insloader
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class HardwarePollster(plugin.CentralPollster):
|
|||||||
h_cache = cache.setdefault(self.CACHE_KEY, {})
|
h_cache = cache.setdefault(self.CACHE_KEY, {})
|
||||||
sample_iters = []
|
sample_iters = []
|
||||||
for res in resources:
|
for res in resources:
|
||||||
parsed_url = network_utils.urlsplit(res)
|
parsed_url = netutils.urlsplit(res)
|
||||||
inspector = self._get_inspector(parsed_url)
|
inspector = self._get_inspector(parsed_url)
|
||||||
func = getattr(inspector, self.INSPECT_METHOD)
|
func = getattr(inspector, self.INSPECT_METHOD)
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ import itertools
|
|||||||
|
|
||||||
import glanceclient
|
import glanceclient
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer import nova_client
|
from ceilometer import nova_client
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.network.services import base
|
from ceilometer.network.services import base
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -17,12 +17,13 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.network.services import base
|
from ceilometer.network.services import base
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.network.services import base
|
from ceilometer.network.services import base
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
from oslo.utils import netutils
|
||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
from stevedore import driver as _driver
|
from stevedore import driver as _driver
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class _Base(plugin.CentralPollster):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse_my_resource(resource):
|
def _parse_my_resource(resource):
|
||||||
|
|
||||||
parse_url = network_utils.urlsplit(resource)
|
parse_url = netutils.urlsplit(resource)
|
||||||
|
|
||||||
params = urlparse.parse_qs(parse_url.query)
|
params = urlparse.parse_qs(parse_url.query)
|
||||||
parts = urlparse.ParseResult(parse_url.scheme,
|
parts = urlparse.ParseResult(parse_url.scheme,
|
||||||
|
@ -13,13 +13,12 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from ceilometer.network.statistics import driver
|
from ceilometer.network.statistics import driver
|
||||||
from ceilometer.network.statistics.opencontrail import client
|
from ceilometer.network.statistics.opencontrail import client
|
||||||
from ceilometer import neutron_client
|
from ceilometer import neutron_client
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
class OpencontrailDriver(driver.Driver):
|
class OpencontrailDriver(driver.Driver):
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
from six import moves
|
from six import moves
|
||||||
from six.moves.urllib import parse as urlparse
|
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.network.statistics.opendaylight import client
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import utils
|
from ceilometer import utils
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
from swiftclient import client as swift
|
from swiftclient import client as swift
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,9 +41,10 @@ before "proxy-server" and add the following filter in the file:
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
|
@ -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'))
|
|
@ -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
|
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2013 Intel Corp.
|
# Copyright 2013 Intel Corp.
|
||||||
# Copyright 2013 eNovance
|
# Copyright 2013-2014 eNovance
|
||||||
#
|
#
|
||||||
# Author: Yunhong Jiang <yunhong.jiang@intel.com>
|
# Author: Yunhong Jiang <yunhong.jiang@intel.com>
|
||||||
# Julien Danjou <julien@danjou.info>
|
# Julien Danjou <julien@danjou.info>
|
||||||
@ -19,11 +19,10 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
from oslo.utils import netutils
|
||||||
import six
|
import six
|
||||||
from stevedore import driver
|
from stevedore import driver
|
||||||
|
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
|
|
||||||
|
|
||||||
def get_publisher(url, namespace='ceilometer.publisher'):
|
def get_publisher(url, namespace='ceilometer.publisher'):
|
||||||
"""Get publisher driver and load it.
|
"""Get publisher driver and load it.
|
||||||
@ -31,7 +30,7 @@ def get_publisher(url, namespace='ceilometer.publisher'):
|
|||||||
:param URL: URL for the publisher
|
:param URL: URL for the publisher
|
||||||
:param namespace: Namespace to use to look for drivers.
|
: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)
|
loaded_driver = driver.DriverManager(namespace, parse_result.scheme)
|
||||||
return loaded_driver.driver(parse_result)
|
return loaded_driver.driver(parse_result)
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ import socket
|
|||||||
|
|
||||||
import msgpack
|
import msgpack
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import netutils
|
||||||
|
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer import publisher
|
from ceilometer import publisher
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ LOG = log.getLogger(__name__)
|
|||||||
|
|
||||||
class UDPPublisher(publisher.PublisherBase):
|
class UDPPublisher(publisher.PublisherBase):
|
||||||
def __init__(self, parsed_url):
|
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,
|
parsed_url.netloc,
|
||||||
default_port=cfg.CONF.collector.udp_port)
|
default_port=cfg.CONF.collector.udp_port)
|
||||||
self.socket = socket.socket(socket.AF_INET,
|
self.socket = socket.socket(socket.AF_INET,
|
||||||
|
@ -21,11 +21,10 @@ import datetime
|
|||||||
import inspect
|
import inspect
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
from six import moves
|
from six import moves
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
def iter_period(start, end, period):
|
def iter_period(start, end, period):
|
||||||
"""Split a time from start to end in periods of a number of seconds.
|
"""Split a time from start to end in periods of a number of seconds.
|
||||||
|
@ -28,11 +28,11 @@ import sys
|
|||||||
|
|
||||||
import bson.code
|
import bson.code
|
||||||
import bson.objectid
|
import bson.objectid
|
||||||
|
from oslo.utils import timeutils
|
||||||
import pymongo
|
import pymongo
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.storage import base
|
from ceilometer.storage import base
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
|
@ -18,12 +18,12 @@ import os
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import happybase
|
import happybase
|
||||||
|
from oslo.utils import netutils
|
||||||
|
from oslo.utils import timeutils
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
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 import base
|
||||||
from ceilometer.storage.hbase import inmemory as hbase_inmemory
|
from ceilometer.storage.hbase import inmemory as hbase_inmemory
|
||||||
from ceilometer.storage.hbase import utils as hbase_utils
|
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.
|
database name, so we are not looking for these in the url.
|
||||||
"""
|
"""
|
||||||
opts = {}
|
opts = {}
|
||||||
result = network_utils.urlsplit(url)
|
result = netutils.urlsplit(url)
|
||||||
opts['table_prefix'] = urlparse.parse_qs(
|
opts['table_prefix'] = urlparse.parse_qs(
|
||||||
result.query).get('table_prefix', [None])[0]
|
result.query).get('table_prefix', [None])[0]
|
||||||
opts['dbtype'] = result.scheme
|
opts['dbtype'] = result.scheme
|
||||||
|
@ -30,11 +30,11 @@ import uuid
|
|||||||
import bson.code
|
import bson.code
|
||||||
import bson.objectid
|
import bson.objectid
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
import pymongo
|
import pymongo
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.storage import base
|
from ceilometer.storage import base
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
|
@ -22,6 +22,7 @@ import operator
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
from sqlalchemy import distinct
|
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
|
import ceilometer.openstack.common.db.sqlalchemy.session as sqlalchemy_session
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.storage import base
|
from ceilometer.storage import base
|
||||||
from ceilometer.storage import models as api_models
|
from ceilometer.storage import models as api_models
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
"""Model classes for use in the storage API.
|
"""Model classes for use in the storage API.
|
||||||
"""
|
"""
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.storage import base
|
from ceilometer.storage import base
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import netutils
|
||||||
import pymongo
|
import pymongo
|
||||||
import six
|
import six
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ class ConnectionPool(object):
|
|||||||
client = self._pool.get(pool_key)()
|
client = self._pool.get(pool_key)()
|
||||||
if client:
|
if client:
|
||||||
return client
|
return client
|
||||||
splitted_url = network_utils.urlsplit(url)
|
splitted_url = netutils.urlsplit(url)
|
||||||
log_data = {'db': splitted_url.scheme,
|
log_data = {'db': splitted_url.scheme,
|
||||||
'nodelist': connection_options['nodelist']}
|
'nodelist': connection_options['nodelist']}
|
||||||
LOG.info(_('Connecting to %(db)s on %(nodelist)s') % log_data)
|
LOG.info(_('Connecting to %(db)s on %(nodelist)s') % log_data)
|
||||||
|
@ -14,11 +14,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
from sqlalchemy import MetaData, Table, Column, DateTime
|
from sqlalchemy import MetaData, Table, Column, DateTime
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade(migrate_engine):
|
def upgrade(migrate_engine):
|
||||||
meta = MetaData(bind=migrate_engine)
|
meta = MetaData(bind=migrate_engine)
|
||||||
|
@ -10,10 +10,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import timeutils
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.storage.sqlalchemy import models
|
from ceilometer.storage.sqlalchemy import models
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ SQLAlchemy models for Ceilometer data.
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
from sqlalchemy import (Column, Integer, String, ForeignKey, Index,
|
from sqlalchemy import (Column, Integer, String, ForeignKey, Index,
|
||||||
UniqueConstraint, BigInteger, join)
|
UniqueConstraint, BigInteger, join)
|
||||||
@ -30,7 +31,6 @@ from sqlalchemy.orm import column_property
|
|||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.types import TypeDecorator
|
from sqlalchemy.types import TypeDecorator
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.storage import models as api_models
|
from ceilometer.storage import models as api_models
|
||||||
from ceilometer import utils
|
from ceilometer import utils
|
||||||
|
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
"""class for tests in ceilometer/alarm/evaluator/__init__.py
|
"""class for tests in ceilometer/alarm/evaluator/__init__.py
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
|
|
||||||
from ceilometer.alarm import evaluator
|
from ceilometer.alarm import evaluator
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
class TestEvaluatorBaseClass(base.BaseTestCase):
|
class TestEvaluatorBaseClass(base.BaseTestCase):
|
||||||
|
@ -21,9 +21,10 @@ import mock
|
|||||||
import pytz
|
import pytz
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.alarm.evaluator import combination
|
from ceilometer.alarm.evaluator import combination
|
||||||
from ceilometer.alarm.storage import models
|
from ceilometer.alarm.storage import models
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.tests.alarm.evaluator import base
|
from ceilometer.tests.alarm.evaluator import base
|
||||||
from ceilometerclient import exc
|
from ceilometerclient import exc
|
||||||
from ceilometerclient.v2 import alarms
|
from ceilometerclient.v2 import alarms
|
||||||
|
@ -21,11 +21,11 @@ import mock
|
|||||||
import pytz
|
import pytz
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
from six import moves
|
from six import moves
|
||||||
|
|
||||||
from ceilometer.alarm.evaluator import threshold
|
from ceilometer.alarm.evaluator import threshold
|
||||||
from ceilometer.alarm.storage import models
|
from ceilometer.alarm.storage import models
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.tests.alarm.evaluator import base
|
from ceilometer.tests.alarm.evaluator import base
|
||||||
from ceilometerclient import exc
|
from ceilometerclient import exc
|
||||||
from ceilometerclient.v2 import statistics
|
from ceilometerclient.v2 import statistics
|
||||||
|
@ -22,11 +22,11 @@ import uuid
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import fixture as fixture_config
|
from oslo.config import fixture as fixture_config
|
||||||
|
from oslo.utils import timeutils
|
||||||
from six import moves
|
from six import moves
|
||||||
|
|
||||||
from ceilometer.alarm.partition import coordination
|
from ceilometer.alarm.partition import coordination
|
||||||
from ceilometer.alarm.storage import models
|
from ceilometer.alarm.storage import models
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class TestAlarmNotifier(tests_base.BaseTestCase):
|
|||||||
raise Exception("Evil urlsplit!")
|
raise Exception("Evil urlsplit!")
|
||||||
|
|
||||||
def test_notify_alarm_invalid_url(self):
|
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):
|
self._fake_urlsplit):
|
||||||
LOG = mock.MagicMock()
|
LOG = mock.MagicMock()
|
||||||
with mock.patch('ceilometer.alarm.service.LOG', LOG):
|
with mock.patch('ceilometer.alarm.service.LOG', LOG):
|
||||||
|
@ -20,12 +20,12 @@ import uuid
|
|||||||
from ceilometerclient.v2 import alarms
|
from ceilometerclient.v2 import alarms
|
||||||
import eventlet
|
import eventlet
|
||||||
from oslo.config import fixture as fixture_config
|
from oslo.config import fixture as fixture_config
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.alarm import rpc as rpc_alarm
|
from ceilometer.alarm import rpc as rpc_alarm
|
||||||
from ceilometer.alarm.storage import models
|
from ceilometer.alarm.storage import models
|
||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import webtest
|
import webtest
|
||||||
|
|
||||||
from ceilometer.api import app
|
from ceilometer.api import app
|
||||||
from ceilometer.api.controllers import v2 as v2_api
|
from ceilometer.api.controllers import v2 as v2_api
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.tests import api as acl
|
from ceilometer.tests import api as acl
|
||||||
|
@ -20,8 +20,9 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.alarm.storage import models
|
from ceilometer.alarm.storage import models
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.tests.api import v2 as tests_api
|
from ceilometer.tests.api import v2 as tests_api
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
from ceilometer.tests.api import v2
|
from ceilometer.tests.api import v2
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
from ceilometer.tests.api import v2
|
from ceilometer.tests.api import v2
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
import webtest.app
|
import webtest.app
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.tests.api import v2
|
from ceilometer.tests.api import v2
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.tests.api import v2
|
from ceilometer.tests.api import v2
|
||||||
|
@ -21,9 +21,9 @@ import copy
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import mockpatch
|
from oslotest import mockpatch
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.tests.api import v2
|
from ceilometer.tests.api import v2
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@ import datetime
|
|||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
from oslotest import mockpatch
|
||||||
import wsme
|
import wsme
|
||||||
|
|
||||||
from ceilometer.api.controllers import v2 as api
|
from ceilometer.api.controllers import v2 as api
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ import os.path
|
|||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
import oslo.messaging.conffixture
|
import oslo.messaging.conffixture
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
from oslotest import mockpatch
|
||||||
import six
|
import six
|
||||||
from testtools import testcase
|
from testtools import testcase
|
||||||
|
|
||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
|
|
||||||
class BaseTestCase(base.BaseTestCase):
|
class BaseTestCase(base.BaseTestCase):
|
||||||
|
@ -18,10 +18,10 @@ Tests for Hyper-V inspector.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import units
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
|
|
||||||
from ceilometer.compute.virt.hyperv import inspector as hyperv_inspector
|
from ceilometer.compute.virt.hyperv import inspector as hyperv_inspector
|
||||||
from ceilometer.openstack.common import units
|
|
||||||
|
|
||||||
|
|
||||||
class TestHyperVInspection(base.BaseTestCase):
|
class TestHyperVInspection(base.BaseTestCase):
|
||||||
|
@ -546,7 +546,7 @@ class TestEventDefinition(ConverterBase):
|
|||||||
edef = converter.EventDefinition(cfg, self.fake_plugin_mgr)
|
edef = converter.EventDefinition(cfg, self.fake_plugin_mgr)
|
||||||
self.assertTrue(edef.is_catchall)
|
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):
|
def test_extract_when(self, mock_utcnow):
|
||||||
now = datetime.datetime.utcnow()
|
now = datetime.datetime.utcnow()
|
||||||
modified = now + datetime.timedelta(minutes=1)
|
modified = now + datetime.timedelta(minutes=1)
|
||||||
@ -623,7 +623,7 @@ class TestNotificationConverter(ConverterBase):
|
|||||||
host='cydonia')
|
host='cydonia')
|
||||||
self.fake_plugin_mgr = {}
|
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):
|
def test_converter_missing_keys(self, mock_utcnow):
|
||||||
# test a malformed notification
|
# test a malformed notification
|
||||||
now = datetime.datetime.utcnow()
|
now = datetime.datetime.utcnow()
|
||||||
|
@ -14,20 +14,20 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from oslo.utils import netutils
|
||||||
|
|
||||||
from ceilometer.hardware import inspector
|
from ceilometer.hardware import inspector
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
|
|
||||||
|
|
||||||
class TestHardwareInspector(base.BaseTestCase):
|
class TestHardwareInspector(base.BaseTestCase):
|
||||||
def test_get_inspector(self):
|
def test_get_inspector(self):
|
||||||
url = network_utils.urlsplit("snmp://")
|
url = netutils.urlsplit("snmp://")
|
||||||
driver = inspector.get_inspector(url)
|
driver = inspector.get_inspector(url)
|
||||||
self.assertTrue(driver)
|
self.assertTrue(driver)
|
||||||
|
|
||||||
def test_get_inspector_illegal(self):
|
def test_get_inspector_illegal(self):
|
||||||
url = network_utils.urlsplit("illegal://")
|
url = netutils.urlsplit("illegal://")
|
||||||
self.assertRaises(RuntimeError,
|
self.assertRaises(RuntimeError,
|
||||||
inspector.get_inspector,
|
inspector.get_inspector,
|
||||||
url)
|
url)
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py
|
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py
|
||||||
"""
|
"""
|
||||||
|
from oslo.utils import netutils
|
||||||
from oslotest import mockpatch
|
from oslotest import mockpatch
|
||||||
|
|
||||||
from ceilometer.hardware.inspector import snmp
|
from ceilometer.hardware.inspector import snmp
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer.tests import base as test_base
|
from ceilometer.tests import base as test_base
|
||||||
from ceilometer.tests.hardware.inspector import base
|
from ceilometer.tests.hardware.inspector import base
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ class TestSNMPInspector(Base, test_base.BaseTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestSNMPInspector, self).setUp()
|
super(TestSNMPInspector, self).setUp()
|
||||||
self.inspector = snmp.SNMPInspector()
|
self.inspector = snmp.SNMPInspector()
|
||||||
self.host = network_utils.urlsplit("snmp://localhost")
|
self.host = netutils.urlsplit("snmp://localhost")
|
||||||
self.inspector.MAPPING = self.mapping
|
self.inspector.MAPPING = self.mapping
|
||||||
self.useFixture(mockpatch.PatchObject(
|
self.useFixture(mockpatch.PatchObject(
|
||||||
self.inspector._cmdGen, 'getCmd', new=faux_getCmd))
|
self.inspector._cmdGen, 'getCmd', new=faux_getCmd))
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
|
|
||||||
from ceilometer.network import statistics
|
from ceilometer.network import statistics
|
||||||
from ceilometer.network.statistics import driver
|
from ceilometer.network.statistics import driver
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@ import datetime
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import mockpatch
|
from oslotest import mockpatch
|
||||||
import six
|
import six
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer import publisher
|
from ceilometer import publisher
|
||||||
from ceilometer.publisher import test as test_publisher
|
from ceilometer.publisher import test as test_publisher
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2013 eNovance
|
# Copyright 2013-2014 eNovance
|
||||||
#
|
#
|
||||||
# Author: Julien Danjou <julien@danjou.info>
|
# Author: Julien Danjou <julien@danjou.info>
|
||||||
#
|
#
|
||||||
@ -22,9 +22,9 @@ import logging.handlers
|
|||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
from oslo.utils import netutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
|
|
||||||
from ceilometer.openstack.common import network_utils as utils
|
|
||||||
from ceilometer.publisher import file
|
from ceilometer.publisher import file
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ class TestFilePublisher(base.BaseTestCase):
|
|||||||
# Test valid configurations
|
# Test valid configurations
|
||||||
tempdir = tempfile.mkdtemp()
|
tempdir = tempfile.mkdtemp()
|
||||||
name = '%s/log_file' % tempdir
|
name = '%s/log_file' % tempdir
|
||||||
parsed_url = utils.urlsplit('file://%s?max_bytes=50&backup_count=3'
|
parsed_url = netutils.urlsplit('file://%s?max_bytes=50&backup_count=3'
|
||||||
% name)
|
% name)
|
||||||
publisher = file.FilePublisher(parsed_url)
|
publisher = file.FilePublisher(parsed_url)
|
||||||
publisher.publish_samples(None,
|
publisher.publish_samples(None,
|
||||||
self.test_data)
|
self.test_data)
|
||||||
@ -90,7 +90,7 @@ class TestFilePublisher(base.BaseTestCase):
|
|||||||
# Test missing max bytes, backup count configurations
|
# Test missing max bytes, backup count configurations
|
||||||
tempdir = tempfile.mkdtemp()
|
tempdir = tempfile.mkdtemp()
|
||||||
name = '%s/log_file_plain' % tempdir
|
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 = file.FilePublisher(parsed_url)
|
||||||
publisher.publish_samples(None,
|
publisher.publish_samples(None,
|
||||||
self.test_data)
|
self.test_data)
|
||||||
@ -112,7 +112,7 @@ class TestFilePublisher(base.BaseTestCase):
|
|||||||
def test_file_publisher_invalid(self):
|
def test_file_publisher_invalid(self):
|
||||||
# Test invalid max bytes, backup count configurations
|
# Test invalid max bytes, backup count configurations
|
||||||
tempdir = tempfile.mkdtemp()
|
tempdir = tempfile.mkdtemp()
|
||||||
parsed_url = utils.urlsplit(
|
parsed_url = netutils.urlsplit(
|
||||||
'file://%s/log_file_bad'
|
'file://%s/log_file_bad'
|
||||||
'?max_bytes=yus&backup_count=5y' % tempdir)
|
'?max_bytes=yus&backup_count=5y' % tempdir)
|
||||||
publisher = file.FilePublisher(parsed_url)
|
publisher = file.FilePublisher(parsed_url)
|
||||||
|
@ -24,10 +24,10 @@ import mock
|
|||||||
from oslo.config import fixture as fixture_config
|
from oslo.config import fixture as fixture_config
|
||||||
import oslo.messaging
|
import oslo.messaging
|
||||||
import oslo.messaging._drivers.common
|
import oslo.messaging._drivers.common
|
||||||
|
from oslo.utils import netutils
|
||||||
|
|
||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
@ -100,7 +100,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
|
|
||||||
def test_published_no_mock(self):
|
def test_published_no_mock(self):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://'))
|
netutils.urlsplit('rpc://'))
|
||||||
|
|
||||||
endpoint = mock.MagicMock(['record_metering_data'])
|
endpoint = mock.MagicMock(['record_metering_data'])
|
||||||
collector = messaging.get_rpc_server(
|
collector = messaging.get_rpc_server(
|
||||||
@ -127,7 +127,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
|
|
||||||
def test_publish_target(self):
|
def test_publish_target(self):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?target=custom_procedure_call'))
|
netutils.urlsplit('rpc://?target=custom_procedure_call'))
|
||||||
cast_context = mock.MagicMock()
|
cast_context = mock.MagicMock()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
prepare.return_value = cast_context
|
prepare.return_value = cast_context
|
||||||
@ -141,7 +141,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
|
|
||||||
def test_published_with_per_meter_topic(self):
|
def test_published_with_per_meter_topic(self):
|
||||||
publisher = rpc.RPCPublisher(
|
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:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
publisher.publish_samples(mock.MagicMock(),
|
publisher.publish_samples(mock.MagicMock(),
|
||||||
self.test_data)
|
self.test_data)
|
||||||
@ -169,7 +169,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
def test_published_concurrency(self):
|
def test_published_concurrency(self):
|
||||||
"""Test concurrent access to the local queue of the rpc publisher."""
|
"""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()
|
cast_context = mock.MagicMock()
|
||||||
|
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
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')
|
@mock.patch('ceilometer.publisher.rpc.LOG')
|
||||||
def test_published_with_no_policy(self, mylog):
|
def test_published_with_no_policy(self, mylog):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://'))
|
netutils.urlsplit('rpc://'))
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
prepare.side_effect = side_effect
|
prepare.side_effect = side_effect
|
||||||
@ -217,7 +217,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
@mock.patch('ceilometer.publisher.rpc.LOG')
|
@mock.patch('ceilometer.publisher.rpc.LOG')
|
||||||
def test_published_with_policy_block(self, mylog):
|
def test_published_with_policy_block(self, mylog):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?policy=default'))
|
netutils.urlsplit('rpc://?policy=default'))
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
prepare.side_effect = side_effect
|
prepare.side_effect = side_effect
|
||||||
@ -233,7 +233,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
@mock.patch('ceilometer.publisher.rpc.LOG')
|
@mock.patch('ceilometer.publisher.rpc.LOG')
|
||||||
def test_published_with_policy_incorrect(self, mylog):
|
def test_published_with_policy_incorrect(self, mylog):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?policy=notexist'))
|
netutils.urlsplit('rpc://?policy=notexist'))
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
prepare.side_effect = side_effect
|
prepare.side_effect = side_effect
|
||||||
@ -249,7 +249,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
|
|
||||||
def test_published_with_policy_drop_and_rpc_down(self):
|
def test_published_with_policy_drop_and_rpc_down(self):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?policy=drop'))
|
netutils.urlsplit('rpc://?policy=drop'))
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
prepare.side_effect = side_effect
|
prepare.side_effect = side_effect
|
||||||
@ -261,7 +261,7 @@ class TestPublish(tests_base.BaseTestCase):
|
|||||||
|
|
||||||
def test_published_with_policy_queue_and_rpc_down(self):
|
def test_published_with_policy_queue_and_rpc_down(self):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?policy=queue'))
|
netutils.urlsplit('rpc://?policy=queue'))
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
prepare.side_effect = side_effect
|
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):
|
def test_published_with_policy_queue_and_rpc_down_up(self):
|
||||||
self.rpc_unreachable = True
|
self.rpc_unreachable = True
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?policy=queue'))
|
netutils.urlsplit('rpc://?policy=queue'))
|
||||||
|
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
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):
|
def test_published_with_policy_sized_queue_and_rpc_down(self):
|
||||||
publisher = rpc.RPCPublisher(
|
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()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
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):
|
def test_published_with_policy_default_sized_queue_and_rpc_down(self):
|
||||||
publisher = rpc.RPCPublisher(
|
publisher = rpc.RPCPublisher(
|
||||||
network_utils.urlsplit('rpc://?policy=queue'))
|
netutils.urlsplit('rpc://?policy=queue'))
|
||||||
|
|
||||||
side_effect = oslo.messaging._drivers.common.RPCException()
|
side_effect = oslo.messaging._drivers.common.RPCException()
|
||||||
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
with mock.patch.object(publisher.rpc_client, 'prepare') as prepare:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2013 eNovance
|
# Copyright 2013-2014 eNovance
|
||||||
#
|
#
|
||||||
# Author: Julien Danjou <julien@danjou.info>
|
# Author: Julien Danjou <julien@danjou.info>
|
||||||
#
|
#
|
||||||
@ -22,9 +22,9 @@ import datetime
|
|||||||
import mock
|
import mock
|
||||||
import msgpack
|
import msgpack
|
||||||
from oslo.config import fixture as fixture_config
|
from oslo.config import fixture as fixture_config
|
||||||
|
from oslo.utils import netutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
|
|
||||||
from ceilometer.openstack.common import network_utils
|
|
||||||
from ceilometer.publisher import udp
|
from ceilometer.publisher import udp
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
@ -118,7 +118,7 @@ class TestUDPPublisher(base.BaseTestCase):
|
|||||||
with mock.patch('socket.socket',
|
with mock.patch('socket.socket',
|
||||||
self._make_fake_socket(self.data_sent)):
|
self._make_fake_socket(self.data_sent)):
|
||||||
publisher = udp.UDPPublisher(
|
publisher = udp.UDPPublisher(
|
||||||
network_utils.urlsplit('udp://somehost'))
|
netutils.urlsplit('udp://somehost'))
|
||||||
publisher.publish_samples(None,
|
publisher.publish_samples(None,
|
||||||
self.test_data)
|
self.test_data)
|
||||||
|
|
||||||
@ -152,6 +152,6 @@ class TestUDPPublisher(base.BaseTestCase):
|
|||||||
with mock.patch('socket.socket',
|
with mock.patch('socket.socket',
|
||||||
self._make_broken_socket):
|
self._make_broken_socket):
|
||||||
publisher = udp.UDPPublisher(
|
publisher = udp.UDPPublisher(
|
||||||
network_utils.urlsplit('udp://localhost'))
|
netutils.urlsplit('udp://localhost'))
|
||||||
publisher.publish_samples(None,
|
publisher.publish_samples(None,
|
||||||
self.test_data)
|
self.test_data)
|
||||||
|
@ -26,9 +26,9 @@ import datetime
|
|||||||
import repr
|
import repr
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.alarm.storage import impl_sqlalchemy as impl_sqla_alarm
|
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 impl_sqlalchemy
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
from ceilometer.storage.sqlalchemy import models as sql_models
|
from ceilometer.storage.sqlalchemy import models as sql_models
|
||||||
|
@ -23,9 +23,9 @@ import datetime
|
|||||||
import operator
|
import operator
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.alarm.storage import models as alarm_models
|
from ceilometer.alarm.storage import models as alarm_models
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
|
@ -21,6 +21,7 @@ import mock
|
|||||||
import msgpack
|
import msgpack
|
||||||
from oslo.config import fixture as fixture_config
|
from oslo.config import fixture as fixture_config
|
||||||
import oslo.messaging
|
import oslo.messaging
|
||||||
|
from oslo.utils import timeutils
|
||||||
from oslotest import mockpatch
|
from oslotest import mockpatch
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
@ -28,7 +29,6 @@ from ceilometer import collector
|
|||||||
from ceilometer import dispatcher
|
from ceilometer import dispatcher
|
||||||
from ceilometer import messaging
|
from ceilometer import messaging
|
||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
|
@ -21,6 +21,7 @@ import mock
|
|||||||
from oslo.config import fixture as fixture_config
|
from oslo.config import fixture as fixture_config
|
||||||
import oslo.messaging
|
import oslo.messaging
|
||||||
import oslo.messaging.conffixture
|
import oslo.messaging.conffixture
|
||||||
|
from oslo.utils import timeutils
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -29,7 +30,6 @@ from ceilometer import messaging
|
|||||||
from ceilometer import notification
|
from ceilometer import notification
|
||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import fileutils
|
from ceilometer.openstack.common import fileutils
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.publisher import test as test_publisher
|
from ceilometer.publisher import test as test_publisher
|
||||||
from ceilometer.tests import base as tests_base
|
from ceilometer.tests import base as tests_base
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
import collections
|
import collections
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer import transformer
|
from ceilometer import transformer
|
||||||
|
|
||||||
|
@ -24,11 +24,10 @@ import datetime
|
|||||||
import decimal
|
import decimal
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
from oslo.utils import units
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
from ceilometer.openstack.common import units
|
|
||||||
|
|
||||||
|
|
||||||
def recursive_keypairs(d, separator=':'):
|
def recursive_keypairs(d, separator=':'):
|
||||||
"""Generator that produces sequence of keypairs for nested dictionaries."""
|
"""Generator that produces sequence of keypairs for nested dictionaries."""
|
||||||
|
@ -22,8 +22,10 @@ import contextlib
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.utils import importutils
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
from oslotest import moxstubout
|
from oslotest import moxstubout
|
||||||
|
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
## NOTE(dhellmann): These imports are not in the generally approved
|
## 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 config
|
||||||
from nova import context
|
from nova import context
|
||||||
from nova import db
|
from nova import db
|
||||||
from nova.openstack.common import importutils
|
|
||||||
from nova.openstack.common import log as logging
|
from nova.openstack.common import log as logging
|
||||||
|
|
||||||
# This option is used in the nova_notifier module, so make
|
# This option is used in the nova_notifier module, so make
|
||||||
|
@ -6,9 +6,7 @@ module=context
|
|||||||
module=db
|
module=db
|
||||||
module=db.sqlalchemy
|
module=db.sqlalchemy
|
||||||
module=eventlet_backdoor
|
module=eventlet_backdoor
|
||||||
module=excutils
|
|
||||||
module=gettextutils
|
module=gettextutils
|
||||||
module=importutils
|
|
||||||
module=jsonutils
|
module=jsonutils
|
||||||
module=local
|
module=local
|
||||||
module=log
|
module=log
|
||||||
@ -20,13 +18,9 @@ module=middleware.correlation_id
|
|||||||
module=middleware.debug
|
module=middleware.debug
|
||||||
module=middleware.request_id
|
module=middleware.request_id
|
||||||
module=middleware.sizelimit
|
module=middleware.sizelimit
|
||||||
module=network_utils
|
|
||||||
module=policy
|
module=policy
|
||||||
module=service
|
module=service
|
||||||
module=strutils
|
|
||||||
module=threadgroup
|
module=threadgroup
|
||||||
module=timeutils
|
|
||||||
module=units
|
|
||||||
|
|
||||||
# The base module to hold the copy of openstack.common
|
# The base module to hold the copy of openstack.common
|
||||||
base=ceilometer
|
base=ceilometer
|
||||||
|
@ -16,6 +16,7 @@ pbr>=0.6,!=0.7,<1.0
|
|||||||
pecan>=0.5.0
|
pecan>=0.5.0
|
||||||
posix_ipc
|
posix_ipc
|
||||||
oslo.messaging>=1.3.0
|
oslo.messaging>=1.3.0
|
||||||
|
oslo.utils>=0.2.0
|
||||||
pysnmp>=4.2.1,<5.0.0
|
pysnmp>=4.2.1,<5.0.0
|
||||||
python-ceilometerclient>=1.0.6
|
python-ceilometerclient>=1.0.6
|
||||||
python-glanceclient>=0.13.1
|
python-glanceclient>=0.13.1
|
||||||
|
@ -19,6 +19,7 @@ pbr>=0.6,!=0.7,<1.0
|
|||||||
pecan>=0.5.0
|
pecan>=0.5.0
|
||||||
posix_ipc
|
posix_ipc
|
||||||
oslo.messaging>=1.3.0
|
oslo.messaging>=1.3.0
|
||||||
|
oslo.utils>=0.2.0
|
||||||
pysnmp>=4.2.1,<5.0.0
|
pysnmp>=4.2.1,<5.0.0
|
||||||
python-ceilometerclient>=1.0.6
|
python-ceilometerclient>=1.0.6
|
||||||
python-glanceclient>=0.13.1
|
python-glanceclient>=0.13.1
|
||||||
|
@ -34,11 +34,12 @@ import random
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
from oslo.utils import timeutils
|
||||||
|
|
||||||
from ceilometer.publisher import utils
|
from ceilometer.publisher import utils
|
||||||
from ceilometer import sample
|
from ceilometer import sample
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.openstack.common import timeutils
|
|
||||||
|
|
||||||
def make_test_data(conn, name, meter_type, unit, volume, random_min,
|
def make_test_data(conn, name, meter_type, unit, volume, random_min,
|
||||||
random_max, user_id, project_id, resource_id, start,
|
random_max, user_id, project_id, resource_id, start,
|
||||||
|
Loading…
Reference in New Issue
Block a user