<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jan 28, 2015, at 7:05 AM, Steven Kaufer <<a href="mailto:kaufer@us.ibm.com">kaufer@us.ibm.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><p><tt><font size="2">Vishvananda Ishaya <<a href="mailto:vishvananda@gmail.com">vishvananda@gmail.com</a>> wrote on 01/27/2015 04:29:50 PM:<br><br>> From: Vishvananda Ishaya <<a href="mailto:vishvananda@gmail.com">vishvananda@gmail.com</a>></font></tt><br><tt><font size="2">> To: "OpenStack Development Mailing List (not for usage questions)"<span class="Apple-converted-space"> </span><br>> <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>></font></tt><br><tt><font size="2">> Date: 01/27/2015 04:32 PM</font></tt><br><tt><font size="2">> Subject: Re: [openstack-dev] [nova] [api] Get servers with limit and<br>> IP address filter</font></tt><br><tt><font size="2">><span class="Apple-converted-space"> </span><br>> The network info for an instance is cached as a blob of data<span class="Apple-converted-space"> </span><br>> (neutron has the canonical version in most installs), so it isn’t<span class="Apple-converted-space"> </span><br>> particularly easy to do at the database layer. You would likely need<br>> a pretty complex stored procedure to do it accurately.</font></tt><br><tt><font size="2">><span class="Apple-converted-space"> </span><br>> Vish</font></tt><br><br><tt><font size="2">Vish,</font></tt><br><br><tt><font size="2">Thanks for the reply.</font></tt><br><br><tt><font size="2">I agree with your point about the difficultly in accurately querying the blob of data; however, IMHO, the complexity this fix does not<span class="Apple-converted-space"> </span></font></tt><tt><font size="2">preclude the current behavior as being classified as a bug.</font></tt><br><br><tt><font size="2">With that in mind, I was wondering if anyone in the community has any thoughts on if the current behavior is considered a bug?</font></tt><br></p></div></blockquote><div><br></div>Yes it should be classified as a bug.<br><blockquote type="cite"><div style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><p><br><tt><font size="2">If so, how should it be resolved? A couple options that I could think of:</font></tt><br><br><tt><font size="2">1. Disallow the combination of using both a limit and an IP address filter by raising an error.</font></tt><br></p></div></blockquote><div><br></div>I think this is the simplest solution.</div><div><br></div><div>Vish</div><div><br><blockquote type="cite"><div style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><p><tt><font size="2">2. Workaround the problem by removing the limit from the DB query and then manually limiting the list of servers (after manually applying the IP address filter).</font></tt><br><tt><font size="2">3. Break up the query so that the server UUIDs that match the IP filter are retrieved first and then used as a UUID DB filter. As far as I can tell, this type of solution was originally implemented but the network query was deemed to expensive [1]. Is there a less expensive method to determine the UUIDs (possibly querying the cached 'network_info' in the '</font></tt><tt><font size="2">instance_info_caches' table)?</font></tt><br><tt><font size="2">4. Figure out how to accurately query the blob of network info that is cached in the nova DB and apply the IP filter at the DB layer.</font></tt><br><br><tt><font size="2">[1]:<span class="Apple-converted-space"> </span></font></tt><a href="https://review.openstack.org/#/c/131460/"><tt><font size="2">https://review.openstack.org/#/c/131460/</font></tt></a><br><br><tt><font size="2">Thanks,</font></tt><br><tt><font size="2">Steven Kaufer</font></tt><br><br><tt><font size="2">><span class="Apple-converted-space"> </span><br>> On Jan 27, 2015, at 2:00 PM, Steven Kaufer <<a href="mailto:kaufer@us.ibm.com">kaufer@us.ibm.com</a>> wrote:</font></tt><br><tt><font size="2">><span class="Apple-converted-space"> </span><br>> Hello,<br>><span class="Apple-converted-space"> </span><br>> When applying an IP address filter to a paginated servers query (eg,<br>> supplying servers/detail?ip=192.168&limit=100), the IP address<span class="Apple-converted-space"> </span><br>> filtering is only being applied against the non-filtered page of<span class="Apple-converted-space"> </span><br>> servers that were retrieved from the DB; see [1].<br>><span class="Apple-converted-space"> </span><br>> I believe that the IP address filtering should be done before the<span class="Apple-converted-space"> </span><br>> limit is applied, returning up to <limit> servers that match the IP<span class="Apple-converted-space"> </span><br>> address filter.  Currently, if the servers in the page of data<span class="Apple-converted-space"> </span><br>> returned from the DB do not happen to match the IP address filter<span class="Apple-converted-space"> </span><br>> (applied in the compute API), then no servers will be returned by<span class="Apple-converted-space"> </span><br>> the REST API (even if there are servers that match the IP address filter).<br>><span class="Apple-converted-space"> </span><br>> This seems like a bug to me, shouldn't all filtering be done at the DB layer?<br>><span class="Apple-converted-space"> </span><br>> [1]:<span class="Apple-converted-space"> </span><a href="https://github.com/openstack/nova/blob/master/nova/compute/">https://github.com/openstack/nova/blob/master/nova/compute/</a><br>> api.py#L2037-L2042<br>><span class="Apple-converted-space"> </span><br>> Thanks,<br>> Steven Kaufer</font></tt><br><tt><font size="2">> __________________________________________________________________________<br>> OpenStack Development Mailing List (not for usage questions)<br>> Unsubscribe: <a href="mailto:OpenStack-dev-request@lists.openstack.org">OpenStack-dev-request@lists.openstack.org</a>?subject:unsubscribe<br>><span class="Apple-converted-space"> </span><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a></font></tt><br><tt><font size="2">> __________________________________________________________________________<br>> OpenStack Development Mailing List (not for usage questions)<br>> Unsubscribe:<span class="Apple-converted-space"> </span><a href="mailto:OpenStack-dev-request@lists.openstack.org">OpenStack-dev-request@lists.openstack.org</a>?subject:unsubscribe<br>><span class="Apple-converted-space"> </span><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br></font></tt>__________________________________________________________________________<br>OpenStack Development Mailing List (not for usage questions)<br>Unsubscribe:<span class="Apple-converted-space"> </span><a href="mailto:OpenStack-dev-request@lists.openstack.org">OpenStack-dev-request@lists.openstack.org</a>?subject:unsubscribe<br><a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a></p></div></blockquote></div><br></body></html>