<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 19, 2013 at 1:11 PM, Kyle Mestery (kmestery) <span dir="ltr"><<a href="mailto:kmestery@cisco.com" target="_blank">kmestery@cisco.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On Jul 19, 2013, at 1:58 PM, Aaron Rosen <<a href="mailto:arosen@nicira.com" target="_blank">arosen@nicira.com</a>> wrote:<br>


><br>
><br>
><br>
><br>
> On Fri, Jul 19, 2013 at 8:47 AM, Kyle Mestery (kmestery) <<a href="mailto:kmestery@cisco.com" target="_blank">kmestery@cisco.com</a>> wrote:<br>
> On Jul 18, 2013, at 5:16 PM, Aaron Rosen <<a href="mailto:arosen@nicira.com" target="_blank">arosen@nicira.com</a>> wrote:<br>
> ><br>
> > Hi,<br>
> ><br>
> > I wanted to raise another design failure of why creating the port on nova-compute is bad. Previously, we have encountered this bug (<a href="https://bugs.launchpad.net/neutron/+bug/1160442" target="_blank">https://bugs.launchpad.net/neutron/+bug/1160442</a>). What was causing the issue was that when nova-compute calls into quantum to create the port; quantum creates the port but fails to return the port to nova and instead timesout. When this happens the instance is scheduled to be run on another compute node where another port is created with the same device_id and when the instance boots it will look like it has two ports. This is still a problem that can occur today in our current implementation (!).<br>


> ><br>
> > I think in order to move forward with this we'll need to compromise. Here is my though on how we should proceed.<br>
> ><br>
> > 1) Modify the quantum API so that mac addresses can now be updated via the api. There is no reason why we have this limitation (especially once the patch that uses dhcp_release is merged as it will allow us to update the lease for the new mac immediately).  We need to do this in order for bare metal support as we need to match the mac address of the port to the compute node.<br>


> ><br>
> I don't understand how this relates to creating a port through nova-compute. I'm not saying this is a bad idea, I just don't see how it relates to the original discussion point on this thread around Yong's patch.<br>


><br>
> > 2) move the port-creation from nova-compute to nova-api. This will solve a number of issues like the one i pointed out above.<br>
> ><br>
> This seems like a bad idea. So now a Nova API call will implicitly create a Neutron port? What happens on failure here? The caller isn't aware the port was created in Neutron if it's implicit, so who cleans things up? Or if the caller is aware, than all we've done is move an API the caller would have done (nova-compute in this case) into nova-api, though the caller is now still aware of what's happening.<br>


><br>
> On failure here the VM will go to ERROR state if the port is failed to create in quantum. Then when deleting the instance; the delete code should also search quantum for the device_id in order to remove the port there as well.<br>


><br>
</div>So, nova-compute will implicitly know the port was created by nova-api, and if a failure happens, it will clean up the port? That doesn't sound like a balanced solution to me, and seems to tie nova-compute and nova-api close together when it comes to launching VMs with Neutron ports.<br>


<div><br>
>  The issue here is that if an instance fails to boot on a compute node (because nova-compute did not get the port-create response from quantum and the port was actually created) the instance gets scheduled to be booted on another nova-compute node where the duplicate create happens. Moving the creation to the API node removes the port from getting created in the retry logic that solves this.<br>


><br>
</div>I think Ian's comments on your blueprint [1] address this exact problem, can you take a look at them there?<br>
<br>
[1] <a href="https://blueprints.launchpad.net/nova/+spec/nova-api-quantum-create-port" target="_blank">https://blueprints.launchpad.net/nova/+spec/nova-api-quantum-create-port</a></blockquote><div><br></div><div style>Sure from Ian: comments inline with [arosen] : </div>
<div><br></div><div> The issue is not the location of the call.<br></div>
<p id="yui_3_10_2_1_1374270236340_1242">The issue is one of 
transactionality - you want to create a neutron port implicitly while 
nova booting a machine, and you want all the Neutron and Nova calls to 
both succeed or both fail.  If you can't have transactionality the old 
fashioned way with synchronous calls (and we can't) then you need 
eventual consistency: a task to clean up dead ports and the 
understanding that such ports may still be kicking around from previous 
attempts.</p><p id="yui_3_10_2_1_1374270236340_1242" style>[arosen] - I agree.</p>
<p id="yui_3_10_2_1_1374270236340_1243">We should create the port, 
*then* attempt the attach using update - the create can succeed 
independently and any subsequent nova-compute attach will succeed on the
 previously created port rather than making a new one (possibly 
verifying that its 'attached' status, if the second call completed but 
didn't return, is a lie).</p>
<p>So:<br>
create fails to return but port is created<br>
-> run on 2nd compute node won't attempt the create, port already exists; port consumed, everything good</p>
<p id="yui_3_10_2_1_1374270236340_1232">create returns, attach fails to return but port is attached<br>
-> run on 2nd compute node won't attempt the create and will identify
 that the attachment state is bogus and overwrite it; port consumed, 
everything good<br>
-> if last attempt, a port with a bogus attach is left hanging around
 in the DB; a cleanup job has to go looking for it and remove it; 
optionally anything else can spot its inconsistency and ignore or remove
 it.  Risk of removal during the actual scheduling, in which case the 
schedule pass will fail; can set expiry time on port.</p><p id="yui_3_10_2_1_1374270236340_1232" style>[arosen] - sure, in this case though then we'll have to add even more queries between nova-compute and quantum as nova-compute will need to query quantum for ports matching the device_id to see if the port was already created and if not try to create them. </p>

<p>create succeeds, attach fails and we get to see that it's failed<br>
-> clean up port</p>
<p id="yui_3_10_2_1_1374270236340_1235">Moving the create may for other 
reasons be a good idea (because compute would *always* deal with ports 
and *never* with networks - a simpler API) - but it's nothing to do with
 solving this problem.</p><p id="yui_3_10_2_1_1374270236340_1235">[arosen] - It does solve this issue because it moves the quantum port-create calls outside of the retry schedule logic on that compute node. Therefore if the port fails to create the instance goes to error state.  Moving networks out of the nova-api will also solve this issue for us as the client then won't rely on nova anymore to create the port. I'm wondering if creating an additional network_api_class like nova.network.quantumv2.api.NoComputeAPI is the way to prove this out. Most of the code in there would inherit from nova.network.quantumv2.api.API . </p>
<p id="yui_3_10_2_1_1374270236340_1235">
 -- ijw</p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
<div><br>
> > 3)  For now, i'm okay with leaving logic on the compute node that calls update-port if the port binding extension is loaded. This will allow the vif type to be correctly set as well.<br>
> ><br>
> And this will also still pass in the hostname the VM was booted on?<br>
><br>
> In this case there would have to be an update-port call done on the compute node which would set the hostname (which is the same case as live migration).<br>
><br>
</div>Just to be sure I understand, nova-compute will do this or this will be the responsibility of some neutron agent?<br>
<br></blockquote><div>Nova-compute,  though I'd still argue that's in the wrong place. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Thanks,<br>
Kyle<br>
<div><div><br>
> To me, this thread seems to have diverged a bit from the original discussion point around Yong's patch. Yong's patch makes sense, because it's passing the hostname the VM is booted on during port create. It also updates the binding during a live migration, so that case is covered. Any change to this behavior should cover both those cases and not involve any sort of agent polling, IMHO.<br>


><br>
> Thanks,<br>
> Kyle<br>
><br>
> > Thoughts/Comments?<br>
> ><br>
> > Thanks,<br>
> ><br>
> > Aaron<br>
> ><br>
> ><br>
> > On Mon, Jul 15, 2013 at 2:45 PM, Aaron Rosen <<a href="mailto:arosen@nicira.com" target="_blank">arosen@nicira.com</a>> wrote:<br>
> ><br>
> ><br>
> ><br>
> > On Mon, Jul 15, 2013 at 1:26 PM, Robert Kukura <<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a>> wrote:<br>
> > On 07/15/2013 03:54 PM, Aaron Rosen wrote:<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Sun, Jul 14, 2013 at 6:48 PM, Robert Kukura <<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a><br>
> > > <mailto:<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a>>> wrote:<br>
> > ><br>
> > >     On 07/12/2013 04:17 PM, Aaron Rosen wrote:<br>
> > >     > Hi,<br>
> > >     ><br>
> > >     ><br>
> > >     > On Fri, Jul 12, 2013 at 6:47 AM, Robert Kukura <<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a><br>
> > >     <mailto:<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a>><br>
> > >     > <mailto:<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a> <mailto:<a href="mailto:rkukura@redhat.com" target="_blank">rkukura@redhat.com</a>>>> wrote:<br>
> > >     ><br>
> > >     >     On 07/11/2013 04:30 PM, Aaron Rosen wrote:<br>
> > >     >     > Hi,<br>
> > >     >     ><br>
> > >     >     > I think we should revert this patch that was added here<br>
> > >     >     > (<a href="https://review.openstack.org/#/c/29767/" target="_blank">https://review.openstack.org/#/c/29767/</a>). What this patch<br>
> > >     does is<br>
> > >     >     when<br>
> > >     >     > nova-compute calls into quantum to create the port it passes<br>
> > >     in the<br>
> > >     >     > hostname on which the instance was booted on. The idea of the<br>
> > >     >     patch was<br>
> > >     >     > that providing this information would "allow hardware device<br>
> > >     vendors<br>
> > >     >     > management stations to allow them to segment the network in<br>
> > >     a more<br>
> > >     >     > precise manager (for example automatically trunk the vlan on the<br>
> > >     >     > physical switch port connected to the compute node on which<br>
> > >     the vm<br>
> > >     >     > instance was started)."<br>
> > >     >     ><br>
> > >     >     > In my opinion I don't think this is the right approach.<br>
> > >     There are<br>
> > >     >     > several other ways to get this information of where a<br>
> > >     specific port<br>
> > >     >     > lives. For example, in the OVS plugin case the agent running<br>
> > >     on the<br>
> > >     >     > nova-compute node can update the port in quantum to provide this<br>
> > >     >     > information. Alternatively, quantum could query nova using the<br>
> > >     >     > port.device_id to determine which server the instance is on.<br>
> > >     >     ><br>
> > >     >     > My motivation for removing this code is I now have the free<br>
> > >     cycles to<br>
> > >     >     > work on<br>
> > >     >     ><br>
> > >     ><br>
> > >     <a href="https://blueprints.launchpad.net/nova/+spec/nova-api-quantum-create-port" target="_blank">https://blueprints.launchpad.net/nova/+spec/nova-api-quantum-create-port</a><br>
> > >     >     >  discussed here<br>
> > >     >     ><br>
> > >     ><br>
> > >     (<a href="http://lists.openstack.org/pipermail/openstack-dev/2013-May/009088.html" target="_blank">http://lists.openstack.org/pipermail/openstack-dev/2013-May/009088.html</a>)<br>
> > >     >      .<br>
> > >     >     > This was about moving the quantum port creation from the<br>
> > >     nova-compute<br>
> > >     >     > host to nova-api if a network-uuid is passed in. This will<br>
> > >     allow us to<br>
> > >     >     > remove all the quantum logic from the nova-compute nodes and<br>
> > >     >     > simplify orchestration.<br>
> > >     >     ><br>
> > >     >     > Thoughts?<br>
> > >     ><br>
> > >     >     Aaron,<br>
> > >     ><br>
> > >     >     The ml2-portbinding BP I am currently working on depends on<br>
> > >     nova setting<br>
> > >     >     the binding:host_id attribute on a port before accessing<br>
> > >     >     binding:vif_type. The ml2 plugin's MechanismDrivers will use the<br>
> > >     >     binding:host_id with the agents_db info to see what (if any)<br>
> > >     L2 agent is<br>
> > >     >     running on that host, or what other networking mechanisms<br>
> > >     might provide<br>
> > >     >     connectivity for that host. Based on this, the port's<br>
> > >     binding:vif_type<br>
> > >     >     will be set to the appropriate type for that agent/mechanism.<br>
> > >     ><br>
> > >     >     When an L2 agent is involved, the associated ml2<br>
> > >     MechanismDriver will<br>
> > >     >     use the agent's interface or bridge mapping info to determine<br>
> > >     whether<br>
> > >     >     the agent on that host can connect to any of the port's network's<br>
> > >     >     segments, and select the specific segment (network_type,<br>
> > >     >     physical_network, segmentation_id) to be used. If there is no<br>
> > >     >     connectivity possible on the host (due to either no L2 agent<br>
> > >     or other<br>
> > >     >     applicable mechanism, or no mapping for any of the network's<br>
> > >     segment's<br>
> > >     >     physical_networks), the ml2 plugin will set the binding:vif_type<br>
> > >     >     attribute to BINDING_FAILED. Nova will then be able to<br>
> > >     gracefully put<br>
> > >     >     the instance into an error state rather than have the instance<br>
> > >     boot<br>
> > >     >     without the required connectivity.<br>
> > >     ><br>
> > >     >     I don't see any problem with nova creating the port before<br>
> > >     scheduling it<br>
> > >     >     to a specific host, but the binding:host_id needs to be set<br>
> > >     before the<br>
> > >     >     binding:vif_type attribute is accessed. Note that the host<br>
> > >     needs to be<br>
> > >     >     determined before the vif_type can be determined, so it is not<br>
> > >     possible<br>
> > >     >     to rely on the agent discovering the VIF, which can't be<br>
> > >     created until<br>
> > >     >     the vif_type is determined.<br>
> > >     ><br>
> > >     ><br>
> > >     > So what your saying is the current workflow is this: nova-compute<br>
> > >     > creates a port in quantum passing in the host-id (which is the<br>
> > >     hostname<br>
> > >     > of the compute host). Now quantum looks in the agent table in it's<br>
> > >     > database to determine the VIF type that should be used based on the<br>
> > >     > agent that is running on the nova-compute node?<br>
> > ><br>
> > >     Most plugins just return a hard-wired value for binding:vif_type. The<br>
> > >     ml2 plugin supports heterogeneous deployments, and therefore needs more<br>
> > >     flexibility, so this is whats being implemented in the agent-based ml2<br>
> > >     mechanism drivers. Other mechanism drivers (i.e. controller-based) would<br>
> > >     work differently. In addition to VIF type selection, port binding in ml2<br>
> > >     also involves determining if connectivity is possible, and selecting the<br>
> > >     network segment to use, and these are also based on binding:host_id.<br>
> > ><br>
> > ><br>
> > > Can you go into more details about what you mean by heterogeneous<br>
> > > deployments (i.e what the topology looks like)? Why would connectivity<br>
> > > not be possible? I'm confused why things would be configured in such a<br>
> > > way where the scheduler wants to launch an instance on a node where<br>
> > > quantum is not able to provide connectivity for.<br>
> ><br>
> > By heterogeneous deployment, I meant that all compute nodes are not<br>
> > necessarily identically configured. Some might be running the<br>
> > openvswitch agent, some the linuxbridge agent, and some the hyperv<br>
> > agent, but all able to access VLANs on (some of) the same trunks.<br>
> ><br>
> > One example of connectivity not being possible would be if multiple VLAN<br>
> > trunks are in use in the datacenter, but not all compute nodes have<br>
> > connections to every trunk.<br>
> ><br>
> > I agree the scheduler should ensure connectivity will be possible. But<br>
> > mechanisms such as cells, zones, and flavors can also be used in nova to<br>
> > manage heterogeneity. The ml2 port binding code should ideally never<br>
> > find out the scheduled node does not have connectivity, but we've at<br>
> > least defined what should happen if it does. The main need here though<br>
> > is for the port binding code to select the segment to use.<br>
> ><br>
> > Why does the port binding code select which segment to use? I'm unclear why anyone would ever have a deployment with a mix of vlans where things are trunked in some places and not in others and neutron would have to keep up with that. The part i'm unclear on is how neutron would be expected to behave in this type of setup. Say one boots several instances: instance1 lands on compute1 and neutron puts it on vlan X. Later instance 2 is booted and it lands on compute2 on this node vlan X isn't reachable?<br>


> ><br>
> ><br>
> ><br>
> > ><br>
> > ><br>
> > ><br>
> > >     >                                                  My question would<br>
> > >     be why<br>
> > >     > the nova-compute node doesn't already know which VIF_TYPE it should be<br>
> > >     > using?<br>
> > ><br>
> > >     I guess the thinking was that this knowledge belonged in quantum rather<br>
> > >     than nova, and thus the GenericVifDriver was introduced in grizzly. See<br>
> > >     <a href="https://blueprints.launchpad.net/nova/+spec/libvirt-vif-driver" target="_blank">https://blueprints.launchpad.net/nova/+spec/libvirt-vif-driver</a> and<br>
> > >     <a href="https://blueprints.launchpad.net/neutron/+spec/" target="_blank">https://blueprints.launchpad.net/neutron/+spec/</a>.<br>
> > >     vif-plugging-improvements<br>
> > >     <<a href="https://blueprints.launchpad.net/neutron/+spec/vif-plugging-improvements" target="_blank">https://blueprints.launchpad.net/neutron/+spec/vif-plugging-improvements</a>>.<br>
> > ><br>
> > ><br>
> > > Thanks for the links. It seems like the the motivation for this was to<br>
> > > remove the libvirt vif configuration settings from nova and off load<br>
> > > that to quantum via the vif_type param on a port. It seems like when<br>
> > > using a specific plugin that plugin will always returns the same<br>
> > > vif_type to a given node. This configuration option in my opinion looks<br>
> > > best to be handled as part of your deployment automation instead and not<br>
> > > baked into quantum ports.<br>
> ><br>
> > For monolithic plugins, returning a fixed vif_type works, but this is<br>
> > not sufficient for ml2.<br>
> ><br>
> > I was happy with the old approach of configuring drivers in nova (via<br>
> > deployment automation ideally), but the decision was made in grizzly to<br>
> > switch to the GenericVifDriver.<br>
> ><br>
> > ><br>
> > > My goal is to reduce the orchestration and complexity between nova and<br>
> > > quantum. Currently, nova-api and nova-compute both call out to quantum<br>
> > > when all of this could be done on the api node (ignoring bare metal for<br>
> > > now as in this case we'd need to do something special to handle updating<br>
> > > the mac addresses on those logical ports in quantum).<br>
> ><br>
> > Sounds like the scheduler is going to need to call neutron as well, at<br>
> > least in some cases.<br>
> ><br>
> > Why is this? The only use case I see so far for something other than nova-api to call into neutron would be bare metal. I think having neutron telling nova which vif type it should be using is really tightly coupling nova+quantum integration. I think we should probably reexamine <a href="https://blueprints.launchpad.net/nova/+spec/libvirt-vif-driver" target="_blank">https://blueprints.launchpad.net/nova/+spec/libvirt-vif-driver</a> as setting the libvirt_type from the neutron side seems to be something that the sysadmin should configure once and not have to rely on neutron to specify.<br>


> ><br>
> > Thanks,<br>
> ><br>
> > Aaron<br>
> ><br>
> > -Bob<br>
> ><br>
> > ><br>
> > ><br>
> > >     -Bob<br>
> > ><br>
> > >     ><br>
> > >     ><br>
> > >     >     Back when the port binding extension was originally being<br>
> > >     hashed out, I<br>
> > >     >     had suggested using an explicit bind() operation on port that<br>
> > >     took the<br>
> > >     >     host_id as a parameter and returned the vif_type as a result.<br>
> > >     But the<br>
> > >     >     current attribute-based approach was chosen instead. We could<br>
> > >     consider<br>
> > >     >     adding a bind() operation for the next neutron API revision,<br>
> > >     but I don't<br>
> > >     >     see any reason the current attribute-based binding approach<br>
> > >     cannot work<br>
> > >     >     for now.<br>
> > >     ><br>
> > >     >     -Bob<br>
> > >     ><br>
> > >     >     ><br>
> > >     >     > Best,<br>
> > >     >     ><br>
> > >     >     > Aaron<br>
> > >     >     ><br>
> > >     >     ><br>
> > >     >     > _______________________________________________<br>
> > >     >     > OpenStack-dev mailing list<br>
> > >     >     > <a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
> > >     <mailto:<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a>><br>
> > >     >     <mailto:<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
> > >     <mailto:<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a>>><br>
> > >     >     ><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>
> > >     ><br>
> > >     ><br>
> > >     ><br>
> > >     ><br>
> > >     > _______________________________________________<br>
> > >     > OpenStack-dev mailing list<br>
> > >     > <a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
> > >     <mailto:<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>
> > ><br>
> > ><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<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>
><br>
><br>
> _______________________________________________<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>
> _______________________________________________<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>
<br>
<br>
_______________________________________________<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>
</div></div></blockquote></div><br></div></div>