Make provider network creation more error proof
Change-Id: I4bdd3e1effbc49cb3a1ada195c491e823619fa59 Partial-Bug: #1578989 See-Also: https://review.openstack.org/502306 (nova spec) See-Also: https://review.openstack.org/508149 (neutron spec)
This commit is contained in:
parent
201903d8b8
commit
7eb6725c80
@ -14,7 +14,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import itertools
|
|
||||||
import math
|
import math
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -993,27 +992,24 @@ class BaseAdminNetworkTest(BaseNetworkTest):
|
|||||||
def create_provider_network(cls, physnet_name, start_segmentation_id,
|
def create_provider_network(cls, physnet_name, start_segmentation_id,
|
||||||
max_attempts=30):
|
max_attempts=30):
|
||||||
segmentation_id = start_segmentation_id
|
segmentation_id = start_segmentation_id
|
||||||
for attempts in itertools.count():
|
for attempts in range(max_attempts):
|
||||||
try:
|
try:
|
||||||
prov_network = cls.create_network(
|
return cls.create_network(
|
||||||
name=data_utils.rand_name('test_net'),
|
name=data_utils.rand_name('test_net'),
|
||||||
shared=True,
|
shared=True,
|
||||||
provider_network_type='vlan',
|
provider_network_type='vlan',
|
||||||
provider_physical_network=physnet_name,
|
provider_physical_network=physnet_name,
|
||||||
provider_segmentation_id=segmentation_id)
|
provider_segmentation_id=segmentation_id)
|
||||||
break
|
|
||||||
except lib_exc.Conflict:
|
except lib_exc.Conflict:
|
||||||
if attempts > max_attempts:
|
|
||||||
LOG.exception("Failed to create provider network after "
|
|
||||||
"%d attempts", attempts)
|
|
||||||
raise lib_exc.TimeoutException
|
|
||||||
segmentation_id += 1
|
segmentation_id += 1
|
||||||
if segmentation_id > 4095:
|
if segmentation_id > 4095:
|
||||||
raise lib_exc.TempestException(
|
raise lib_exc.TempestException(
|
||||||
"No free segmentation id was found for provider "
|
"No free segmentation id was found for provider "
|
||||||
"network creation!")
|
"network creation!")
|
||||||
time.sleep(CONF.network.build_interval)
|
time.sleep(CONF.network.build_interval)
|
||||||
return prov_network
|
LOG.exception("Failed to create provider network after "
|
||||||
|
"%d attempts", max_attempts)
|
||||||
|
raise lib_exc.TimeoutException
|
||||||
|
|
||||||
|
|
||||||
def require_qos_rule_type(rule_type):
|
def require_qos_rule_type(rule_type):
|
||||||
|
Loading…
Reference in New Issue
Block a user