Merge "MeteringPluginRpc: Fix crash in periodic_task"
This commit is contained in:
commit
ad017494da
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user