Commit 8b71128b authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

burnin: Search all public networks

Previously burnin tried to create a floatingIP from the first public
network found. But this public network may be full.
This patch fixes '_create_floating_ip' so it will try all public
networks until it succeeds.
parent 178882b1
......@@ -452,22 +452,31 @@ class CycladesTests(BurninTests):
# Verify quotas
def _get_public_network(self, networks=None):
"""Get the public network"""
def _get_public_networks(self, networks=None):
"""Get the public networks"""
if networks is None:
networks = self._get_list_of_networks(detail=True)"Getting the public network")"Getting the public networks")
public_networks = []
for net in networks:
if net['SNF:floating_ip_pool'] and net['public']:
return net"Could not find a public network to use")
self.assertNotEqual(public_networks, [],
"Could not find a public network to use")
return public_networks
def _create_floating_ip(self):
"""Create a new floating ip"""
pub_net = self._get_public_network()
pub_nets = self._get_public_networks()
for pub_net in pub_nets:"Creating a new floating ip for network with id %s",
fip =['id'])
except ClientError as err:
self.warning("%s: %s", err.message, err.details)
# Verify that floating ip has been created
fips =
fips = [f['id'] for f in fips]
......@@ -481,6 +490,8 @@ class CycladesTests(BurninTests):
fip['floating_ip_address'], fip['id'])
return fip"No more IP addresses available")
def _create_port(self, network_id, device_id=None, floating_ip=None):
"""Create a new port attached to the a specific network""""Creating a new port to network with id %s", network_id)
......@@ -540,8 +551,10 @@ class CycladesTests(BurninTests):
def _disconnect_from_network(self, server, network=None):
"""Disconnnect server from network"""
if network is None:
# Disconnect from public network
network = self._get_public_network()
# Disconnect from all public networks
for net in self._get_public_networks():
self._disconnect_from_network(server, network=net)
lports =
ports = []
......@@ -569,6 +582,8 @@ class CycladesTests(BurninTests):
"""Delete floating ips"""
# Renew the list of floating IP objects
# (It may have been changed, i.e. a port may have been deleted).
if not fips:
fip_ids = [f['id'] for f in fips]
new_fips = [f for f in
if f['id'] in fip_ids]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment