no way to query ports by ip address

Bug #1033123 reported by dan wendlandt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Invalid
Undecided
Salvatore Orlando

Bug Description

It is important to be able to query for a port based on IP address. Aside from being generally useful, this is required for implementing the metadata functionality used by Nova.

From db_base_plugin_v2.py, it looks like we implement this, but this code assumes that we can pass in filter values that are dictionaries. However, filters are expressed as URL parameters, meaning passing a dictionary is not possible.

filtering on fixed_ip is someone of a special case, as fixed_ip is not a primitive value, yet it includes something we want to search over. We had a long thread on the ML a while back, but never reached a real conclusion. See "V2 IP Address Allocations" at https://lists.launchpad.net/netstack/maillist.html

The easiest solution would probably be to just define two extra filter fields: fixed_ip_address and fixed_ip_subnet that can be included in the set of filters, but clearly there are many opinions on the topic.

dan wendlandt (danwent)
Changed in quantum:
milestone: none → folsom-3
assignee: nobody → Salvatore Orlando (salvatore-orlando)
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
Gary Kotton (garyk) wrote :

Hi,
Via the client one is able to do the search as follows.

 port-list -- --fixed_ips type=dict list=true ip_address=192.168.100.2

Thanks
Gary

Revision history for this message
dan wendlandt (danwent) wrote :

so it appears that the server handles it correctly if the client serializes the dictionary to a URL-encoded string.

So this simple fix to the client does the trick to let the user pass in search_opts as a dictionary:

diff --git a/quantumclient/v2_0/client.py b/quantumclient/v2_0/client.py
index da9dcac..c1acdb0 100644
--- a/quantumclient/v2_0/client.py
+++ b/quantumclient/v2_0/client.py
@@ -338,6 +338,9 @@ class Client(object):
         action += ".%s" % self.format
         action = self.action_prefix + action
         if type(params) is dict:
+ for k,v in params.iteritems():
+ if type(v) is dict:
+ params[k] = str(v)
             action += '?' + urllib.urlencode(params, doseq=1)
         if body:
             body = self.serialize(body)

Alternately, we could require the caller of the API library to know that all search_opts values must be string, and to call str themselves.

Changed in quantum:
status: Confirmed → Invalid
dan wendlandt (danwent)
Changed in quantum:
importance: Critical → Undecided
milestone: folsom-3 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.