summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-05 15:34:40 +0000
committerGerrit Code Review <review@openstack.org>2012-07-05 15:34:40 +0000
commitbe0c9e62840ae7bcff3e77a5b3bd664d3bda6d43 (patch)
tree9c9d43d2f91ed9adf70c81c0eadddfdbba474b6a /nova
parent980c76266629ea66bc23fddb02f5be61c51d873c (diff)
parent7ed3452d10bfa51957554030425a09d029deff61 (diff)
downloadnova-be0c9e62840ae7bcff3e77a5b3bd664d3bda6d43.tar.gz
nova-be0c9e62840ae7bcff3e77a5b3bd664d3bda6d43.tar.xz
nova-be0c9e62840ae7bcff3e77a5b3bd664d3bda6d43.zip
Merge "Remove unused 'get_open_port' method from libvirt utils"
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/fake_libvirt_utils.py5
-rw-r--r--nova/virt/libvirt/utils.py18
2 files changed, 0 insertions, 23 deletions
diff --git a/nova/tests/fake_libvirt_utils.py b/nova/tests/fake_libvirt_utils.py
index 2cd5bb75e..1467a26de 100644
--- a/nova/tests/fake_libvirt_utils.py
+++ b/nova/tests/fake_libvirt_utils.py
@@ -118,11 +118,6 @@ def file_delete(path):
return True
-def get_open_port(start_port, end_port):
- # Return the port in the middle
- return int((start_port + end_port) / 2)
-
-
def get_fs_info(path):
return {'total': 128 * (1024 ** 3),
'used': 44 * (1024 ** 3),
diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py
index b4bb08f87..f08485ea3 100644
--- a/nova/virt/libvirt/utils.py
+++ b/nova/virt/libvirt/utils.py
@@ -330,24 +330,6 @@ def file_delete(path):
return os.unlink(path)
-def get_open_port(start_port, end_port):
- """Find an available port
-
- :param start_port: Start of acceptable port range
- :param end_port: End of acceptable port range
- """
- for i in xrange(0, 100): # don't loop forever
- port = random.randint(start_port, end_port)
- # netcat will exit with 0 only if the port is in use,
- # so a nonzero return value implies it is unused
- cmd = 'netcat', '0.0.0.0', port, '-w', '1'
- try:
- stdout, stderr = execute(*cmd, process_input='')
- except exception.ProcessExecutionError:
- return port
- raise Exception(_('Unable to find an open port'))
-
-
def get_fs_info(path):
"""Get free/used/total space info for a filesystem