Comment 6 for bug 494185

Revision history for this message
Scott Moser (smoser) wrote :

I'm thinking right now to replace get_mirror_from_availability_zone with:

| def get_mirror_from_availability_zone(self, availability_zone):
| # availability is like 'us-west-1b' or 'eu-west-1a'
| try:
| host="%s.ec2.archive.ubuntu.com" % availability_zone[:-1]
| socket.getaddrinfo(host, None, 0, socket.SOCK_STREAM)
| return host
| except:
| return 'http://archive.ubuntu.com/ubuntu/'

Over all, it takes a much better "hit" to select a ec2 mirror. That should greatly reduce the chance for false positives.

The chance for error is then:
a.) availability zone names change form (ie, no longer '<region>[a-z]')
b.) there are images in a new region before a mirror is up, but the
    dns entry already exists

I think its reasonably good, the only thing that concerns me is the possibility of getaddrinfo hanging.