Fix broken L3 support of Ryu plugin

Fixes bug 1047230

This patch adds support for the router:external attribute of a network
to Ryu plugin.

Change-Id: I135fe0a4e90fe049cabbaa1b87e9294ec0613530
This commit is contained in:
Yoshihiro Kaneko 2012-09-08 18:15:04 +09:00
parent 6c98c6f8d1
commit 11fb7b4c91

View File

@ -41,7 +41,7 @@ LOG = logging.getLogger(__name__)
class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2, class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
l3_db.L3_NAT_db_mixin): l3_db.L3_NAT_db_mixin):
supported_extension_aliases = ["os-quantum-router"] supported_extension_aliases = ["router"]
def __init__(self, configfile=None): def __init__(self, configfile=None):
options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
@ -80,14 +80,43 @@ class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
self.client.update_network(net.id) self.client.update_network(net.id)
def create_network(self, context, network): def create_network(self, context, network):
net = super(RyuQuantumPluginV2, self).create_network(context, network) session = context.session
self.client.create_network(net['id']) with session.begin(subtransactions=True):
net = super(RyuQuantumPluginV2, self).create_network(context,
network)
self.client.create_network(net['id'])
self._process_l3_create(context, network['network'], net['id'])
self._extend_network_dict_l3(context, net)
return net
def update_network(self, context, id, network):
session = context.session
with session.begin(subtransactions=True):
net = super(RyuQuantumPluginV2, self).update_network(context, id,
network)
self._process_l3_update(context, network['network'], id)
self._extend_network_dict_l3(context, net)
return net return net
def delete_network(self, context, id): def delete_network(self, context, id):
result = super(RyuQuantumPluginV2, self).delete_network(context, id) session = context.session
self.client.delete_network(id) with session.begin(subtransactions=True):
return result super(RyuQuantumPluginV2, self).delete_network(context, id)
self.client.delete_network(id)
def get_network(self, context, id, fields=None):
net = super(RyuQuantumPluginV2, self).get_network(context, id, None)
self._extend_network_dict_l3(context, net)
return self._fields(net, fields)
def get_networks(self, context, filters=None, fields=None):
nets = super(RyuQuantumPluginV2, self).get_networks(context, filters,
None)
for net in nets:
self._extend_network_dict_l3(context, net)
nets = self._filter_nets_l3(context, nets, filters)
return [self._fields(net, fields) for net in nets]
def delete_port(self, context, id, l3_port_check=True): def delete_port(self, context, id, l3_port_check=True):
# if needed, check to see if this is a port owned by # if needed, check to see if this is a port owned by