[openstack-dev] [Neutron][ML2][Ml2Plugin] Setting _original_network in NetworkContext:

Nader Lahouti nader.lahouti at gmail.com
Tue Mar 25 15:45:07 UTC 2014


Hi All,

In the current Ml2Plugin code when 'create_network' is called, as shown
below:



    def create_network(self, context, network)

        net_data = network['network']

...

        session = context.session

        with session.begin(subtransactions=True):

            self._ensure_default_security_group(context, tenant_id)

            result = super(Ml2Plugin, self).create_network(context, network)
...

            mech_context = driver_context.NetworkContext(self, context,
result)

            self.mechanism_manager.create_network_precommit(mech_context)

...



the original_network parameter is not set (the default is None) when
instantiating NetworkContext, and as a result the mech_context has only the
value of network object returned from super(Ml2Plugin,
self).create_network().

This causes issue when a mechanism driver needs to use the original network
parameters (given to the create_network), specially when extension is used
for the network resources.

(The 'result' only has the network attributes without extension which is
used to set the '_network' in the NetwrokContext object).

Even using  extension function registration using

db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(...) won't
help as the network object that is passed to the registered function does
not include the extension parameters.


Is there any reason that the original_network is not set when initializing
the NetworkContext? Would that cause any issue to set it to 'net_data' so
that any mechanism driver can use original network parameters as they are
available when create_network is called?


Appreciate your comments.


Thanks,

Nader.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140325/374fc274/attachment.html>


More information about the OpenStack-dev mailing list