Merge "Adding a new option CONF.network.dvr_extra_resources"

This commit is contained in:
Jenkins 2016-10-06 11:18:53 +00:00 committed by Gerrit Code Review
commit 0235f98f14
2 changed files with 38 additions and 28 deletions

View File

@ -67,34 +67,35 @@ class L3AgentSchedulerTestJSON(base.BaseAdminNetworkTest):
msg = "L3 Agent Scheduler enabled in conf, but L3 Agent not found" msg = "L3 Agent Scheduler enabled in conf, but L3 Agent not found"
raise exceptions.InvalidConfiguration(msg) raise exceptions.InvalidConfiguration(msg)
cls.router = cls.create_router(data_utils.rand_name('router')) cls.router = cls.create_router(data_utils.rand_name('router'))
# NOTE(armax): If DVR is an available extension, and the created router
# is indeed a distributed one, more resources need to be provisioned if CONF.network.dvr_extra_resources:
# in order to bind the router to the L3 agent. # NOTE(armax): If DVR is an available extension, and the created
# That said, let's preserve the existing test logic, where the extra # router is indeed a distributed one, more resources need to be
# query and setup steps are only required if the extension is available # provisioned in order to bind the router to the L3 agent in the
# and only if the router's default type is distributed. # Liberty release or older, and are not required since the Mitaka
if test.is_extension_enabled('dvr', 'network'): # release.
cls.is_dvr_router = cls.admin_routers_client.show_router( if test.is_extension_enabled('dvr', 'network'):
cls.router['id'])['router'].get('distributed', False) cls.is_dvr_router = cls.admin_routers_client.show_router(
if cls.is_dvr_router: cls.router['id'])['router'].get('distributed', False)
cls.network = cls.create_network() if cls.is_dvr_router:
cls.subnet = cls.create_subnet(cls.network) cls.network = cls.create_network()
cls.port = cls.create_port(cls.network) cls.subnet = cls.create_subnet(cls.network)
cls.routers_client.add_router_interface( cls.port = cls.create_port(cls.network)
cls.router['id'], port_id=cls.port['id']) cls.routers_client.add_router_interface(
# NOTE: Sometimes we have seen this test fail with dvr in, cls.router['id'], port_id=cls.port['id'])
# multinode tests, since the dhcp port is not created before # NOTE: Sometimes we have seen this test fail with dvr in,
# the test gets executed and so the router is not scheduled # multinode tests, since the dhcp port is not created
# on the given agent. By adding the external gateway info to # before the test gets executed and so the router is not
# the router, the router should be properly scheduled in the # scheduled on the given agent. By adding the external
# dvr_snat node. # gateway info to the router, the router should be properly
# This is a temporary work around to prevent a race condition. # scheduled in the dvr_snat node. This is a temporary work
external_gateway_info = { # around to prevent a race condition.
'network_id': CONF.network.public_network_id, external_gateway_info = {
'enable_snat': True} 'network_id': CONF.network.public_network_id,
cls.admin_routers_client.update_router( 'enable_snat': True}
cls.router['id'], cls.admin_routers_client.update_router(
external_gateway_info=external_gateway_info) cls.router['id'],
external_gateway_info=external_gateway_info)
@classmethod @classmethod
def resource_cleanup(cls): def resource_cleanup(cls):

View File

@ -553,6 +553,15 @@ NetworkGroup = [
default=["1.0.0.0/16", "2.0.0.0/16"], default=["1.0.0.0/16", "2.0.0.0/16"],
help="List of ip pools" help="List of ip pools"
" for subnetpools creation"), " for subnetpools creation"),
# TODO(ylobankov): Delete this option once the Liberty release is EOL.
cfg.BoolOpt('dvr_extra_resources',
default=True,
help="Whether or not to create internal network, subnet, "
"port and add network interface to distributed router "
"in L3 agent scheduler test. Extra resources need to be "
"provisioned in order to bind router to L3 agent in the "
"Liberty release or older, and are not required since "
"the Mitaka release.")
] ]
network_feature_group = cfg.OptGroup(name='network-feature-enabled', network_feature_group = cfg.OptGroup(name='network-feature-enabled',