From: Gal Sagie Date: Mon, 6 Apr 2015 13:11:23 +0000 (+0300) Subject: allow OVSDB connection schema to be configurable X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=aa7567e8bb4fef17f6fc1d496ac6b75f10039063;p=openstack-build%2Fneutron-build.git allow OVSDB connection schema to be configurable Add the schema name as a parameter to the OVSDB IDL connection. That way other users can use this with other schemas Change-Id: I55ab5ae4f3f937d236eee773f9717b5090c18557 Closes-Bug: #1441180 --- diff --git a/neutron/agent/ovsdb/impl_idl.py b/neutron/agent/ovsdb/impl_idl.py index dfea54ba2..011db3a91 100644 --- a/neutron/agent/ovsdb/impl_idl.py +++ b/neutron/agent/ovsdb/impl_idl.py @@ -120,7 +120,8 @@ class Transaction(api.Transaction): class OvsdbIdl(api.API): ovsdb_connection = connection.Connection(cfg.CONF.OVS.ovsdb_connection, - cfg.CONF.ovs_vsctl_timeout) + cfg.CONF.ovs_vsctl_timeout, + 'Open_vSwitch') def __init__(self, context): super(OvsdbIdl, self).__init__(context) diff --git a/neutron/agent/ovsdb/native/connection.py b/neutron/agent/ovsdb/native/connection.py index 22b42ff38..ce0d21691 100644 --- a/neutron/agent/ovsdb/native/connection.py +++ b/neutron/agent/ovsdb/native/connection.py @@ -49,19 +49,21 @@ class TransactionQueue(Queue.Queue, object): class Connection(object): - def __init__(self, connection, timeout): + def __init__(self, connection, timeout, schema_name): self.idl = None self.connection = connection self.timeout = timeout self.txns = TransactionQueue(1) self.lock = threading.Lock() + self.schema_name = schema_name def start(self): with self.lock: if self.idl is not None: return - helper = idlutils.get_schema_helper(self.connection) + helper = idlutils.get_schema_helper(self.connection, + self.schema_name) helper.register_all() self.idl = idl.Idl(self.connection, helper) idlutils.wait_for_change(self.idl, self.timeout) diff --git a/neutron/agent/ovsdb/native/idlutils.py b/neutron/agent/ovsdb/native/idlutils.py index bcb237cf1..ba0508eaf 100644 --- a/neutron/agent/ovsdb/native/idlutils.py +++ b/neutron/agent/ovsdb/native/idlutils.py @@ -93,14 +93,14 @@ class ExceptionResult(object): self.tb = tb -def get_schema_helper(connection): +def get_schema_helper(connection, schema_name): err, strm = stream.Stream.open_block( stream.Stream.open(connection)) if err: raise Exception("Could not connect to %s" % ( connection,)) rpc = jsonrpc.Connection(strm) - req = jsonrpc.Message.create_request('get_schema', ['Open_vSwitch']) + req = jsonrpc.Message.create_request('get_schema', [schema_name]) err, resp = rpc.transact_block(req) rpc.close() if err: