diff options
| author | Soren Hansen <soren.hansen@rackspace.com> | 2010-11-03 15:05:10 +0100 |
|---|---|---|
| committer | Soren Hansen <soren.hansen@rackspace.com> | 2010-11-03 15:05:10 +0100 |
| commit | 2a16ae2f8479e469e413dfd036bac805163f3ac2 (patch) | |
| tree | b41d3f501cdc74e0dd742d3095f6d166b09c73c2 /nova/utils.py | |
| parent | 56c7e7763fc07f26be40bb8c0c702fc9afe8b1e3 (diff) | |
| download | nova-2a16ae2f8479e469e413dfd036bac805163f3ac2.tar.gz nova-2a16ae2f8479e469e413dfd036bac805163f3ac2.tar.xz nova-2a16ae2f8479e469e413dfd036bac805163f3ac2.zip | |
Change socket type in nova.utils.get_my_ip() to SOCK_DGRAM. This way, we don't actually have to set up a connection.
Also, change the destination host to an IP (chose one of Google's DNS's at random) rather than a hostname, so we avoid doing a DNS lookup.
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/utils.py b/nova/utils.py index bc495a691..e7892a212 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -154,8 +154,8 @@ def get_my_ip(): if getattr(FLAGS, 'fake_tests', None): return '127.0.0.1' try: - csock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - csock.connect(('www.google.com', 80)) + csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + csock.connect(('8.8.8.8', 80)) (addr, port) = csock.getsockname() csock.close() return addr |
