<div dir="ltr">Hi Andre,<div><br></div><div style>Thans for your reply.</div><div style><br></div><div style>There is no existing network. The scenario is for the first time that we create a network with an extension. Consider, a mechanism driver adds an attribute (through extensions) to the network resource. When user creates a network, the attribute is set and it is present in the 'network' parameter, when calling create_network() in Ml2Plugin.</div>
<div style>But when create_network_pre/post_commit is called, the attribute won't be available to the mechanism driver. Because the attribute is not included in network object passed to MD - as I mentioned in previous email, the 'result' does not have the new attribute.</div>
<div style><br></div><div style><br></div><div style>Thanks,</div><div style>Nader.</div><div style><br></div><div style> </div><div style><br></div><div style><br></div><div style><br></div><div style><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Mar 26, 2014 at 3:52 PM, Andre Pech <span dir="ltr"><<a href="mailto:apech@aristanetworks.com" target="_blank">apech@aristanetworks.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Nader,<div><br></div><div>When I wrote this, the intention was that original_network only really makes sense during an update_network call (ie when there's an existing network that you are modifying). In a create_network call, the assumption is that no network exists yet, so there is no "original network" to set.</div>
<div><br></div><div>Can you provide a bit more detail on the case where there's an existing network when create_network is called? Sorry, I didn't totally follow when this would happen.</div><div><br></div><div>Thanks</div>
<div>Andre</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Mar 25, 2014 at 8:45 AM, Nader Lahouti <span dir="ltr"><<a href="mailto:nader.lahouti@gmail.com" target="_blank">nader.lahouti@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi All,<div><br></div><div><p style="margin:0px;font-size:12px;font-family:Helvetica">
In the current Ml2Plugin code when 'create_network' is called, as shown below: </p>
<p style="margin:0px;font-size:12px;font-family:Courier;min-height:14px"><br></p>
<p style="margin:0px;font-size:12px;font-family:Courier;min-height:14px"><br></p>
<p style="margin:0px;font-size:12px;font-family:Courier"> def create_network(self, context, network)</p>
<p style="margin:0px;font-size:12px;font-family:Courier"> net_data = network['network']</p>
<p style="margin:0px;font-size:12px;font-family:Courier">...</p><p style="margin:0px;font-size:12px;font-family:Courier"> session = context.session<br></p><p style="margin:0px;font-size:12px;font-family:Courier;min-height:14px">
</p><p style="margin:0px;min-height:14px"> with session.begin(subtransactions=True):</p><p style="margin:0px;min-height:14px"> self._ensure_default_security_group(context, tenant_id)</p><p style="margin:0px;min-height:14px">
result = super(Ml2Plugin, self).create_network(context, network)</p><div>...</div><div><br></div><p></p>
<p style="margin:0px;font-size:12px;font-family:Courier"> mech_context = driver_context.NetworkContext(self, context, result)</p>
<p style="margin:0px;font-size:12px;font-family:Courier"> self.mechanism_manager.create_network_precommit(mech_context)</p>
<p style="margin:0px;font-size:12px;font-family:Courier">...</p><p style="margin:0px;font-size:12px;font-family:Courier"><br></p>
<p style="margin:0px;font-size:12px;font-family:Courier;min-height:14px"><br></p>
<p style="margin:0px;font-size:12px;font-family:Helvetica">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 <span style="font-family:Courier">super(Ml2Plugin, self).create_network().</span></p>
<p style="margin:0px;font-size:12px;font-family:Helvetica">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.</p>
<p style="margin:0px;font-size:12px;font-family:Helvetica">(The 'result' only has the network attributes without extension which is used to set the '_network' in the NetwrokContext object). </p><p style="margin:0px;font-size:12px;font-family:Helvetica">
Even using extension function registration using </p>
<p style="margin:0px;font-size:12px;font-family:Helvetica">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.</p>
<p style="margin:0px;font-size:12px;font-family:Helvetica"><br></p>
<p style="margin:0px;font-size:12px;font-family:Helvetica">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?</p>
<p style="margin:0px;font-size:12px;font-family:Helvetica"><br></p><p style="margin:0px;font-size:12px;font-family:Helvetica">Appreciate your comments.</p><p style="margin:0px;font-size:12px;font-family:Helvetica"><br></p>
<p style="margin:0px;font-size:12px;font-family:Helvetica">Thanks,</p><p style="margin:0px;font-size:12px;font-family:Helvetica">Nader.</p><p style="margin:0px;font-size:12px;font-family:Helvetica"><br></p>
<p style="margin:0px;font-size:12px;font-family:Helvetica;min-height:14px"><br></p>
<p style="margin:0px;font-size:12px;font-family:Helvetica;min-height:14px"><br></p></div></div>
<br></div></div>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>