Repository : http://git.fedorahosted.org/cgit/
On branch : v1.4
commit fb02391358377dbc692cf0b0011dd9b444589a89 Author: Matt Domsch Matt_Domsch@dell.com Date: Fri Jun 7 11:02:06 2013 -0500
mirrorlist_server: remove _ordered_netblocks() usage
_ordered_netblocks() usage is broken. It is taking a hostid, and calling IP() on it, which is plain wrong.
The goal of _ordered_netblocks() is to, given a list of (hostid, netblock), where netblock is the block that contains the client's IP address that we're looking up, we want to later be able to sort that list by the size of the netblock. However, do_netblocks() isn't returning us such a list, it's only returning the list of hostids. So, we need to fix do_netblocks(), then we can fix _ordered_netblocks(). We will do neither here.
This patch drops the use of _ordered_netblocks(), reverting to the v1.3 behavior of simply randomizing the list of hosts that claim a given client IP address in its netblocks. We can revisit the better fix later.
mirrorlist-server/mirrorlist_server.py | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/mirrorlist-server/mirrorlist_server.py b/mirrorlist-server/mirrorlist_server.py index 76e427b..2519f0d 100755 --- a/mirrorlist-server/mirrorlist_server.py +++ b/mirrorlist-server/mirrorlist_server.py @@ -604,13 +604,16 @@ def do_mirrorlist(kwargs): random.shuffle(l) return l
+ # FIXME this is unused. Need to figure out how to retain the object that was the netblock that we found this host in + # during the tree_lookup() above, so we know how big each netblock containing this item was, so we can later + # sort on the size of the netblock. But that's a longer-term goal. For now, ignore all this and just randomize the list. def _ordered_netblocks(s): def ipy_len(ip): return ip.len() v4_netblocks = [] v6_netblocks = [] - for n in s: - ip = IP(n) + for hostid in s: + ip = IP(n) # FIXME n is undefined to make this fail if ip.version() == 4: v4_netblocks.append(ip) elif ip.version() == 6: @@ -638,7 +641,7 @@ def do_mirrorlist(kwargs):
result_sets = [ (location_results, "location", _random_shuffle), - (netblock_results, "netblocks", _ordered_netblocks), + (netblock_results, "netblocks", _random_shuffle), (asn_results, "asn", _random_shuffle), (internet2_results, "I2", _random_shuffle), (country_results, "country", shuffle),
mirrormanager-commits@lists.fedorahosted.org