fix greenthread race conditions in trunk and floating ip leakage
This commit is contained in:
@@ -101,6 +101,7 @@ class CloudTestCase(test.TrialTestCase):
|
|||||||
self.cloud.describe_addresses(self.context)
|
self.cloud.describe_addresses(self.context)
|
||||||
self.cloud.release_address(self.context,
|
self.cloud.release_address(self.context,
|
||||||
public_ip=address)
|
public_ip=address)
|
||||||
|
greenthread.sleep(0.3)
|
||||||
db.floating_ip_destroy(self.context, address)
|
db.floating_ip_destroy(self.context, address)
|
||||||
|
|
||||||
def test_associate_disassociate_address(self):
|
def test_associate_disassociate_address(self):
|
||||||
@@ -111,6 +112,7 @@ class CloudTestCase(test.TrialTestCase):
|
|||||||
'host': FLAGS.host})
|
'host': FLAGS.host})
|
||||||
self.cloud.allocate_address(self.context)
|
self.cloud.allocate_address(self.context)
|
||||||
inst = db.instance_create(self.context, {})
|
inst = db.instance_create(self.context, {})
|
||||||
|
fixed = self.network.allocate_fixed_ip(self.context, inst['id'])
|
||||||
ec2_id = cloud.internal_id_to_ec2_id(inst['internal_id'])
|
ec2_id = cloud.internal_id_to_ec2_id(inst['internal_id'])
|
||||||
self.cloud.associate_address(self.context,
|
self.cloud.associate_address(self.context,
|
||||||
instance_id=ec2_id,
|
instance_id=ec2_id,
|
||||||
@@ -119,6 +121,8 @@ class CloudTestCase(test.TrialTestCase):
|
|||||||
public_ip=address)
|
public_ip=address)
|
||||||
self.cloud.release_address(self.context,
|
self.cloud.release_address(self.context,
|
||||||
public_ip=address)
|
public_ip=address)
|
||||||
|
greenthread.sleep(0.3)
|
||||||
|
self.network.deallocate_fixed_ip(self.context, fixed)
|
||||||
db.instance_destroy(self.context, inst['id'])
|
db.instance_destroy(self.context, inst['id'])
|
||||||
db.floating_ip_destroy(self.context, address)
|
db.floating_ip_destroy(self.context, address)
|
||||||
|
|
||||||
|
@@ -138,9 +138,6 @@ class QuotaTestCase(test.TrialTestCase):
|
|||||||
|
|
||||||
def test_too_many_addresses(self):
|
def test_too_many_addresses(self):
|
||||||
address = '192.168.0.100'
|
address = '192.168.0.100'
|
||||||
try:
|
|
||||||
db.floating_ip_get_by_address(context.get_admin_context(), address)
|
|
||||||
except exception.NotFound:
|
|
||||||
db.floating_ip_create(context.get_admin_context(),
|
db.floating_ip_create(context.get_admin_context(),
|
||||||
{'address': address, 'host': FLAGS.host})
|
{'address': address, 'host': FLAGS.host})
|
||||||
float_addr = self.network.allocate_floating_ip(self.context,
|
float_addr = self.network.allocate_floating_ip(self.context,
|
||||||
@@ -151,3 +148,4 @@ class QuotaTestCase(test.TrialTestCase):
|
|||||||
# that is breaking.
|
# that is breaking.
|
||||||
self.assertRaises(cloud.QuotaError, self.cloud.allocate_address,
|
self.assertRaises(cloud.QuotaError, self.cloud.allocate_address,
|
||||||
self.context)
|
self.context)
|
||||||
|
db.floating_ip_destroy(context.get_admin_context(), address)
|
||||||
|
Reference in New Issue
Block a user