Deploy network envs appropriate for the job

The nonha jobs don't use net-iso, so there's no need to spend the
time creating a lot of networks and ports.  In addition, OVB now
has the ability to deploy a network environment that supports
basic bonding, and this change adds support for deploying that as
well.  No jobs currently use bonding, but that will be added in a
follow-up patch.

Change-Id: Ifb65d962293b8b69b2a84597c29c1ffae5d9bc2c
This commit is contained in:
Ben Nemec 2016-07-26 19:04:05 +00:00
parent f604f8ceef
commit 8f996a067b
5 changed files with 35 additions and 8 deletions

View File

@ -6,11 +6,12 @@ NODECOUNT=${2:-2}
UCINSTANCE=${3:-}
CREATE_UNDERCLOUD=${4:-""}
SSH_KEY=${5:-""}
# We recognize 3 values for NETISO: none, multi-nic, public-bond
NETISO=${6:-'multi-nic'}
PROVISIONNET=provision-${ENVNUM}
PUBLICNET=public-${ENVNUM}
ENVFILE=env-${ENVNUM}.yaml
source /etc/nodepoolrc
if [ ! -e /opt/stack/openstack-virtual-baremetal ] ; then
@ -52,8 +53,13 @@ if [ -z "$CREATE_UNDERCLOUD" ]; then
echo ' OS::OVB::UndercloudEnvironment: OS::Heat::None' >> $ENVFILE
fi
echo ' OS::OVB::UndercloudFloating: templates/undercloud-floating-none.yaml' >> $ENVFILE
echo ' OS::OVB::BaremetalNetworks: templates/baremetal-networks-all.yaml' >> $ENVFILE
echo ' OS::OVB::BaremetalPorts: templates/baremetal-ports-all.yaml' >> $ENVFILE
if [ $NETISO == 'multi-nic' ]; then
echo ' OS::OVB::BaremetalNetworks: templates/baremetal-networks-all.yaml' >> $ENVFILE
echo ' OS::OVB::BaremetalPorts: templates/baremetal-ports-all.yaml' >> $ENVFILE
elif [ $NETISO == 'public-bond' ]; then
echo ' OS::OVB::BaremetalNetworks: templates/baremetal-networks-all.yaml' >> $ENVFILE
echo ' OS::OVB::BaremetalPorts: templates/baremetal-ports-public-bond.yaml' >> $ENVFILE
fi
/opt/stack/openstack-virtual-baremetal/bin/deploy.py --env $ENVFILE --name baremetal_${ENVNUM} --quintupleo --id ${ENVNUM}
@ -69,7 +75,9 @@ while ! heat stack-show baremetal_${ENVNUM} | grep CREATE_COMPLETE ; do
done
nova interface-attach --net-id $(neutron net-show -F id -f value $PROVISIONNET) $UCINSTANCE
nova interface-attach --net-id $(neutron net-show -F id -f value $PUBLICNET) $UCINSTANCE
if [ $NETISO != 'none' ]; then
nova interface-attach --net-id $(neutron net-show -F id -f value $PUBLICNET) $UCINSTANCE
fi
# This writes out the env file as env-ID.yaml while overwrites the one we have created
/opt/stack/openstack-virtual-baremetal/bin/build-nodes-json --env $ENVFILE \

View File

@ -12,14 +12,17 @@ rm -f /opt/stack/openstack-virtual-baremetal/temp-key-$ENVNUM.pub
source /etc/nodepoolrc
function delete_ports() {
local subnetid=$1
local subnetid=${1:-}
if [ -z "$subnetid" ]; then
return
fi
for PORT in $(neutron port-list | grep $subnetid | awk '{print $2}') ; do
neutron port-delete $PORT
done
}
# Delete the ports that have been attached to the undercloud
SUBNETID=$(neutron subnet-show $PUBLICNET | awk '$2=="id" {print $4}')
SUBNETID=$(neutron subnet-show $PUBLICNET | awk '$2=="id" {print $4}' || echo '')
delete_ports $SUBNETID
SUBNETID=$(neutron subnet-show $PROVISIONNET | awk '$2=="id" {print $4}')
delete_ports $SUBNETID

View File

@ -131,7 +131,8 @@ class TEWorkerThread(threading.Thread):
arguments.get("envsize","2"),
arguments.get("ucinstance",""),
arguments.get("create_undercloud", ""),
arguments.get("ssh_key", "")],
arguments.get("ssh_key", ""),
arguments.get("net_iso", "multi-nic")],
stderr=subprocess.STDOUT))
clientdata = fp.read()
except subprocess.CalledProcessError as e:

View File

@ -157,6 +157,15 @@ def main(args=sys.argv[1:]):
help='deploy the undercloud node.')
parser.add_argument('--ssh-key', default='',
help='ssh key for the ovb nodes to be deployed.')
parser.add_argument('--net-iso',
default="multi-nic",
choices=['none', 'multi-nic', 'public-bond'],
help='"none" requests an environment without network '
'isolation, "multi-nic" requests one with a '
'basic multiple nic configuration, and '
'"public-bond" requests one like "multi-nic" '
'but with two public nics for use with bonded '
'nic-configs.')
parser.add_argument('--debug', '-d', action='store_true',
help='Set to debug mode.')
opts = parser.parse_args(args)
@ -178,6 +187,7 @@ def main(args=sys.argv[1:]):
"ucinstance":opts.ucinstance,
"create_undercloud": "true" if opts.create_undercloud else "",
"ssh_key":opts.ssh_key,
"net_iso":opts.net_iso,
}
job = gear.Job('lockenv', json.dumps(job_params))
client.submitJob(job)

View File

@ -316,9 +316,14 @@ if [ -z "${TE_DATAFILE:-}" -a "$OSINFRA" = "0" ] ; then
# Only check every 5 minutes to avoid hammering the status endpoint.
( while :; do sleep 300; curl http://zuul.openstack.org/status.json | grep -q $ZUUL_UUID || sudo kill -9 $$; done ) &> /dev/null &
# TODO(bnemec): Add jobs that use public-bond
NETISO_ENV="none"
if [ $NETISO_V4 -eq 1 -o $NETISO_V6 -eq 1 ]; then
NETISO_ENV="multi-nic"
fi
./testenv-client -b $GEARDSERVER:4730 -t $TIMEOUT_SECS \
--envsize $NODECOUNT --ucinstance $UCINSTANCEID \
$TEST_ENV_EXTRA_ARGS -- $TOCIRUNNER
--net-iso $NETISO_ENV $TEST_ENV_EXTRA_ARGS -- $TOCIRUNNER
else
$TOCIRUNNER
fi