Merge "MeteringPluginRpc: Fix crash in periodic_task"

This commit is contained in:
Jenkins 2014-11-28 21:44:33 +00:00 committed by Gerrit Code Review
commit ad017494da
2 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,11 @@ LOG = logging.getLogger(__name__)
class MeteringPluginRpc(object):
def __init__(self, host):
# NOTE(yamamoto): super.__init__() call here is not only for
# aesthetics. Because of multiple inheritances in MeteringAgent,
# it's actually necessary to initialize parent classes of
# manager.Manager correctly.
super(MeteringPluginRpc, self).__init__()
target = messaging.Target(topic=topics.METERING_PLUGIN, version='1.0')
self.client = n_rpc.get_client(target)

View File

@ -158,3 +158,9 @@ class TestMeteringDriver(base.BaseTestCase):
{'driver': self.noop_driver,
'func':
'add_metering_label'})
def test_init_chain(self):
with mock.patch('neutron.openstack.common.'
'periodic_task.PeriodicTasks.__init__') as init:
metering_agent.MeteringAgent('my agent', cfg.CONF)
init.assert_called_once_with()