Merge "Ensure ovsdb_connection enabled before calling monitor"
This commit is contained in:
commit
877d08b3fe
@ -18,6 +18,7 @@ from oslo_serialization import jsonutils
|
||||
from neutron._i18n import _LE
|
||||
from neutron.agent.linux import async_process
|
||||
from neutron.agent.ovsdb import api as ovsdb
|
||||
from neutron.agent.ovsdb.native import helpers
|
||||
from neutron.common import utils
|
||||
|
||||
|
||||
@ -37,6 +38,7 @@ class OvsdbMonitor(async_process.AsyncProcess):
|
||||
if ovsdb_connection:
|
||||
# if ovsdb connection is configured (e.g. tcp:ip:port), use it,
|
||||
# and there is no need to run as root
|
||||
helpers.enable_connection_uri(ovsdb_connection)
|
||||
cmd = ['ovsdb-client', 'monitor', ovsdb_connection, table_name]
|
||||
run_as_root = False
|
||||
else:
|
||||
|
@ -16,11 +16,16 @@ import mock
|
||||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux import ovsdb_monitor
|
||||
from neutron.agent.ovsdb.native import helpers
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
class TestOvsdbMonitor(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestOvsdbMonitor, self).setUp()
|
||||
mock.patch.object(helpers, 'enable_connection_uri').start()
|
||||
|
||||
def test___init__(self):
|
||||
ovsdb_monitor.OvsdbMonitor('Interface')
|
||||
|
||||
|
@ -16,11 +16,16 @@ import mock
|
||||
|
||||
from neutron.agent.common import base_polling
|
||||
from neutron.agent.linux import polling
|
||||
from neutron.agent.ovsdb.native import helpers
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
class TestGetPollingManager(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestGetPollingManager, self).setUp()
|
||||
mock.patch.object(helpers, 'enable_connection_uri').start()
|
||||
|
||||
def test_return_always_poll_by_default(self):
|
||||
with polling.get_polling_manager() as pm:
|
||||
self.assertEqual(pm.__class__, base_polling.AlwaysPoll)
|
||||
@ -40,6 +45,7 @@ class TestInterfacePollingMinimizer(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestInterfacePollingMinimizer, self).setUp()
|
||||
mock.patch.object(helpers, 'enable_connection_uri').start()
|
||||
self.pm = polling.InterfacePollingMinimizer()
|
||||
|
||||
def test_start_calls_monitor_start(self):
|
||||
|
@ -113,6 +113,8 @@ class TestOvsNeutronAgent(object):
|
||||
cfg.CONF.set_default('quitting_rpc_timeout', 10, 'AGENT')
|
||||
cfg.CONF.set_default('prevent_arp_spoofing', False, 'AGENT')
|
||||
cfg.CONF.set_default('local_ip', '127.0.0.1', 'OVS')
|
||||
mock.patch(
|
||||
'neutron.agent.ovsdb.native.helpers.enable_connection_uri').start()
|
||||
mock.patch(
|
||||
'neutron.agent.common.ovs_lib.OVSBridge.get_ports_attributes',
|
||||
return_value=[]).start()
|
||||
|
Loading…
Reference in New Issue
Block a user