<div dir="ltr">Hi,<div><br></div><div>I have added few more questions to the bug [1]. Please confirm my understanding.</div><div><br></div><div><br></div><div>[1] <a href="https://bugs.launchpad.net/neutron/+bug/1470612/comments/12">https://bugs.launchpad.net/neutron/+bug/1470612/comments/12</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 28, 2015 at 12:14 PM, Shraddha Pandhe <span dir="ltr"><<a href="mailto:spandhe.openstack@gmail.com" target="_blank">spandhe.openstack@gmail.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,<div><br></div><div>I started working on this patch for bug [0], but it doesn't seem as straightforward as Kevin and I initially thought. Here's why:</div><div><br></div><div>Initially we thought that a simple self.cache.push_port will work as follows:</div><div><br></div><div>In __init__ [1], in _populate_network_cache [2], get all existing active networks from neutron using plugin_rpc similar to [3]. Then, for each of those networks, go through all the subnets and ports and add them in [4] before updating the cache.</div><div><br></div><div>But I realized that this will not work because, if we try to get all active subnets and ports and populate those in cache, we may miss the delta. Consider following scenario:</div><div><br></div><div>Cache state before agent stopped:</div><div>networks 1</div><div>subnets 4</div><div>ports 10</div><div><br></div><div>While the agent was down:</div><div>networks 1</div><div>subnets 6</div><div>ports 12</div><div><br></div><div>Now, then the agent comes back up, if we follow the above method, the network cache will immediately populate itself to the new state, without actually creating those subnets and ports in dhcp config. So if we want to follow this route, we need a mechanism to get known_subnet_ids and known_port_ids from dhcp driver, just like we get known_network_ids at [5] &[6]. To me, that seems too much work for what it does.</div><div><br></div><div>Any better ideas to solve this problem?</div><div><br></div><div><br></div><div><br></div><div>[0] <a href="https://bugs.launchpad.net/neutron/+bug/1470612" style="font-size:13px" target="_blank">https://bugs.launchpad.net/neutron/+bug/1470612</a></div><div>[1] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L54" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L54</a></div><div>[2] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L75" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L75</a></div><div>[3] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L156" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L156</a></div><div>[4] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L82-L85" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L82-L85</a></div><div>[5] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L78" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L78</a></div><div>[6] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L293-L302" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L293-L302</a></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 1, 2015 at 11:28 AM, Shraddha Pandhe <span dir="ltr"><<a href="mailto:spandhe.openstack@gmail.com" target="_blank">spandhe.openstack@gmail.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,<div><br></div><div>I had a discussion about this with Kevin Benton on IRC. Filed a bug: <a href="https://bugs.launchpad.net/neutron/+bug/1470612" target="_blank">https://bugs.launchpad.net/neutron/+bug/1470612</a></div><div><br></div><div>Thanks!</div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 1, 2015 at 11:03 AM, Shraddha Pandhe <span dir="ltr"><<a href="mailto:spandhe.openstack@gmail.com" target="_blank">spandhe.openstack@gmail.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"><div>Hi Shihan,</div><div><br></div><div>I think the problem is slightly different. Does your patch take care of the scenario where a port was deleted  AFTER agent restart (not when agent was down)?</div><div><br></div><div>My problem is that, when the agent restarts, it loses its previous network cache. As soon as the agent starts, as part of "__init__", it rebuilds that cache [1]. But it does not put the ports in there [2].</div><div><br></div><div>In sync_state, Neutron tries to enable/disable networks, by checking the diff between Neutron's state and its own network cache that it just built [3]. It enables any NEW networks and disables any DELETED networks, but it does nothing to PREVIOUSLY KNOWN NETWORKS. So those subnets and ports remain empty lists.</div><div><br></div><div>Now, if such a port is deleted, [4] will return None and the port will never get deleted from the config.</div><div><br></div><div>[1] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L68" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L68</a></div><div>[2] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L79-L86" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L79-L86</a></div><div>[3] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L154-L171" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L154-L171</a></div><div>[4] <a href="https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L349" target="_blank">https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L349</a></div><div><br></div><div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>