Rename the MeterPublisher to RPCPublisher
Blueprint: pipeline-publisher-url Change-Id: I6c912406e0e129b7e2523c40c2678e8b5e5c1df2 Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
aa842c26ac
commit
31ab90f5ff
@ -21,7 +21,7 @@ import msgpack
|
||||
import socket
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.publisher import meter as publisher_meter
|
||||
from ceilometer.publisher import rpc as publisher_rpc
|
||||
from ceilometer.service import prepare_service
|
||||
from ceilometer.openstack.common import context
|
||||
from ceilometer.openstack.common import log
|
||||
@ -134,9 +134,9 @@ class CollectorService(rpc_service.Service):
|
||||
# Set ourselves up as a separate worker for the metering data,
|
||||
# since the default for service is to use create_consumer().
|
||||
self.conn.create_worker(
|
||||
cfg.CONF.publisher_meter.metering_topic,
|
||||
cfg.CONF.publisher_rpc.metering_topic,
|
||||
rpc_dispatcher.RpcDispatcher([self]),
|
||||
'ceilometer.collector.' + cfg.CONF.publisher_meter.metering_topic,
|
||||
'ceilometer.collector.' + cfg.CONF.publisher_rpc.metering_topic,
|
||||
)
|
||||
|
||||
def _setup_subscription(self, ext, *args, **kwds):
|
||||
@ -186,9 +186,9 @@ class CollectorService(rpc_service.Service):
|
||||
meter['resource_id'],
|
||||
meter.get('timestamp', 'NO TIMESTAMP'),
|
||||
meter['counter_volume'])
|
||||
if publisher_meter.verify_signature(
|
||||
if publisher_rpc.verify_signature(
|
||||
meter,
|
||||
cfg.CONF.publisher_meter.metering_secret):
|
||||
cfg.CONF.publisher_rpc.metering_secret):
|
||||
try:
|
||||
# Convert the timestamp to a datetime instance.
|
||||
# Storage engines are responsible for converting
|
||||
|
@ -51,7 +51,7 @@ METER_PUBLISH_OPTS = [
|
||||
def register_opts(config):
|
||||
"""Register the options for publishing metering messages.
|
||||
"""
|
||||
config.register_opts(METER_PUBLISH_OPTS, group="publisher_meter")
|
||||
config.register_opts(METER_PUBLISH_OPTS, group="publisher_rpc")
|
||||
|
||||
|
||||
register_opts(cfg.CONF)
|
||||
@ -102,7 +102,7 @@ def meter_message_from_counter(counter, secret, source):
|
||||
return msg
|
||||
|
||||
|
||||
class MeterPublisher(publisher.PublisherBase):
|
||||
class RPCPublisher(publisher.PublisherBase):
|
||||
def publish_counters(self, context, counters, source):
|
||||
"""Send a metering message for publishing
|
||||
|
||||
@ -114,12 +114,12 @@ class MeterPublisher(publisher.PublisherBase):
|
||||
meters = [
|
||||
meter_message_from_counter(
|
||||
counter,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
source)
|
||||
for counter in counters
|
||||
]
|
||||
|
||||
topic = cfg.CONF.publisher_meter.metering_topic
|
||||
topic = cfg.CONF.publisher_rpc.metering_topic
|
||||
msg = {
|
||||
'method': 'record_metering_data',
|
||||
'version': '1.0',
|
@ -437,6 +437,20 @@
|
||||
#cinder_control_exchange=cinder
|
||||
|
||||
|
||||
[publisher_rpc]
|
||||
|
||||
#
|
||||
# Options defined in ceilometer.publisher.rpc
|
||||
#
|
||||
|
||||
# the topic ceilometer uses for metering messages (string
|
||||
# value)
|
||||
#metering_topic=metering
|
||||
|
||||
# Secret value for signing metering messages (string value)
|
||||
#metering_secret=change this or be hacked
|
||||
|
||||
|
||||
[database]
|
||||
|
||||
#
|
||||
@ -500,20 +514,6 @@
|
||||
#pool_timeout=<None>
|
||||
|
||||
|
||||
[publisher_meter]
|
||||
|
||||
#
|
||||
# Options defined in ceilometer.publisher.meter
|
||||
#
|
||||
|
||||
# the topic ceilometer uses for metering messages (string
|
||||
# value)
|
||||
#metering_topic=metering
|
||||
|
||||
# Secret value for signing metering messages (string value)
|
||||
#metering_secret=change this or be hacked
|
||||
|
||||
|
||||
[rpc_notifier2]
|
||||
|
||||
#
|
||||
|
@ -6,4 +6,4 @@
|
||||
- "*"
|
||||
transformers:
|
||||
publishers:
|
||||
- meter://
|
||||
- rpc://
|
||||
|
@ -78,8 +78,9 @@ ceilometer.transformer =
|
||||
|
||||
ceilometer.publisher =
|
||||
test = ceilometer.publisher.test:TestPublisher
|
||||
meter_publisher = ceilometer.publisher.meter:MeterPublisher
|
||||
meter = ceilometer.publisher.meter:MeterPublisher
|
||||
meter_publisher = ceilometer.publisher.rpc:RPCPublisher
|
||||
meter = ceilometer.publisher.rpc:RPCPublisher
|
||||
rpc = ceilometer.publisher.rpc:RPCPublisher
|
||||
udp = ceilometer.publisher.udp:UDPPublisher
|
||||
|
||||
paste.filter_factory =
|
||||
|
@ -23,7 +23,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -71,9 +71,9 @@ class TestListEvents(tests_api.TestBase):
|
||||
'tag': 'self.counter2'}
|
||||
),
|
||||
]:
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
cnt,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1')
|
||||
self.conn.record_metering_data(msg)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -100,9 +100,9 @@ class TestListMeters(tests_api.TestBase):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 43),
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'four.counter'})]:
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
cnt,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_resources')
|
||||
self.conn.record_metering_data(msg)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -55,9 +55,9 @@ class TestListProjects(tests_api.TestBase):
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'self.counter'}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_projects',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -74,9 +74,9 @@ class TestListProjects(tests_api.TestBase):
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'self.counter2'}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_users',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
|
@ -24,7 +24,7 @@ import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -93,9 +93,9 @@ class TestListResourcesBase(tests_api.TestBase):
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'self.counter4'}
|
||||
)]:
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
cnt,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_resources')
|
||||
self.conn.record_metering_data(msg)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -57,9 +57,9 @@ class TestListUsers(tests_api.TestBase):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_users',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -77,9 +77,9 @@ class TestListUsers(tests_api.TestBase):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'not-test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
|
@ -23,7 +23,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -52,9 +52,9 @@ class TestMaxProjectVolume(tests_api.TestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -22,7 +22,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -51,9 +51,9 @@ class TestMaxResourceVolume(tests_api.TestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -23,7 +23,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -52,9 +52,9 @@ class TestSumProjectVolume(tests_api.TestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -23,7 +23,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.tests import api as tests_api
|
||||
@ -52,9 +52,9 @@ class TestSumResourceVolume(tests_api.TestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -22,7 +22,7 @@ from oslo.config import cfg
|
||||
|
||||
from ceilometer import counter
|
||||
from ceilometer.api import acl
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
|
||||
from .base import FunctionalTest
|
||||
|
||||
@ -98,9 +98,9 @@ class TestAPIACL(FunctionalTest):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 43),
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'self.counter4'})]:
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
cnt,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_source')
|
||||
self.conn.record_metering_data(msg)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import webtest.app
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from .base import FunctionalTest
|
||||
@ -51,9 +51,9 @@ class TestListEvents(FunctionalTest):
|
||||
'ignored_list': ['not-returned'],
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
self.counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_source',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -71,9 +71,9 @@ class TestListEvents(FunctionalTest):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
self.counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source2',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
|
@ -23,7 +23,7 @@ import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from .base import FunctionalTest
|
||||
@ -99,9 +99,9 @@ class TestListMeters(FunctionalTest):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 43),
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'self.counter4'})]:
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
cnt,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_source')
|
||||
self.conn.record_metering_data(msg)
|
||||
|
||||
|
@ -23,7 +23,7 @@ import logging
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from .base import FunctionalTest
|
||||
@ -51,9 +51,9 @@ class TestListResources(FunctionalTest):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||
resource_metadata=None
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -75,9 +75,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -95,9 +95,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -119,9 +119,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -139,9 +139,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -163,9 +163,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_resources',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -183,9 +183,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'not-test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -210,9 +210,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_resources',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -230,9 +230,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'not-test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -257,9 +257,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_resources',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -277,9 +277,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'not-test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -304,9 +304,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter1',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'not-test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -331,9 +331,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter1',
|
||||
}
|
||||
)
|
||||
msg2 = meter.meter_message_from_counter(
|
||||
msg2 = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'not-test',
|
||||
)
|
||||
self.conn.record_metering_data(msg2)
|
||||
@ -360,9 +360,9 @@ class TestListResources(FunctionalTest):
|
||||
'ignored_list': ['not-returned'],
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -389,9 +389,9 @@ class TestListResources(FunctionalTest):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
counter1,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test_list_resources',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -22,7 +22,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from ceilometer.storage.impl_mongodb import require_map_reduce
|
||||
@ -54,9 +54,9 @@ class TestMaxProjectVolume(FunctionalTest):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -22,7 +22,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from .base import FunctionalTest
|
||||
@ -53,9 +53,9 @@ class TestMaxResourceVolume(FunctionalTest):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -22,7 +22,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from .base import FunctionalTest
|
||||
@ -53,9 +53,9 @@ class TestSumProjectVolume(FunctionalTest):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -22,7 +22,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
|
||||
from .base import FunctionalTest
|
||||
@ -53,9 +53,9 @@ class TestSumResourceVolume(FunctionalTest):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'source1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -29,7 +29,7 @@ from stevedore import extension
|
||||
from stevedore.tests import manager as test_manager
|
||||
|
||||
from ceilometer import counter
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer.collector import service
|
||||
from ceilometer.storage import base
|
||||
from ceilometer.tests import base as tests_base
|
||||
@ -184,9 +184,9 @@ class TestCollectorService(TestCollector):
|
||||
'resource_id': self.id(),
|
||||
'counter_volume': 1,
|
||||
}
|
||||
msg['message_signature'] = meter.compute_signature(
|
||||
msg['message_signature'] = rpc.compute_signature(
|
||||
msg,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
)
|
||||
|
||||
self.srv.storage_conn = self.mox.CreateMock(base.Connection)
|
||||
@ -223,9 +223,9 @@ class TestCollectorService(TestCollector):
|
||||
'counter_volume': 1,
|
||||
'timestamp': '2012-07-02T13:53:40Z',
|
||||
}
|
||||
msg['message_signature'] = meter.compute_signature(
|
||||
msg['message_signature'] = rpc.compute_signature(
|
||||
msg,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
)
|
||||
|
||||
expected = {}
|
||||
@ -244,9 +244,9 @@ class TestCollectorService(TestCollector):
|
||||
'counter_volume': 1,
|
||||
'timestamp': '2012-09-30T15:31:50.262-08:00',
|
||||
}
|
||||
msg['message_signature'] = meter.compute_signature(
|
||||
msg['message_signature'] = rpc.compute_signature(
|
||||
msg,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
)
|
||||
|
||||
expected = {}
|
||||
|
@ -24,66 +24,66 @@ from oslo.config import cfg
|
||||
|
||||
from ceilometer import counter
|
||||
from ceilometer.openstack.common import jsonutils
|
||||
from ceilometer.openstack.common import rpc
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.openstack.common import rpc as oslo_rpc
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer.tests import base
|
||||
|
||||
|
||||
def test_compute_signature_change_key():
|
||||
sig1 = meter.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig2 = meter.compute_signature({'A': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig1 = rpc.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig2 = rpc.compute_signature({'A': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
assert sig1 != sig2
|
||||
|
||||
|
||||
def test_compute_signature_change_value():
|
||||
sig1 = meter.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig2 = meter.compute_signature({'a': 'a', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig1 = rpc.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig2 = rpc.compute_signature({'a': 'a', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
assert sig1 != sig2
|
||||
|
||||
|
||||
def test_compute_signature_same():
|
||||
sig1 = meter.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig2 = meter.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig1 = rpc.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
sig2 = rpc.compute_signature({'a': 'A', 'b': 'B'},
|
||||
'not-so-secret')
|
||||
assert sig1 == sig2
|
||||
|
||||
|
||||
def test_compute_signature_signed():
|
||||
data = {'a': 'A', 'b': 'B'}
|
||||
sig1 = meter.compute_signature(data, 'not-so-secret')
|
||||
sig1 = rpc.compute_signature(data, 'not-so-secret')
|
||||
data['message_signature'] = sig1
|
||||
sig2 = meter.compute_signature(data, 'not-so-secret')
|
||||
sig2 = rpc.compute_signature(data, 'not-so-secret')
|
||||
assert sig1 == sig2
|
||||
|
||||
|
||||
def test_compute_signature_use_configured_secret():
|
||||
data = {'a': 'A', 'b': 'B'}
|
||||
sig1 = meter.compute_signature(data, 'not-so-secret')
|
||||
sig2 = meter.compute_signature(data, 'different-value')
|
||||
sig1 = rpc.compute_signature(data, 'not-so-secret')
|
||||
sig2 = rpc.compute_signature(data, 'different-value')
|
||||
assert sig1 != sig2
|
||||
|
||||
|
||||
def test_verify_signature_signed():
|
||||
data = {'a': 'A', 'b': 'B'}
|
||||
sig1 = meter.compute_signature(data, 'not-so-secret')
|
||||
sig1 = rpc.compute_signature(data, 'not-so-secret')
|
||||
data['message_signature'] = sig1
|
||||
assert meter.verify_signature(data, 'not-so-secret')
|
||||
assert rpc.verify_signature(data, 'not-so-secret')
|
||||
|
||||
|
||||
def test_verify_signature_unsigned():
|
||||
data = {'a': 'A', 'b': 'B'}
|
||||
assert not meter.verify_signature(data, 'not-so-secret')
|
||||
assert not rpc.verify_signature(data, 'not-so-secret')
|
||||
|
||||
|
||||
def test_verify_signature_incorrect():
|
||||
data = {'a': 'A', 'b': 'B',
|
||||
'message_signature': 'Not the same'}
|
||||
assert not meter.verify_signature(data, 'not-so-secret')
|
||||
assert not rpc.verify_signature(data, 'not-so-secret')
|
||||
|
||||
|
||||
def test_verify_signature_nested():
|
||||
@ -93,10 +93,10 @@ def test_verify_signature_nested():
|
||||
'b': 'B',
|
||||
},
|
||||
}
|
||||
data['message_signature'] = meter.compute_signature(
|
||||
data['message_signature'] = rpc.compute_signature(
|
||||
data,
|
||||
'not-so-secret')
|
||||
assert meter.verify_signature(data, 'not-so-secret')
|
||||
assert rpc.verify_signature(data, 'not-so-secret')
|
||||
|
||||
|
||||
def test_verify_signature_nested_json():
|
||||
@ -108,11 +108,11 @@ def test_verify_signature_nested_json():
|
||||
'd': ['d']
|
||||
},
|
||||
}
|
||||
data['message_signature'] = meter.compute_signature(
|
||||
data['message_signature'] = rpc.compute_signature(
|
||||
data,
|
||||
'not-so-secret')
|
||||
jsondata = jsonutils.loads(jsonutils.dumps(data))
|
||||
assert meter.verify_signature(jsondata, 'not-so-secret')
|
||||
assert rpc.verify_signature(jsondata, 'not-so-secret')
|
||||
|
||||
|
||||
TEST_COUNTER = counter.Counter(name='name',
|
||||
@ -165,7 +165,7 @@ TEST_NOTICE = {
|
||||
|
||||
|
||||
def test_meter_message_from_counter_signed():
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
TEST_COUNTER,
|
||||
'not-so-secret',
|
||||
'src')
|
||||
@ -175,7 +175,7 @@ def test_meter_message_from_counter_signed():
|
||||
def test_meter_message_from_counter_field():
|
||||
def compare(f, c, msg_f, msg):
|
||||
assert msg == c
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
TEST_COUNTER, 'not-so-secret',
|
||||
'src')
|
||||
name_map = {'name': 'counter_name',
|
||||
@ -254,8 +254,8 @@ class TestPublish(base.TestCase):
|
||||
def setUp(self):
|
||||
super(TestPublish, self).setUp()
|
||||
self.published = []
|
||||
self.stubs.Set(rpc, 'cast', self.faux_cast)
|
||||
publisher = meter.MeterPublisher(None)
|
||||
self.stubs.Set(oslo_rpc, 'cast', self.faux_cast)
|
||||
publisher = rpc.RPCPublisher(None)
|
||||
publisher.publish_counters(None,
|
||||
self.test_data,
|
||||
'test')
|
||||
@ -265,7 +265,7 @@ class TestPublish(base.TestCase):
|
||||
for topic, rpc_call in self.published:
|
||||
meters = rpc_call['args']['data']
|
||||
self.assertIsInstance(meters, list)
|
||||
if topic != cfg.CONF.publisher_meter.metering_topic:
|
||||
if topic != cfg.CONF.publisher_rpc.metering_topic:
|
||||
self.assertEqual(len(set(meter['counter_name']
|
||||
for meter in meters)),
|
||||
1,
|
||||
@ -273,10 +273,10 @@ class TestPublish(base.TestCase):
|
||||
|
||||
def test_published_topics(self):
|
||||
topics = [topic for topic, meter in self.published]
|
||||
self.assertIn(cfg.CONF.publisher_meter.metering_topic, topics)
|
||||
self.assertIn(cfg.CONF.publisher_rpc.metering_topic, topics)
|
||||
self.assertIn(
|
||||
cfg.CONF.publisher_meter.metering_topic + '.' + 'test', topics)
|
||||
cfg.CONF.publisher_rpc.metering_topic + '.' + 'test', topics)
|
||||
self.assertIn(
|
||||
cfg.CONF.publisher_meter.metering_topic + '.' + 'test2', topics)
|
||||
cfg.CONF.publisher_rpc.metering_topic + '.' + 'test2', topics)
|
||||
self.assertIn(
|
||||
cfg.CONF.publisher_meter.metering_topic + '.' + 'test3', topics)
|
||||
cfg.CONF.publisher_rpc.metering_topic + '.' + 'test3', topics)
|
@ -25,7 +25,7 @@ import datetime
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
from ceilometer import storage
|
||||
from ceilometer.tests import db as test_db
|
||||
@ -55,9 +55,9 @@ class DBTestBase(test_db.TestBase):
|
||||
'tag': 'self.counter',
|
||||
}
|
||||
)
|
||||
self.msg1 = meter.meter_message_from_counter(
|
||||
self.msg1 = rpc.meter_message_from_counter(
|
||||
self.counter,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test-1',
|
||||
)
|
||||
self.conn.record_metering_data(self.msg1)
|
||||
@ -76,9 +76,9 @@ class DBTestBase(test_db.TestBase):
|
||||
'tag': 'self.counter2',
|
||||
}
|
||||
)
|
||||
self.msg2 = meter.meter_message_from_counter(
|
||||
self.msg2 = rpc.meter_message_from_counter(
|
||||
self.counter2,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test-2',
|
||||
)
|
||||
self.conn.record_metering_data(self.msg2)
|
||||
@ -97,9 +97,9 @@ class DBTestBase(test_db.TestBase):
|
||||
'tag': 'self.counter3',
|
||||
}
|
||||
)
|
||||
self.msg3 = meter.meter_message_from_counter(
|
||||
self.msg3 = rpc.meter_message_from_counter(
|
||||
self.counter3,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test-3',
|
||||
)
|
||||
self.conn.record_metering_data(self.msg3)
|
||||
@ -118,9 +118,9 @@ class DBTestBase(test_db.TestBase):
|
||||
resource_metadata={'display_name': 'test-server',
|
||||
'tag': 'counter-%s' % i},
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -391,7 +391,7 @@ class StatisticsTest(DBTestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
secret='not-so-secret',
|
||||
source='test',
|
||||
@ -412,7 +412,7 @@ class StatisticsTest(DBTestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
secret='not-so-secret',
|
||||
source='test',
|
||||
@ -554,9 +554,9 @@ class CounterDataTypeTest(DBTestBase):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||
resource_metadata={}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test-1',
|
||||
)
|
||||
|
||||
@ -573,9 +573,9 @@ class CounterDataTypeTest(DBTestBase):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||
resource_metadata={}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test-1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
@ -591,9 +591,9 @@ class CounterDataTypeTest(DBTestBase):
|
||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||
resource_metadata={}
|
||||
)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'test-1',
|
||||
)
|
||||
self.conn.record_metering_data(msg)
|
||||
|
@ -51,7 +51,7 @@ import datetime
|
||||
|
||||
from tests.storage import base
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
from ceilometer.storage.impl_mongodb import require_map_reduce
|
||||
|
||||
@ -162,7 +162,7 @@ class CompatibilityTest(MongoDBEngineTestBase):
|
||||
}
|
||||
)
|
||||
self.counters.append(c)
|
||||
msg = meter.meter_message_from_counter(
|
||||
msg = rpc.meter_message_from_counter(
|
||||
c,
|
||||
secret='not-so-secret',
|
||||
source='test')
|
||||
|
@ -27,7 +27,7 @@ import sys
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ceilometer.publisher import meter
|
||||
from ceilometer.publisher import rpc
|
||||
from ceilometer import counter
|
||||
from ceilometer import storage
|
||||
from ceilometer.openstack.common import timeutils
|
||||
@ -129,9 +129,9 @@ def main():
|
||||
timestamp=timestamp,
|
||||
resource_metadata={},
|
||||
)
|
||||
data = meter.meter_message_from_counter(
|
||||
data = rpc.meter_message_from_counter(
|
||||
c,
|
||||
cfg.CONF.publisher_meter.metering_secret,
|
||||
cfg.CONF.publisher_rpc.metering_secret,
|
||||
'artificial')
|
||||
conn.record_metering_data(data)
|
||||
n += 1
|
||||
|
Loading…
Reference in New Issue
Block a user