Functional tests should support DNS nameserver config

The Magnum functional tests currently use a DNS server setting of
8.8.8.8 when configuring nodes in a cluster. In some environments,
this DNS server setting doesn't work. When this is the case, and
functional tests are run locally, bay creation times out and the
functional tests fail.

This patch enhances the functional tests to allow configuration of
DNS nameserver to be used in baymodels that are created in
functional tests.

Change-Id: I958d199565ae5741dd6f4b8764e51ea16a8d505b
Closes-Bug: #1570543
This commit is contained in:
Dane LeBlanc 2016-04-14 15:49:50 -04:00
parent 11b88008c3
commit 9712370357
7 changed files with 24 additions and 2 deletions

View File

@ -39,6 +39,12 @@ If you're using devstack, you can copy and modify the devstack configuration::
source /opt/stack/devstack/openrc demo demo
iniset functional_creds.conf auth password $OS_PASSWORD
Set the DNS name server to be used in your bay nodes (e.g. 8.8.8.8)::
# update DNS name server
source /opt/stack/devstack/openrc demo demo
iniset functional_creds.conf magnum dns_nameserver <dns-svr-ip-address>
Create the necessary keypair and flavor::
source /opt/stack/devstack/openrc admin admin

View File

@ -67,6 +67,7 @@ flavor_id = s1.magnum
master_flavor_id = m1.magnum
copy_logs = true
csr_location = $MAGNUM_DIR/default.csr
dns_nameserver = 8.8.8.8
EOF
# Note(eliqiao): Let's keep this only for debugging on gate.

View File

@ -103,6 +103,12 @@ class Config(object):
raise Exception('config missing csr_location key')
cls.csr_location = CONF.magnum.csr_location
@classmethod
def set_dns_nameserver(cls, config):
if 'dns_nameserver' not in CONF.magnum:
raise Exception('config missing dns_nameserver')
cls.dns_nameserver = CONF.magnum.dns_nameserver
@classmethod
def set_copy_logs(cls, config):
if 'copy_logs' not in CONF.magnum:
@ -125,4 +131,5 @@ class Config(object):
cls.set_magnum_url(config)
cls.set_master_flavor_id(config)
cls.set_csr_location(config)
cls.set_dns_nameserver(config)
cls.set_copy_logs(config)

View File

@ -203,7 +203,7 @@ def valid_swarm_baymodel():
return baymodel_data(image_id=config.Config.image_id,
fixed_network="192.168.0.0/24",
flavor_id=config.Config.flavor_id, public=False,
dns_nameserver="8.8.8.8",
dns_nameserver=config.Config.dns_nameserver,
master_flavor_id=config.Config.master_flavor_id,
keypair_id=config.Config.keypair_id, coe="swarm",
docker_volume_size=3, cluster_distro=None,

View File

@ -54,6 +54,7 @@ class BaseMagnumClient(base.BaseMagnumTest):
flavor_id = cliutils.env('FLAVOR_ID')
master_flavor_id = cliutils.env('MASTER_FLAVOR_ID')
keypair_id = cliutils.env('KEYPAIR_ID')
dns_nameserver = cliutils.env('DNS_NAMESERVER')
copy_logs = cliutils.env('COPY_LOGS')
config = configparser.RawConfigParser()
@ -71,6 +72,8 @@ class BaseMagnumClient(base.BaseMagnumTest):
master_flavor_id = master_flavor_id or config.get(
'magnum', 'master_flavor_id')
keypair_id = keypair_id or config.get('magnum', 'keypair_id')
dns_nameserver = dns_nameserver or config.get(
'magnum', 'dns_nameserver')
try:
copy_logs = copy_logs or config.get('magnum', 'copy_logs')
except configparser.NoOptionError:
@ -81,6 +84,7 @@ class BaseMagnumClient(base.BaseMagnumTest):
cls.flavor_id = flavor_id
cls.master_flavor_id = master_flavor_id
cls.keypair_id = keypair_id
cls.dns_nameserver = dns_nameserver
cls.copy_logs = bool(copy_logs)
cls.cs = v1client.Client(username=user,
api_key=passwd,
@ -132,6 +136,7 @@ class BaseMagnumClient(base.BaseMagnumTest):
docker_volume_size=docker_volume_size,
network_driver=network_driver,
volume_driver=volume_driver,
dns_nameserver=cls.dns_nameserver,
coe=coe,
labels=labels,
tls_disabled=tls_disabled,

View File

@ -39,7 +39,6 @@ class TestSwarmAPIs(BayTest):
"network_driver": None,
"volume_driver": None,
"fixed_network": '192.168.0.0/24',
"dns_nameserver": '8.8.8.8',
"labels": {}
}

View File

@ -56,6 +56,10 @@ MagnumGroup = [
default="/opt/stack/new/magnum/default.csr",
help="CSR location for certificates."),
cfg.StrOpt("dns_nameserver",
default="8.8.8.8",
help="DNS nameserver to use for baymodels."),
cfg.StrOpt("copy_logs",
default=True,
help="Specify whether to copy nova server logs on failure."),