Build ceilometer-agent and ceilometer-collector

Change-Id: I0cc5b163ac638f33397e7e7a9c046dca3e2939e9
Signed-off-by: Julien Danjou <julien.danjou@enovance.com>
This commit is contained in:
Julien Danjou 2012-05-15 12:36:47 +02:00
parent 73c9150afe
commit 5717e9c5c9
7 changed files with 62 additions and 6 deletions

View File

@ -32,8 +32,8 @@ if __name__ == '__main__':
flags.FLAGS(sys.argv)
logging.setup()
utils.monkey_patch()
server = service.Service.create(binary='ceilometer-nova-compute',
server = service.Service.create(binary='ceilometer-agent',
topic='ceilometer',
manager='ceilometer.nova.manager.ComputeManager')
manager='ceilometer.agent.manager.AgentManager')
service.serve(server)
service.wait()

View File

@ -32,7 +32,7 @@ if __name__ == '__main__':
flags.FLAGS(sys.argv)
logging.setup()
utils.monkey_patch()
server = service.Service.create(binary='ceilometer-nova-instance',
server = service.Service.create(binary='ceilometer-collector',
topic='ceilometer',
manager='ceilometer.collector.manager.CollectorManager')
service.serve(server)

View File

@ -30,8 +30,9 @@ FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.' + __name__)
class ComputeManager(manager.Manager):
def _get_disks(self, conn, instance):
class AgentManager(manager.Manager):
@staticmethod
def _get_disks(conn, instance):
"""Get disks of an instance, only used to bypass bug#998089."""
domain = conn._conn.lookupByName(instance)
tree = etree.fromstring(domain.XMLDesc(0))

View File

@ -29,7 +29,7 @@ setuptools.setup(
packages=setuptools.find_packages(exclude=['bin']),
include_package_data=True,
test_suite='nose.collector',
scripts=['bin/ceilometer-nova-compute'],
scripts=['bin/ceilometer-agent', 'bin/ceilometer-collector'],
py_modules=[],
entry_points={
'ceilometer.collector.compute': [

0
tests/agent/__init__.py Normal file
View File

View File

@ -0,0 +1,55 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <licensing@enovance.com>
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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.
"""Tests for manager.
"""
# import unittest
# import mox
# import stubout
# import nova.tests.fakelibvirt as libvirt
from nova import context
from nova import flags
from nova import test
from nova import db
from nova import test
from ceilometer.agent import manager
class TestAgentManager(test.TestCase):
def setUp(self):
self.context = context.RequestContext('admin', 'admin', is_admin=True)
self.manager = manager.AgentManager()
super(TestAgentManager, self).setUp()
def test_fetch_diskio(self):
self.manager._fetch_diskio(self.context)
def test_fetch_diskio_with_libvirt_non_existent_instance(self):
flags.FLAGS.connection_type = 'libvirt'
instance = db.instance_create(self.context, {})
self.mox.StubOutWithMock(self.manager.db, 'instance_get_all_by_host')
self.manager.db.instance_get_all_by_host(self.context, self.manager.host).AndReturn([instance])
self.mox.ReplayAll()
self.manager._fetch_diskio(self.context)