summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-11-03 15:05:10 +0100
committerSoren Hansen <soren.hansen@rackspace.com>2010-11-03 15:05:10 +0100
commit2a16ae2f8479e469e413dfd036bac805163f3ac2 (patch)
treeb41d3f501cdc74e0dd742d3095f6d166b09c73c2 /nova/utils.py
parent56c7e7763fc07f26be40bb8c0c702fc9afe8b1e3 (diff)
downloadnova-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.py4
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