Introduce roles into the feature matrix

test-matrix.py has a new cli option, for which role the node will play.
If it is a subnode, the starting set of services will be emitted,
that matches the current logic.

Logic regarding flags like DEVSTACK_GATE_NEUTRON,
DEVSTACK_GATE_NEUTRON_DVR, DEVSTACK_GATE_IRONIC is now moved to the
feature matrix.

Co-Authored-By: Julia Varlamova <jvarlamova@mirantis.com>
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>

Change-Id: Ief1b74cbc01235d9f52d08add930781f3a0ae71b
This commit is contained in:
Sean M. Collins 2016-10-12 13:21:31 -04:00 committed by Sean Dague
parent 1a97ee80b6
commit 7fac6b6838
3 changed files with 94 additions and 34 deletions

View File

@ -255,35 +255,15 @@ function setup_localrc {
sudo yum install -y PyYAML
fi
fi
MY_ENABLED_SERVICES=`cd $BASE/new/devstack-gate && ./test-matrix.py -b $branch_for_matrix -f $DEVSTACK_GATE_FEATURE_MATRIX`
local original_enabled_services=$MY_ENABLED_SERVICES
# TODO(afazekas): Move to the feature grid
local test_matrix_role='primary'
if [[ $role = sub ]]; then
MY_ENABLED_SERVICES="n-cpu,ceilometer-acompute,dstat"
if [[ "$original_enabled_services" =~ "c-api" ]]; then
MY_ENABLED_SERVICES+=",c-vol,c-bak"
fi
if [[ "$original_enabled_services" =~ "tls-proxy" ]]; then
MY_ENABLED_SERVICES+=",tls-proxy"
fi
if [[ "$DEVSTACK_GATE_NEUTRON" -eq "1" ]]; then
MY_ENABLED_SERVICES+=",q-agt"
if [[ "$DEVSTACK_GATE_NEUTRON_DVR" -eq "1" ]]; then
# As per reference architecture described in
# https://wiki.openstack.org/wiki/Neutron/DVR
# for DVR multi-node, add the following services
# on all compute nodes:
MY_ENABLED_SERVICES+=",q-l3,q-meta"
fi
else
MY_ENABLED_SERVICES+=",n-net,n-api-meta"
fi
if [[ "$DEVSTACK_GATE_IRONIC" -eq "1" ]]; then
MY_ENABLED_SERVICES+=",ir-api,ir-cond"
fi
test_matrix_role='subnode'
fi
MY_ENABLED_SERVICES=$(cd $BASE/new/devstack-gate && ./test-matrix.py -b $branch_for_matrix -f $DEVSTACK_GATE_FEATURE_MATRIX -r $test_matrix_role)
local original_enabled_services=$(cd $BASE/new/devstack-gate && ./test-matrix.py -b $branch_for_matrix -f $DEVSTACK_GATE_FEATURE_MATRIX -r primary)
# Allow optional injection of ENABLED_SERVICES from the calling context
if [[ ! -z $ENABLED_SERVICES ]] ; then
MY_ENABLED_SERVICES+=,$ENABLED_SERVICES

View File

@ -50,6 +50,8 @@ config:
features: [tlsproxy]
cinder_mn_grenade:
features: [cinder-mn-grenade]
neutron_dvr:
features: [neutron-dvr]
branches:
# The value of ""default" is the name of the "trunk" branch
@ -57,7 +59,7 @@ branches:
# Normalized branch names only here, e.g. stable/icehouse => icehouse
allowed: [master, ocata, newton, mitaka, liberty, kilo, juno, icehouse]
features:
primary:
default:
base:
services: [mysql, rabbit, dstat]
@ -181,3 +183,74 @@ features:
rm-services: [tls-proxy]
newton:
rm-services: [tls-proxy]
subnode:
default:
base:
services: [dstat]
ceilometer:
base:
services: [ceilometer-acompute]
cinder:
base:
services: [c-vol, c-bak]
cinder-mn-grenade:
base:
services: []
glance:
base:
services: []
horizon:
base:
services: []
ironic:
base:
rm-services: [c-vol, c-bak]
services: [ir-api, ir-cond]
keystone:
base:
services: []
neutron:
base:
rm-services: [n-net, n-api-meta]
services: [q-agt]
neutron-adv:
base:
services: []
neutron-dvr:
base:
rm-services: [n-net, n-api-meta]
services: [q-agt, q-l3, q-meta]
nova:
base:
services: [n-cpu, n-net, n-api-meta]
swift:
base:
services: []
tempest:
base:
services: []
tlsproxy:
base:
services: [tls-proxy]
# TLS proxy didn't work properly until ocata
liberty:
rm-services: [tls-proxy]
mitaka:
rm-services: [tls-proxy]
newton:
rm-services: [tls-proxy]

View File

@ -73,22 +73,24 @@ def configs_from_env():
return configs
def calc_services(branch, features):
def calc_services(branch, features, role):
services = set()
for feature in features:
services.update(GRID['features'][feature]['base'].get('services', []))
if branch in GRID['features'][feature]:
grid_feature = GRID[role][feature]
services.update(grid_feature['base'].get('services', []))
if branch in grid_feature:
services.update(
GRID['features'][feature][branch].get('services', []))
grid_feature[branch].get('services', []))
# deletes always trump adds
for feature in features:
grid_feature = GRID[role][feature]
services.difference_update(
GRID['features'][feature]['base'].get('rm-services', []))
grid_feature['base'].get('rm-services', []))
if branch in GRID['features'][feature]:
if branch in grid_feature:
services.difference_update(
GRID['features'][feature][branch].get('rm-services', []))
grid_feature[branch].get('rm-services', []))
return sorted(list(services))
@ -127,6 +129,10 @@ of environmental feature definitions and flags.
parser.add_argument('-m', '--mode',
default="services",
help="What to return (services, compute-ext)")
parser.add_argument('-r', '--role',
default='primary',
help="What role this node will have",
choices=['primary', 'subnode'])
return parser.parse_args()
@ -137,11 +143,12 @@ def main():
GRID = parse_features(opts.features)
ALLOWED_BRANCHES = GRID['branches']['allowed']
branch = normalize_branch(opts.branch)
role = opts.role
features = calc_features(branch, configs_from_env())
LOG.debug("Features: %s " % features)
services = calc_services(branch, features)
services = calc_services(branch, features, role)
LOG.debug("Services: %s " % services)
if opts.mode == "services":