Retire Tripleo: remove repo content

TripleO project is retiring
- https://review.opendev.org/c/openstack/governance/+/905145

this commit remove the content of this project repo

Change-Id: Ib988f3b567e31c2b9402f41e5dd222b7fc006756
This commit is contained in:
Ghanshyam Mann 2024-02-24 11:32:14 -08:00
parent d01331db06
commit 8325044e7a
181 changed files with 9 additions and 19698 deletions

15
.gitignore vendored
View File

@ -1,15 +0,0 @@
nodes.json
env-*.yaml
bmc_bm_pairs
*.pyc
*.pyo
.coverage
cover
.testrepository
.tox
*.egg-info
.eggs
doc/build
AUTHORS
ChangeLog
.stestr/

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "ipxe/ipxe"]
path = ipxe/ipxe
url = https://git.ipxe.org/ipxe.git

View File

@ -1,3 +0,0 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./openstack_virtual_baremetal/tests}
top_path=./

View File

@ -1,6 +0,0 @@
- project:
templates:
- openstack-python3-zed-jobs
- docs-on-readthedocs
vars:
rtd_webhook_id: '64851'

View File

@ -1,7 +1,10 @@
OpenStack Virtual Baremetal
===========================
This project is no longer maintained.
OpenStack Virtual Baremetal is a way to use OpenStack instances to do
simulated baremetal deployments. For more details, see the `full
documentation
<http://openstack-virtual-baremetal.readthedocs.io/en/latest/index.html>`_.
The contents of this repository are still available in the Git
source code management system. To see the contents of this
repository before it reached its end of life, please check out the
previous commit with "git checkout HEAD^1".
For any further questions, please email
openstack-discuss@lists.openstack.org or join #openstack-dev on
OFTC.

View File

@ -1 +0,0 @@
../openstack_virtual_baremetal/build_nodes_json.py

View File

@ -1,28 +0,0 @@
#!/bin/bash
set -e
# Report an error if the generated sample environments are not in sync with
# the current configuration and templates.
echo 'Verifying that generated environments are in sync'
tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT
./bin/environment-generator.py sample-env-generator/ $tmpdir/environments
base=$PWD
retval=0
cd $tmpdir
file_list=$(find environments -type f)
for f in $file_list; do
if ! diff -q $f $base/$f; then
echo "ERROR: $base/$f is not up to date"
diff $f $base/$f
retval=1
fi
done
exit $retval

View File

@ -1 +0,0 @@
../openstack_virtual_baremetal/deploy.py

View File

@ -1,260 +0,0 @@
#!/usr/bin/env python
# Copyright 2015 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# *************************************************************************
# This is a copy of the environment-generator.py in tripleo-heat-templates.
# At some point that version should be generalized enough to be used by
# other projects in a less hacky way.
# *************************************************************************
import argparse
import errno
import json
import os
import re
import yaml
_PARAM_FORMAT = u""" # %(description)s
%(mandatory)s# Type: %(type)s
%(name)s:%(default)s
"""
_STATIC_MESSAGE_START = (
' # ******************************************************\n'
' # Static parameters - these are values that must be\n'
' # included in the environment but should not be changed.\n'
' # ******************************************************\n'
)
_STATIC_MESSAGE_END = (' # *********************\n'
' # End static parameters\n'
' # *********************\n'
)
_FILE_HEADER = (
'# *******************************************************************\n'
'# This file was created automatically by the sample environment\n'
'# generator. Developers should use `tox -e genconfig` to update it.\n'
'# Users are recommended to make changes to a copy of the file instead\n'
'# of the original, if any customizations are needed.\n'
'# *******************************************************************\n'
)
# Certain parameter names can't be changed, but shouldn't be shown because
# they are never intended for direct user input.
_PRIVATE_OVERRIDES = []
# Hidden params are not included by default when the 'all' option is used,
# but can be explicitly included by referencing them in sample_defaults or
# static. This allows us to generate sample environments using them when
# necessary, but they won't be improperly included by accident.
_HIDDEN_PARAMS = []
# We also want to hide some patterns by default. If a parameter name matches
# one of the patterns in this list (a "match" being defined by Python's
# re.match function returning a value other than None), then the parameter
# will be omitted by default.
_HIDDEN_RE = []
_index_data = {}
def _create_output_dir(target_file):
try:
os.makedirs(os.path.dirname(target_file))
except OSError as e:
if e.errno == errno.EEXIST:
pass
else:
raise
def _generate_environment(input_env, output_path, parent_env=None):
if parent_env is None:
parent_env = {}
env = dict(parent_env)
env.pop('children', None)
env.update(input_env)
parameter_defaults = {}
param_names = []
sample_values = env.get('sample_values', {})
static_names = env.get('static', [])
for template_file, template_data in env.get('files', {}).items():
with open(template_file) as f:
f_data = yaml.safe_load(f)
f_params = f_data['parameters']
parameter_defaults.update(f_params)
if template_data['parameters'] == 'all':
new_names = [k for k, v in f_params.items()]
for hidden in _HIDDEN_PARAMS:
if (hidden not in (static_names + sample_values.keys()) and
hidden in new_names):
new_names.remove(hidden)
for hidden_re in _HIDDEN_RE:
new_names = [n for n in new_names
if n in (static_names +
sample_values.keys()) or
not re.match(hidden_re, n)]
else:
new_names = template_data['parameters']
missing_params = [name for name in new_names
if name not in f_params]
if missing_params:
raise RuntimeError('Did not find specified parameter names %s '
'in file %s for environment %s' %
(missing_params, template_file,
env['name']))
param_names += new_names
static_defaults = {k: v for k, v in parameter_defaults.items()
if k in param_names and
k in static_names
}
parameter_defaults = {k: v for k, v in parameter_defaults.items()
if k in param_names and
k not in _PRIVATE_OVERRIDES and
not k.startswith('_') and
k not in static_names
}
for k, v in sample_values.items():
if k in parameter_defaults:
parameter_defaults[k]['sample'] = v
if k in static_defaults:
static_defaults[k]['sample'] = v
def write_sample_entry(f, name, value):
default = value.get('default')
mandatory = ''
if default is None:
mandatory = ('# Mandatory. This parameter must be set by the '
'user.\n ')
default = '<None>'
if value.get('sample') is not None:
default = value['sample']
if isinstance(default, dict):
# We need to explicitly sort these so the order doesn't change
# from one run to the next
default = json.dumps(default, sort_keys=True)
# We ultimately cast this to str for output anyway
default = str(default)
if default == '':
default = "''"
# If the default value is something like %index%, yaml won't
# parse the output correctly unless we wrap it in quotes.
# However, not all default values can be wrapped so we need to
# do it conditionally.
if default.startswith('%') or default.startswith('*'):
default = "'%s'" % default
if not default.startswith('\n'):
default = ' ' + default
values = {'name': name,
'type': value['type'],
'description':
value.get('description', '').rstrip().replace('\n',
'\n # '),
'default': default,
'mandatory': mandatory,
}
f.write(_PARAM_FORMAT % values + '\n')
target_file = os.path.join(output_path, env['name'] + '.yaml')
_create_output_dir(target_file)
with open(target_file, 'w') as env_file:
env_file.write(_FILE_HEADER)
# TODO(bnemec): Once Heat allows the title and description to live in
# the environment itself, uncomment these entries and make them
# top-level keys in the YAML.
env_title = env.get('title', '')
env_file.write(u'# title: %s\n' % env_title)
env_desc = env.get('description', '')
env_file.write(u'# description: |\n')
for line in env_desc.splitlines():
env_file.write(u'# %s\n' % line)
_index_data[target_file] = {'title': env_title,
'description': env_desc
}
if parameter_defaults:
env_file.write(u'parameter_defaults:\n')
for name, value in sorted(parameter_defaults.items()):
write_sample_entry(env_file, name, value)
if static_defaults:
env_file.write(_STATIC_MESSAGE_START)
for name, value in sorted(static_defaults.items()):
write_sample_entry(env_file, name, value)
if static_defaults:
env_file.write(_STATIC_MESSAGE_END)
if env.get('resource_registry'):
env_file.write(u'resource_registry:\n')
for res, value in sorted(env.get('resource_registry', {}).items()):
env_file.write(u' %s: %s\n' % (res, value))
print('Wrote sample environment "%s"' % target_file)
for e in env.get('children', []):
_generate_environment(e, output_path, env)
def generate_environments(config_path, output_path):
if os.path.isdir(config_path):
config_files = os.listdir(config_path)
config_files = [os.path.join(config_path, i) for i in config_files
if os.path.splitext(i)[1] == '.yaml']
else:
config_files = [config_path]
for config_file in config_files:
print('Reading environment definitions from %s' % config_file)
with open(config_file) as f:
config = yaml.safe_load(f)
for env in config['environments']:
_generate_environment(env, output_path)
def generate_index(index_path):
with open(index_path, 'w') as f:
f.write('Sample Environment Index\n')
f.write('========================\n\n')
for filename, details in sorted(_index_data.items()):
f.write(details['title'] + '\n')
f.write('-' * len(details['title']) + '\n\n')
f.write('**File:** ' + filename + '\n\n')
f.write('**Description:** ' + details['description'] + '\n\n')
def _parse_args():
parser = argparse.ArgumentParser(description='Generate Heat sample '
'environments.')
parser.add_argument('config_path',
help='Filename or directory containing the sample '
'environment definitions.')
parser.add_argument('output_path',
help='Location to write generated files.',
default='environments',
nargs='?')
parser.add_argument('--index',
help='Specify the output path for an index file '
'listing all the generated environments. '
'The file will be in RST format. '
'If not specified, no index will be generated.')
return parser.parse_args()
def main():
args = _parse_args()
generate_environments(args.config_path, args.output_path)
if args.index:
generate_index(args.index)
if __name__ == '__main__':
main()

View File

@ -1 +0,0 @@
start-env

View File

@ -1,192 +0,0 @@
#!/bin/bash
set -x
centos_ver=$(rpm --eval %{centos_ver})
if [ "$centos_ver" == "7" ] ; then
curl -o /etc/yum.repos.d/delorean.repo https://trunk.rdoproject.org/centos7/current/delorean.repo
yum install -y python2-tripleo-repos ca-certificates
tripleo-repos current-tripleo
yum install -y python-crypto python2-novaclient python2-neutronclient python2-pyghmi os-net-config python2-os-client-config python2-openstackclient
elif [ "$centos_ver" == "9" ] ; then
curl -o /etc/yum.repos.d/delorean.repo https://trunk.rdoproject.org/centos${centos_ver}-master/current-tripleo/delorean.repo
dnf install -y python3-tripleo-repos
tripleo-repos current-tripleo
dnf install -y openstack-network-scripts python3-cryptography python3-novaclient python3-pyghmi os-net-config python3-os-client-config python3-openstackclient
else
set +x
$signal_command --data-binary '{"status": "FAILURE"}'
echo "Unsupported CentOS version $centos_ver"
exit 1
fi
cat <<EOF >/usr/local/bin/openstackbmc
$openstackbmc_script
EOF
chmod +x /usr/local/bin/openstackbmc
# Configure clouds.yaml so we can authenticate to the host cloud
mkdir -p ~/.config/openstack
# Passing this as an argument is problematic because it has quotes inline that
# cause syntax errors. Reading from a file should be easier.
cat <<'EOF' >/tmp/bmc-cloud-data
$cloud_data
EOF
python -c 'import json
import sys
import yaml
with open("/tmp/bmc-cloud-data") as f:
data=json.loads(f.read())
clouds={"clouds": {"host_cloud": data}}
print(yaml.safe_dump(clouds, default_flow_style=False))' > ~/.config/openstack/clouds.yaml
rm -f /tmp/bmc-cloud-data
export OS_CLOUD=host_cloud
# python script do query the cloud and write out the bmc services/configs
$(command -v python3 || command -v python2) <<EOF
import json
import openstack
import os
import sys
cache_status = ''
if not $bmc_use_cache:
cache_status = '--cache-status'
conn = openstack.connect(cloud='host_cloud')
print('Fetching private network')
items = conn.network.networks(name='$private_net')
private_net = next(items, None)
print('Fetching private subnet')
private_subnet = conn.network.find_subnet(private_net.subnet_ids[0])
if not private_subnet:
print('[ERROR] Could not find private subnet')
sys.exit(1)
default_gw = private_subnet.gateway_ip
prefix_len = private_subnet.cidr.split('/')[1]
mtu = private_net.mtu
os_net_config = {
'network_config': [{
'type': 'interface',
'name': 'eth0',
'use_dhcp': False,
'mtu': mtu,
'routes': [{
'default': True,
'next_hop': default_gw,
}],
'addresses': [
{ 'ip_netmask': '$bmc_utility/{}'.format(prefix_len) }
]
}]
}
os_net_config_unit = """
[Unit]
Description=config-bmc-ips Service
Requires=network.target
After=network.target
[Service]
ExecStart=/bin/os-net-config -c /etc/os-net-config/config.json -v
Type=oneshot
User=root
StandardOutput=kmsg+console
StandardError=inherit
[Install]
WantedBy=multi-user.target
"""
print('Writing out config-bmc-ips.service')
with open('/usr/lib/systemd/system/config-bmc-ips.service', 'w') as f:
f.write(os_net_config_unit)
print('Fetching bm ports')
bmc_port_names = [('$bmc_prefix_{}'.format(x), '$bm_prefix_{}'.format(x)) for x in range(0, $bm_node_count)]
bmc_ports = {}
for (bmc_port_name, bm_port_name) in bmc_port_names:
print('Finding {} port'.format(bmc_port_name))
bmc_ports[bmc_port_name] = conn.network.find_port(bmc_port_name)
print('Finding {} port'.format(bm_port_name))
bmc_ports[bm_port_name] = conn.network.find_port(bm_port_name)
unit_template = """
[Unit]
Description=openstack-bmc {port_name} Service
Requires=config-bmc-ips.service
After=config-bmc-ips.service
[Service]
ExecStart=/usr/local/bin/openstackbmc --os-cloud host_cloud --instance {port_instance} --address {port_ip} {cache_status}
Restart=always
User=root
StandardOutput=kmsg+console
StandardError=inherit
[Install]
WantedBy=multi-user.target
"""
for (bmc_port_name, bm_port_name) in bmc_port_names:
port_name = bm_port_name
unit_file = os.path.join('/usr/lib/systemd/system', 'openstack-bmc-{}.service'.format(port_name))
device_id = bmc_ports[bm_port_name].device_id
port = bmc_ports[bmc_port_name]
if isinstance(port.fixed_ips, list):
port_ip = port.fixed_ips[0].get('ip_address')
else:
# TODO: test older openstacksdk
port_ip = port.fixed_ips.split('\'')[1]
print('Writing out {}'.format(unit_file))
with open(unit_file, "w") as unit:
unit.write(unit_template.format(port_name=port_name,
port_instance=device_id,
port_ip=port_ip,
cache_status=cache_status))
addr = { 'ip_netmask': '{}/{}'.format(port_ip, prefix_len) }
os_net_config['network_config'][0]['addresses'].append(addr)
if not os.path.isdir('/etc/os-net-config'):
os.mkdir('/etc/os-net-config')
print('Writing /etc/os-net-config/config.json')
with open('/etc/os-net-config/config.json', 'w') as f:
json.dump(os_net_config, f)
EOF
# reload systemd
systemctl daemon-reload
# enable and start bmc ip service
systemctl enable config-bmc-ips
systemctl start config-bmc-ips
# enable bmcs
for i in $(seq 1 $bm_node_count)
do
unit="openstack-bmc-$bm_prefix_$(($i-1)).service"
systemctl enable $unit
systemctl start $unit
done
sleep 5
if ! systemctl is-active openstack-bmc-* >/dev/null
then
systemctl status openstack-bmc-*
set +x
$signal_command --data-binary '{"status": "FAILURE"}'
echo "********** $unit failed to start **********"
exit 1
fi
set +x
$signal_command --data-binary '{"status": "SUCCESS"}'

View File

@ -1,18 +0,0 @@
#!/bin/bash
set -ex
JOBS=${1:-1}
DELAY=${2:-60}
BIN_DIR=$(cd $(dirname $0); pwd -P)
for i in $(seq $JOBS)
do
jobid=$(uuidgen | md5sum)
jobid=${jobid:1:8}
date
echo "Starting job $jobid, logging to /tmp/$jobid.log"
$BIN_DIR/test-job $jobid > /tmp/$jobid.log 2>&1 &
sleep $DELAY
done

View File

@ -1 +0,0 @@
../openstack_virtual_baremetal/openstackbmc.py

View File

@ -1,130 +0,0 @@
#!/bin/bash
function timer
{
name=${1:-}
seconds=$(date +%s)
if [ -n "$name" ]
then
echo "${name}: $((seconds - start_time))" >> ~/timer-results
else
start_time=$seconds
fi
}
set -ex
timer
# When not running my local cloud we don't want these set
if [ ${LOCAL:-1} -eq 1 ]
then
export http_proxy=http://roxy:3128
curl -O http://openstack/CentOS-7-x86_64-GenericCloud-1901.qcow2
export DIB_LOCAL_IMAGE=CentOS-7-x86_64-GenericCloud-1901.qcow2
export DIB_DISTRIBUTION_MIRROR=http://mirror.centos.org/centos
export no_proxy=192.168.24.1,192.168.24.2,192.168.24.3,127.0.0.1
fi
# Set up the undercloud in preparation for running the deployment
sudo yum install -y git wget
rm -rf git-tripleo-ci
git clone https://git.openstack.org/openstack-infra/tripleo-ci git-tripleo-ci
echo '#!/bin/bash' > tripleo.sh
echo 'git-tripleo-ci/scripts/tripleo.sh $@' >> tripleo.sh
chmod +x tripleo.sh
if [ ! -d overcloud-templates ]
then
git clone https://git.openstack.org/openstack/openstack-virtual-baremetal
cp -r openstack-virtual-baremetal/overcloud-templates .
fi
export OVERCLOUD_PINGTEST_OLD_HEATCLIENT=0
export TRIPLEOSH=/home/centos/tripleo.sh
# Do the tripleo deployment
# Repo setup
wget -r --no-parent -nd -e robots=off -l 1 -A 'python2-tripleo-repos-*' https://trunk.rdoproject.org/centos7/current/
sudo yum install -y python2-tripleo-repos-*
sudo tripleo-repos -b rocky current --rdo-mirror http://mirror.regionone.rdo-cloud.rdoproject.org:8080/rdo --mirror http://mirror.regionone.rdo-cloud.rdoproject.org
timer 'system setup'
timer
# Undercloud install
cat << EOF > undercloud.conf
[DEFAULT]
undercloud_hostname=undercloud.localdomain
enable_telemetry = false
enable_legacy_ceilometer_api = false
enable_ui = false
enable_validations = false
enable_tempest = false
local_mtu = 1450
[ctlplane-subnet]
masquerade = true
EOF
sudo yum install -y python-tripleoclient
openstack undercloud install
. stackrc
# Undercloud networking
cat >> /tmp/eth2.cfg <<EOF_CAT
network_config:
- type: interface
name: eth2
use_dhcp: false
mtu: 1450
addresses:
- ip_netmask: 10.0.0.1/24
- ip_netmask: 2001:db8:fd00:1000::1/64
EOF_CAT
sudo os-net-config -c /tmp/eth2.cfg -v
sudo iptables -A POSTROUTING -s 10.0.0.0/24 ! -d 10.0.0.0/24 -j MASQUERADE -t nat
sudo iptables -I FORWARD -s 10.0.0.0/24 -j ACCEPT
sudo iptables -I FORWARD -d 10.0.0.0/24 -j ACCEPT
timer 'undercloud install'
timer
# Image creation
export DIB_YUM_REPO_CONF="/etc/yum.repos.d/delorean*"
openstack overcloud image build
openstack overcloud image upload --update-existing
timer 'image build'
timer
# Node registration and introspection
openstack overcloud node import --introspect --provide instackenv.json
timer 'node introspection'
sleep 60
timer
# Overcloud deploy
export OVERCLOUD_DEPLOY_ARGS="--libvirt-type qemu -e /usr/share/openstack-tripleo-heat-templates/environments/disable-telemetry.yaml"
if [ ${VERSION:-1} -eq 2 ]
then
OVERCLOUD_DEPLOY_ARGS="$OVERCLOUD_DEPLOY_ARGS -e /home/centos/overcloud-templates/network-templates-v2/network-isolation-absolute.yaml -e /home/centos/overcloud-templates/network-templates-v2/network-environment.yaml"
fi
openstack overcloud deploy --templates $OVERCLOUD_DEPLOY_ARGS
timer 'overcloud deploy'
timer
# Overcloud validation
if [ ${VERSION:-1} -eq 2 ]
then
export FLOATING_IP_CIDR=10.0.0.0/24
export FLOATING_IP_START=10.0.0.50
export FLOATING_IP_END=10.0.0.70
export EXTERNAL_NETWORK_GATEWAY=10.0.0.1
fi
$TRIPLEOSH --overcloud-pingtest --skip-pingtest-cleanup
timer 'ping test'
cat ~/timer-results

View File

@ -1,26 +0,0 @@
#!/bin/bash
# Script to rebuild baremetal instances to the ipxe-boot image.
# When using OVB without the Nova PXE boot patch, this is required after
# each deployment to ensure the nodes can PXE boot for the next one.
# Usage: rebuild-baremetal <number of nodes> [baremetal_base] [environment ID]
# Examples: rebuild-baremetal 2
# rebuild-baremetal 5 my-baremetal-name
# rebuild-baremetal 5 baremetal test
node_num=$1
baremetal_base=${2:-'baremetal'}
env_id=${3:-}
name_base="$baremetal_base"
if [ -n "$env_id" ]
then
name_base="$baremetal_base-$env_id"
fi
for i in `seq 0 $((node_num - 1))`
do
echo nova rebuild "${instance_list}${name_base}_$i" ipxe-boot
nova rebuild "${instance_list}${name_base}_$i" ipxe-boot
done

View File

@ -1,7 +0,0 @@
#!/bin/bash
# Usage: start-env <ID>
# Example: start-env test
# This will start the undercloud-test and bmc-test instances
nova start bmc-$1 undercloud-$1

View File

@ -1,8 +0,0 @@
#!/bin/bash
# Usage: stop-env <ID>
# Example: stop-env test
# This will stop the undercloud and bmc, as well as up to 5 baremetal instances
# TODO: Make this smarter so it will handle an arbitrary number of baremetal instances
nova stop undercloud-$1 bmc-$1 baremetal-$1_0 baremetal-$1_1 baremetal-$1_2 baremetal-$1_3 baremetal-$1_4

View File

@ -1,76 +0,0 @@
#!/bin/bash
# Edit these to match your environment
BMC_IMAGE=bmc-base
BMC_FLAVOR=bmc
KEY_NAME=default
UNDERCLOUD_IMAGE=centos7-base
UNDERCLOUD_FLAVOR=undercloud-16
BAREMETAL_FLAVOR=baremetal
EXTERNAL_NET=external
# Set to 0 if you're not running in bnemec's private cloud
LOCAL=1
set -ex
date
start_seconds=$(date +%s)
BIN_DIR=$(cd $(dirname $0); pwd -P)
MY_ID=$1
BMC_PREFIX=bmc-$MY_ID
BAREMETAL_PREFIX=baremetal-$MY_ID
UNDERCLOUD_NAME=undercloud-$MY_ID
PUBLIC_NET=public-$MY_ID
PROVISION_NET=provision-$MY_ID
PRIVATE_NET=private-$MY_ID
# NOTE(bnemec): I'm intentionally not adding a trap to clean this up because
# if something fails it may be helpful to look at the contents of the tempdir.
TEMPDIR=$(mktemp -d)
echo "Working in $TEMPDIR"
cd $TEMPDIR
cp -r $BIN_DIR/../templates .
cp templates/env.yaml.example ./env.yaml
sed -i "s/bmc_image: .*/bmc_image: $BMC_IMAGE/" env.yaml
sed -i "s/bmc_flavor: .*/bmc_flavor: $BMC_FLAVOR/" env.yaml
sed -i "s/key_name: .*/key_name: $KEY_NAME/" env.yaml
sed -i "s/baremetal_flavor: .*/baremetal_flavor: $BAREMETAL_FLAVOR/" env.yaml
sed -i "s/undercloud_image: .*/undercloud_image: $UNDERCLOUD_IMAGE/" env.yaml
sed -i "s/undercloud_flavor: .*/undercloud_flavor: $UNDERCLOUD_FLAVOR/" env.yaml
sed -i "s|external_net: .*|external_net: $EXTERNAL_NET|" env.yaml
sed -i "s/private_net: .*/private_net: $PRIVATE_NET/" env.yaml
if [ $LOCAL -eq 1 ]
then
echo 'parameter_defaults:' >> env.yaml
echo ' dns_nameservers: 11.1.1.1' >> env.yaml
fi
echo 'resource_registry:' >> env.yaml
echo ' OS::OVB::UndercloudFloating: templates/undercloud-floating.yaml' >> env.yaml
echo ' OS::OVB::BaremetalPorts: templates/baremetal-ports-default.yaml' >> env.yaml
echo ' OS::OVB::BMCPort: templates/bmc-port.yaml' >> env.yaml
echo ' OS::OVB::UndercloudPorts: templates/undercloud-ports.yaml' >> env.yaml
echo ' OS::OVB::PrivateNetwork: templates/private-net-create.yaml' >> env.yaml
cp -r $BIN_DIR ./bin
cp -r $BIN_DIR/../openstack_virtual_baremetal .
STACK_NAME=$MY_ID
$BIN_DIR/deploy.py --quintupleo --id $MY_ID --name $STACK_NAME --poll
UNDERCLOUD_IP=$(heat output-show $STACK_NAME undercloud_host_floating_ip | sed -e 's/"//g')
bin/build-nodes-json --env env-$MY_ID.yaml --driver ipmi
#bin/build-nodes-json --bmc_prefix $BMC_PREFIX --baremetal_prefix $BAREMETAL_PREFIX --provision_net $PROVISION_NET
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=Verbose -o PasswordAuthentication=no -o ConnectionAttempts=32 "
# Canary command to make sure the undercloud is ready
until ssh -t -t $SSH_OPTS centos@$UNDERCLOUD_IP ls; do sleep 1; done
scp $SSH_OPTS bin/ovb-instack centos@$UNDERCLOUD_IP:/tmp
scp $SSH_OPTS nodes.json centos@$UNDERCLOUD_IP:~/instackenv.json
ssh -t -t $SSH_OPTS centos@$UNDERCLOUD_IP LOCAL=$LOCAL /tmp/ovb-instack
heat stack-delete -y $STACK_NAME
date
end_seconds=$(date +%s)
elapsed_seconds=$(($end_seconds - $start_seconds))
echo "Finished in $elapsed_seconds seconds"
rm -rf $TEMPDIR

View File

@ -1,71 +0,0 @@
#!/bin/bash
# Edit these to match your environment
BMC_IMAGE=bmc-base
BMC_FLAVOR=bmc
KEY_NAME=default
UNDERCLOUD_IMAGE=centos7-base
UNDERCLOUD_FLAVOR=undercloud-16
BAREMETAL_FLAVOR=baremetal
EXTERNAL_NET=external
# Set to 0 if you're not running in bnemec's private cloud
LOCAL=1
set -ex
date
start_seconds=$(date +%s)
BIN_DIR=$(cd $(dirname $0); pwd -P)
MY_ID=$1
BMC_PREFIX=bmc-$MY_ID
BAREMETAL_PREFIX=baremetal-$MY_ID
UNDERCLOUD_NAME=undercloud-$MY_ID
PUBLIC_NET=public-$MY_ID
PROVISION_NET=provision-$MY_ID
PRIVATE_NET=private-$MY_ID
# NOTE(bnemec): I'm intentionally not adding a trap to clean this up because
# if something fails it may be helpful to look at the contents of the tempdir.
TEMPDIR=$(mktemp -d)
echo "Working in $TEMPDIR"
cd $TEMPDIR
cp -r $BIN_DIR/../templates .
cp -r $BIN_DIR/../environments .
cp -r $BIN_DIR/../overcloud-templates .
cp environments/base.yaml ./env.yaml
sed -i "s/bmc_image: .*/bmc_image: $BMC_IMAGE/" env.yaml
sed -i "s/bmc_flavor: .*/bmc_flavor: $BMC_FLAVOR/" env.yaml
sed -i "s/key_name: .*/key_name: $KEY_NAME/" env.yaml
sed -i "s/baremetal_flavor: .*/baremetal_flavor: $BAREMETAL_FLAVOR/" env.yaml
sed -i "s/undercloud_image: .*/undercloud_image: $UNDERCLOUD_IMAGE/" env.yaml
sed -i "s/undercloud_flavor: .*/undercloud_flavor: $UNDERCLOUD_FLAVOR/" env.yaml
sed -i "s|external_net: .*|external_net: $EXTERNAL_NET|" env.yaml
sed -i "s/private_net: .*/private_net: $PRIVATE_NET/" env.yaml
if [ $LOCAL -eq 1 ]
then
sed -i "s/dns_nameservers: .*/dns_nameservers: 11.1.1.1/" environments/create-private-network.yaml
fi
cp -r $BIN_DIR ./bin
cp -r $BIN_DIR/../openstack_virtual_baremetal .
STACK_NAME=$MY_ID
$BIN_DIR/deploy.py --quintupleo --id $MY_ID --name $STACK_NAME --poll -e env.yaml -e environments/create-private-network.yaml -e environments/all-networks.yaml
UNDERCLOUD_IP=$(heat output-show $STACK_NAME undercloud_host_floating_ip | sed -e 's/"//g')
bin/build-nodes-json --env env-$MY_ID.yaml --driver ipmi
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=Verbose -o PasswordAuthentication=no -o ConnectionAttempts=32 "
# Canary command to make sure the undercloud is ready
until ssh -t -t $SSH_OPTS centos@$UNDERCLOUD_IP ls; do sleep 1; done
scp $SSH_OPTS bin/ovb-instack centos@$UNDERCLOUD_IP:/tmp
scp $SSH_OPTS nodes.json centos@$UNDERCLOUD_IP:~/instackenv.json
scp $SSH_OPTS -r overcloud-templates centos@$UNDERCLOUD_IP:~
ssh -t -t $SSH_OPTS centos@$UNDERCLOUD_IP LOCAL=$LOCAL VERSION=2 /tmp/ovb-instack
heat stack-delete -y $STACK_NAME
date
end_seconds=$(date +%s)
elapsed_seconds=$(($end_seconds - $start_seconds))
echo "Finished in $elapsed_seconds seconds"
rm -rf $TEMPDIR

View File

@ -1,8 +0,0 @@
sphinx!=1.6.6,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,>=1.6.2;python_version>='3.4' # BSD
sphinx_rtd_theme
PyYAML
os_client_config
python-heatclient
python-novaclient
pyghmi

View File

@ -1,28 +0,0 @@
Python API
==========
build_nodes_json
----------------
.. automodule:: build_nodes_json
:members:
:private-members:
deploy
------
.. automodule:: deploy
:members:
:private-members:
openstackbmc
------------
.. autoclass:: openstackbmc.OpenStackBmc
:members:
auth
------
.. automodule:: auth
:members:
:private-members:

View File

@ -1,125 +0,0 @@
# openstack-virtual-baremetal documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 25 10:56:57 2015.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
import sphinx_rtd_theme
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../../openstack_virtual_baremetal'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.autosectionlabel',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = []
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'OpenStack Virtual Baremetal'
copyright = u'2015, Red Hat Inc.'
bug_tracker = u'Launchpad'
bug_tracker_url = u'https://bugs.launchpad.net/tripleo/'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.0.1'
# The full version, including alpha/beta/rc tags.
release = '0.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
html_theme = 'sphinx_rtd_theme'
html_static_path = []
# html_style = 'custom.css'
templates_path = []
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
rst_prolog = """
.. |project| replace:: %s
.. |bug_tracker| replace:: %s
.. |bug_tracker_url| replace:: %s
""" % (project, bug_tracker, bug_tracker_url)

View File

@ -1,121 +0,0 @@
Deploying a Standalone Baremetal Stack
======================================
The process described here will create a very minimal OVB environment, and the
user will be responsible for creating most of the resources manually. In most
cases it will be easier to use the :doc:`QuintupleO <quintupleo>` deployment
method, which creates most of the resources needed automatically.
#. Create private network.
If your cloud provider has already created a private network for your use
then you can skip this step and reference the existing network in your
OVB environment file.
::
neutron net-create private
neutron subnet-create --name private private 10.0.1.0/24 --dns-nameserver 8.8.8.8
You will also need to create a router so traffic from your private network
can get to the external network. The external network should have been
created by the cloud provider::
neutron router-create router
neutron router-gateway-set router [external network name or id]
neutron router-interface-add router private
#. Create provisioning network.
.. note:: The CIDR used for the subnet does not matter.
Standard tenant and external networks are also needed to
provide floating ip access to the undercloud and bmc instances
.. warning:: Do not enable DHCP on this network. Addresses will be
assigned by the undercloud Neutron.
::
neutron net-create provision
neutron subnet-create --name provision --no-gateway --disable-dhcp provision 192.168.24.0/24
#. Create "public" network.
.. note:: The CIDR used for the subnet does not matter.
This can be used as the network for the public API endpoints
on the overcloud, but it does not have to be accessible
externally. Only the undercloud VM will need to have access
to this network.
.. warning:: Do not enable DHCP on this network. Doing so may cause
conflicts between the host cloud metadata service and the
undercloud metadata service. Overcloud nodes will be
assigned addresses on this network by the undercloud Neutron.
::
neutron net-create public
neutron subnet-create --name public --no-gateway --disable-dhcp public 10.0.0.0/24
#. Copy the example env file and edit it to reflect the host environment:
.. note:: Some of the parameters in the base environment file are only
used for QuintupleO deployments. Their values will be ignored
in a plain virtual-baremetal deployment.
::
cp environments/base.yaml env.yaml
vi env.yaml
#. Deploy the stack::
bin/deploy.py
#. Wait for Heat stack to complete:
.. note:: The BMC instance does post-deployment configuration that can
take a while to complete, so the Heat stack completing does
not necessarily mean the environment is entirely ready for
use. To determine whether the BMC is finished starting up,
run ``nova console-log bmc``. The BMC service outputs a
message like "Managing instance [uuid]" when it is fully
configured. There should be one of these messages for each
baremetal instance.
::
heat stack-show baremetal
#. Boot a VM to serve as the undercloud::
nova boot undercloud --flavor m1.xlarge --image centos7 --nic net-id=[tenant net uuid] --nic net-id=[provisioning net uuid]
neutron floatingip-create [external net uuid]
neutron port-list
neutron floatingip-associate [floatingip uuid] [undercloud instance port id]
#. Turn off port-security on the undercloud provisioning port::
neutron port-update [UUID of undercloud port on the provision network] --no-security-groups --port-security-enabled=False
#. Build a nodes.json file that can be imported into Ironic::
bin/build-nodes-json
scp nodes.json centos@[undercloud floating ip]:~/instackenv.json
.. note:: ``build-nodes-json`` also outputs a file named ``bmc_bm_pairs``
that lists which BMC address corresponds to a given baremetal
instance.
#. The undercloud vm can now be used with something like TripleO
to do a baremetal-style deployment to the virtual baremetal instances
deployed previously.
Deleting an OVB Environment
---------------------------
All of the OpenStack resources created by OVB are part of the Heat stack, so
to delete the environment just delete the Heat stack. There are a few local
files that may also have been created as part of the deployment, such as
nodes.json files and bmc_bm_pairs. Once the stack is deleted these can be
removed safely as well.

View File

@ -1,11 +0,0 @@
Deploying the Heat stack
========================
There are two options for deploying the Heat stack.
.. toctree::
quintupleo
baremetal
heterogeneous
environment-index

View File

@ -1,216 +0,0 @@
Sample Environment Index
========================
Deploy with All Networks Enabled and Two Public Interfaces
----------------------------------------------------------
**File:** environments/all-networks-public-bond.yaml
**Description:** Deploy an OVB stack that adds interfaces for all the standard TripleO
network isolation networks. This version will deploy duplicate
public network interfaces on the baremetal instances so that the
public network can be configured as a bond.
Deploy with All Networks Enabled
--------------------------------
**File:** environments/all-networks.yaml
**Description:** Deploy an OVB stack that adds interfaces for all the standard TripleO
network isolation networks.
Base Configuration Options for Extra Nodes with All Ports Open
--------------------------------------------------------------
**File:** environments/base-extra-node-all.yaml
**Description:** Configuration options that need to be set when deploying an OVB
environment with extra undercloud-like nodes. This environment
should be used like a role file, but will deploy an undercloud-like
node instead of more baremetal nodes.
Base Configuration Options for Extra Nodes
------------------------------------------
**File:** environments/base-extra-node.yaml
**Description:** Configuration options that need to be set when deploying an OVB
environment with extra undercloud-like nodes. This environment
should be used like a role file, but will deploy an undercloud-like
node instead of more baremetal nodes.
Base Configuration Options for Secondary Roles
----------------------------------------------
**File:** environments/base-role.yaml
**Description:** Configuration options that need to be set when deploying an OVB
environment that has multiple roles.
Base Configuration Options
--------------------------
**File:** environments/base.yaml
**Description:** Basic configuration options needed for all OVB environments
Enable Instance Status Caching in BMC
-------------------------------------
**File:** environments/bmc-use-cache.yaml
**Description:** Enable caching of instance status in the BMC. This should reduce load on
the host cloud, but at the cost of potential inconsistency if the state
of a baremetal instance is changed without using the BMC.
Boot Baremetal Instances from Volume
------------------------------------
**File:** environments/boot-baremetal-from-volume.yaml
**Description:** Boot the baremetal instances from Cinder volumes instead of
ephemeral storage.
Boot Undercloud and Baremetal Instances from Volume
---------------------------------------------------
**File:** environments/boot-from-volume.yaml
**Description:** Boot the undercloud and baremetal instances from Cinder volumes instead of
ephemeral storage.
Boot Undercloud Instance from Volume
------------------------------------
**File:** environments/boot-undercloud-from-volume.yaml
**Description:** Boot the undercloud instance from a Cinder volume instead of
ephemeral storage.
Create a Private Network
------------------------
**File:** environments/create-private-network.yaml
**Description:** Create the private network as part of the OVB stack instead of using an
existing one.
Disable BMC
-----------
**File:** environments/disable-bmc.yaml
**Description:** Deploy a stack without a BMC. This will obviously make it impossible to
control the instances via IPMI. It will also prevent use of
ovb-build-nodes-json because there will be no BMC addresses.
Configuration for router advertisement daemon (radvd)
-----------------------------------------------------
**File:** environments/ipv6-radvd-configuration.yaml
**Description:** Contains the available parameters that need to be configured when using
a IPv6 network. Requires the ipv6-radvd.yaml environment.
Enable router advertisement daemon (radvd)
------------------------------------------
**File:** environments/ipv6-radvd.yaml
**Description:** Deploy the stack with a router advertisement daemon running for the
provisioning network.
Public Network External Router
------------------------------
**File:** environments/public-router.yaml
**Description:** Deploy a router that connects the public and external networks. This
allows the public network to be used as a gateway instead of routing all
traffic through the undercloud.
Disable the Undercloud in a QuintupleO Stack
--------------------------------------------
**File:** environments/quintupleo-no-undercloud.yaml
**Description:** Deploy a QuintupleO environment, but do not create the undercloud
instance.
Configuration for Routed Networks
---------------------------------
**File:** environments/routed-networks-configuration.yaml
**Description:** Contains the available parameters that need to be configured when using
a routed networks environment. Requires the routed-networks.yaml or
routed-networks-ipv6.yaml environment.
Enable Routed Networks IPv6
---------------------------
**File:** environments/routed-networks-ipv6.yaml
**Description:** Enable use of routed IPv6 networks, where there may be multiple separate
networks connected with a router, router advertisement daemon (radvd),
and DHCP relay. Do not pass any other network configuration environments
after this one or they may override the changes made by this environment.
When this environment is in use, the routed-networks-configuration
environment should usually be included as well.
Base Role Configuration for Routed Networks
-------------------------------------------
**File:** environments/routed-networks-role.yaml
**Description:** A base role environment that contains the necessary parameters for
deploying with routed networks.
Enable Routed Networks
----------------------
**File:** environments/routed-networks.yaml
**Description:** Enable use of routed networks, where there may be multiple separate
networks connected with a router and DHCP relay. Do not pass any other
network configuration environments after this one or they may override
the changes made by this environment. When this environment is in use,
the routed-networks-configuration environment should usually be
included as well.
Assign the Undercloud an Existing Floating IP
---------------------------------------------
**File:** environments/undercloud-floating-existing.yaml
**Description:** When deploying the undercloud, assign it an existing floating IP instead
of creating a new one.
Do Not Assign a Floating IP to the Undercloud
---------------------------------------------
**File:** environments/undercloud-floating-none.yaml
**Description:** When deploying the undercloud, do not assign a floating ip to it.

View File

@ -1,54 +0,0 @@
Deploying Heterogeneous Environments
====================================
It is possible to deploy an OVB environment with multiple "baremetal"
node types. The :doc:`QuintupleO <quintupleo>` deployment method must be used, so it
would be best to start with a working configuration for that before
moving on to heterogeneous deployments.
Each node type will be identified as a ``role``. A simple QuintupleO
deployment can be thought of as a single-role deployment. To deploy
multiple roles, additional environment files describing the extra roles
are required. These environments are simplified versions of the
standard environment file. See ``environments/base-role.yaml``
for a starting point when writing these role files.
.. note:: Each extra role consists of exactly one environment file. This
means that the standalone option environments cannot be used with
roles. To override the options specified for the primary role in
a secondary role, the parameter_defaults and resource_registry
entries from the option environment must be copied into the role
environment.
However, note that most resource_registry entries are filtered out
of role environments anyway since they are not relevant for a
secondary stack.
Steps for deploying the environment:
#. Customize the environment files. Make sure all environments have a ``role``
key in the ``parameter_defaults`` section. When building nodes.json, this
role will be automatically assigned to the node, so it is simplest to use
one of the default TripleO roles (control, compute, cephstorage, etc.).
#. Deploy with both roles::
bin/deploy.py --quintupleo --env env-control.yaml --role env-compute.yaml
#. One Heat stack will be created for each role being deployed. Wait for them
all to complete before proceeding.
.. note:: Be aware that the extra role stacks will be connected to networks
in the primary role stack, so the extra stacks must be deleted
before the primary one or the neutron subnets will not delete cleanly.
#. Build a nodes.json file that can be imported into Ironic::
bin/build-nodes-json --env env-control.yaml
.. note:: Only the primary environment file needs to be passed here. The
resources deployed as part of the secondary roles will be named
such that they appear to be part of the primary environment.
.. note:: If ``--id`` was used when deploying, remember to pass the generated
environment file to this command instead of the original.

View File

@ -1,306 +0,0 @@
Deploying with QuintupleO
=========================
QuintupleO is short for OpenStack on OpenStack on OpenStack. It was the
original name for OVB, and has been repurposed to indicate that this
deployment method is able to deploy a full TripleO development environment
in one command. It should be useful for non-TripleO users of OVB as well,
however.
#. Copy the example env file and edit it to reflect the host environment::
cp environments/base.yaml env.yaml
vi env.yaml
#. Deploy a QuintupleO stack. The example command includes a number of
environment files intended to simplify the deployment process or make
it compatible with a broader set of host clouds. However, these
environments are not necessary in every situation and may not even work
with some older clouds. See below for details on customizing an OVB
deployment for your particular situation::
bin/deploy.py --quintupleo -e env.yaml -e environments/all-networks.yaml -e environments/create-private-network.yaml
.. note:: There is a quintupleo-specific option ``--id`` in deploy.py.
It appends the value passed in to the name of all resources
in the stack. For example, if ``undercloud_name`` is set to
'undercloud' and ``--id foo`` is passed to deploy.py, the
resulting undercloud VM will be named 'undercloud-foo'. It is
recommended that this be used any time multiple environments are
being deployed in the same cloud/tenant to avoid name collisions.
Be aware that when ``--id`` is used, a new environment file will
be generated that reflects the new names. The name of the new
file will be ``env-${id}.yaml``. This new file should be passed
to build-nodes-json instead of the original.
.. note:: See :ref:`advanced-options` for other ways to customize an OVB
deployment.
#. Wait for Heat stack to complete. To make this easier, the ``--poll``
option can be passed to ``deploy.py``.
.. note:: The BMC instance does post-deployment configuration that can
take a while to complete, so the Heat stack completing does
not necessarily mean the environment is entirely ready for
use. To determine whether the BMC is finished starting up,
run ``nova console-log bmc``. The BMC service outputs a
message like "Managing instance [uuid]" when it is fully
configured. There should be one of these messages for each
baremetal instance.
::
heat stack-show quintupleo
#. Build a nodes.json file that can be imported into Ironic::
bin/build-nodes-json
scp nodes.json centos@[undercloud floating ip]:~/instackenv.json
.. note:: Only the base environment file needs to be passed to this command.
Additional option environments that may have been passed to the
deploy command should *not* be included here.
.. note:: If ``--id`` was used to deploy the stack, make sure to pass the
generated ``env-${id}.yaml`` file to build-nodes-json using the
``--env`` parameter. Example::
bin/build-nodes-json --env env-foo.yaml
.. note:: If roles were used for the deployment, separate node files named
``nodes-<profile>.json`` will also be output that list only the
nodes for that particular profile. Nodes with no profile
specified will go in ``nodes-no-profile.json``. The base
``nodes.json`` will still contain all of the nodes in the
deployment, regardless of profile.
.. note:: ``build-nodes-json`` also outputs a file named ``bmc_bm_pairs``
that lists which BMC address corresponds to a given baremetal
instance.
Deleting a QuintupleO Environment
---------------------------------
All of the OpenStack resources created by OVB are part of the Heat stack, so
to delete the environment just delete the Heat stack. There are a few local
files that may also have been created as part of the deployment, such as
ID environment files, nodes.json files, and bmc_bm_pairs. Once the stack is
deleted these can be removed safely as well.
.. _advanced-options:
Advanced Options
----------------
There are also a number of advanced options that can be enabled for a
QuintupleO deployment. For each such option there is a sample environment
to be passed to the deploy command.
For example, to deploy all networks needed for TripleO network isolation, the
following command could be used::
bin/deploy.py --quintupleo -e env.yaml -e environments/all-networks.yaml
.. important:: When deploying with multiple environment files, ``env.yaml``
*must* be explicitly passed to the deploy command.
``deploy.py`` will only default to using ``env.yaml`` if no
environments are specified.
Some options may have additional configuration parameters. These parameters
will be listed in the environment file.
A full list of the environments available can be found at
:doc:`environment-index`.
Network Isolation
-----------------
There are a number of environments related to enabling the network isolation
functionality in OVB. These environments are named ``all-networks*.yaml``
and cause OVB to deploy additional network interfaces on the baremetal
instances that allow the use of TripleO's network isolation.
.. note:: There are templates suitable for doing a TripleO overcloud deployment
with network isolation in the ``overcloud-templates`` directory. See
the readme files in those directories for details on how to use them.
The v2 versions of the templates are suitable for use with the
TripleO Ocata release and later. The others can be used in Newton
and earlier.
Three primary networking layouts are included:
* Basic. This is the default and will only deploy a provisioning interface to
the baremetal nodes. It is not suitable for use with network isolation.
* All Networks. This will deploy an interface per isolated network to the
baremetal instances. It is suitable for use with any of the overcloud
network isolation templates not starting with 'bond'.
* All Networks, Public Bond. This will also deploy an interface per isolated
network to the baremetal instances, but it will additionally deploy a second
interface for the 'public' network that can be used to test bonding in an
OVB environment. The ``bond-*`` overcloud templates must be used with this
type of environment.
QuintupleO and routed networks
------------------------------
TripleO supports deploying OpenStack with nodes on multiple network segments
which is connected via L3 routing. OVB can set up a full development
environment with routers and DHCP-relay service. This environment is targeted
for TripleO development, however it should be useful for non-TripleO users of
OVB as well.
#. When deploying QuintupleO with routed networks environment files to enable
routed networks must be included, as well as one or more role environment
files. See :ref:`Enable Routed Networks`,
:ref:`Configuration for Routed Networks`, and
:ref:`Base Role Configuration for Routed Networks` in the
:doc:`environment-index` for details.
#. Copy the example env file and edit it to reflect the host environment::
cp environments/base.yaml env.yaml
vi env.yaml
#. Copy the ``routed-networks-configuration.yaml`` sample environment file and
edit it to reflect the host environment::
cp environments/routed-networks-configuration.yaml env-routed-networks.yaml
vi env-routed-networks.yaml
#. For each desired role, copy the ``routed-networks-role.yaml`` sample
environment file and edit it to reflect the host environment::
cp environments/routed-networks-role.yaml env-leaf1.yaml
vi env-leaf1.yaml
#. Deploy the QuintupleO routed networks environment by running the deploy.py
command. For example::
./bin/deploy.py --env env.yaml \
--quintupleo \
--env environments/all-networks.yaml \
--env environments/routed-networks.yaml \
--env env-routed-networks.yaml \
--role env-leaf1.yaml
#. When generating the ``nodes.json`` file for TripleO undercloud node import,
the environment ``env-routed.yaml`` should be specified. Also, to include
physical network attributes of the node ports in ``nodes.json`` specify the
``--physical_network`` option when running ``build-nodes-json``. For
example::
bin/build-nodes-json --physical_network
The following is an example node definition produced when using the
``--physical_network`` options. Notice that ports are defined with both
``address`` and ``physical_network`` attributes.
::
{
"pm_password": "password",
"name": "baremetal-leaf1-0",
"memory": 8192,
"pm_addr": "10.0.1.13",
"ports": [
{
"physical_network": "provision2",
"address": "fa:16:3e:2f:a1:cf"
}
],
"capabilities": "boot_option:local,profile:leaf1",
"pm_type": "pxe_ipmitool",
"disk": 80,
"arch": "x86_64",
"cpu": 4,
"pm_user": "admin"
}
.. NOTE:: Due to technical debet (backward compatibility) the TripleO
Undercloud uses ``ctlplane`` as the physical network name for the
subnet that is local to the Undercloud itself. Either override
the name of the provision network in the ovb environment by
setting: ``provision_net: ctlplane`` in the
``parameters_defaults`` section or edit the generated nodes.json
file, replacing:
``"physical_network": "<name-used-for-provision_net>"`` with
``"physical_network": "ctlplane"``.
#. For convenience router addresses are made available via the
``network_environment_data`` key in the stack output of the quintupleo heat
stack. To retrieve this data run the ``openstack stack show`` command. For
example::
$ openstack stack show quintupleo -c outputs -f yaml
outputs:
- description: floating ip of the undercloud instance
output_key: undercloud_host_floating_ip
output_value: 38.145.35.98
- description: Network environment data, router addresses etc.
output_key: network_environment_data
output_value:
internal2_router: 172.17.1.204
internal_router_address: 172.17.0.201
provision2_router: 192.168.25.254
provision3_router: 192.168.26.254
provision_router: 192.168.24.254
storage2_router_address: 172.18.1.254
storage_mgmt2_router_address: 172.19.1.254
storage_mgmt_router_address: 172.19.0.254
storage_router_address: 172.18.0.254
tenant2_router_address: 172.16.1.254
tenant_router_address: 172.16.0.254
- description: ip of the undercloud instance on the private network
output_key: undercloud_host_private_ip
output_value: 10.0.1.14
#. Below is an example TripleO Undercloud configuration (``undercloud.conf``)
with routed networks support enabled and the three provisioning networks
defined.
::
[DEFAULT]
enable_routed_networks = true
enable_ui = false
overcloud_domain_name = localdomain
scheduler_max_attempts = 2
undercloud_ntp_servers = pool.ntp.org
undercloud_hostname = undercloud.rdocloud
local_interface = eth1
local_mtu = 1450
local_ip = 192.168.24.1/24
undercloud_public_host = 192.168.24.2
undercloud_admin_host = 192.168.24.3
undercloud_nameservers = 8.8.8.8,8.8.4.4
local_subnet = provision
subnets = provision,provision2,provision3
[provision]
cidr = 192.168.24.0/24
dhcp_start = 192.168.24.10
dhcp_end = 192.168.24.30
gateway = 192.168.24.254
inspection_iprange = 192.168.24.100,192.168.24.120
masquerade = true
[provision2]
cidr = 192.168.25.0/24
dhcp_start = 192.168.25.10
dhcp_end = 192.168.25.30
gateway = 192.168.25.254
inspection_iprange = 192.168.25.100,192.168.25.120
masquerade = true
[provision3]
cidr = 192.168.26.0/24
dhcp_start = 192.168.26.10
dhcp_end = 192.168.26.30
gateway = 192.168.26.254
inspection_iprange = 192.168.26.100,192.168.26.120
masquerade = true

View File

@ -1,24 +0,0 @@
Configuring the Host Cloud
==========================
Some of the configuration recommended below is optional, but applying
all of it will provide the optimal experience.
The changes described in this document apply to compute nodes in the
host cloud.
#. The Nova option ``force_config_drive`` must _not_ be set. If you have to
change this option, restart ``nova-compute`` to apply it.
#. Ideally, jumbo frames should be enabled on the host cloud. This
avoids MTU problems when deploying to instances over tunneled
Neutron networks with VXLAN or GRE.
For TripleO-based host clouds, this can be done by setting ``mtu``
on all interfaces and vlans in the network isolation nic-configs.
A value of at least 1550 should be sufficient to avoid problems.
If this cannot be done (perhaps because you don't have access to make
such a change on the host cloud), it will likely be necessary to
configure a smaller MTU on the deployed virtual instances. Details
on doing so can be found on the :doc:`../usage/usage` page.

View File

@ -1,51 +0,0 @@
Patching the Host Cloud
=======================
.. note:: Patching the host cloud is now optional. On clouds where the Neutron
port-security extension is enabled, it is now possible to run without
patching. However, the PXE boot patch may provide a better user
experience with OVB, so patching may still be desirable.
The changes described in this section apply to compute nodes in the
host cloud.
Apply the Nova pxe boot patch file in the ``patches`` directory to the host
cloud Nova. ``nova-pxe-boot.patch`` can be used with all releases prior to
Pike, ``nova-pxe-boot-pike.patch`` must be used with Pike and later.
Examples:
TripleO/RDO::
sudo patch -p1 -d /usr/lib/python2.7/site-packages < patches/nova/nova-pxe-boot.patch
or
::
sudo patch -p1 -d /usr/lib/python2.7/site-packages < patches/nova/nova-pxe-boot-pike.patch
Devstack:
.. note:: You probably don't want to try to run this with devstack anymore.
Devstack no longer supports rejoining an existing stack, so if you
have to reboot your host cloud you will have to rebuild from
scratch.
.. note:: The patch may not apply cleanly against master Nova
code. If/when that happens, the patch will need to
be applied manually.
::
cp patches/nova/nova-pxe-boot.patch /opt/stack/nova
cd /opt/stack/nova
patch -p1 < nova-pxe-boot.patch
or
::
cp patches/nova/nova-pxe-boot-pike.patch /opt/stack/nova
cd /opt/stack/nova
patch -p1 < nova-pxe-boot-pike.patch

View File

@ -1,74 +0,0 @@
Preparing the Host Cloud Environment
====================================
#. The ``ipxe`` directory contains tools for building an IPXE image which is used by the baremetal
instances to begin provisioning over the network.
To install the required build dependencies on a Fedora system::
sudo dnf install -y gcc xorriso make qemu-img syslinux-nonlinux xz-devel
It may be necessary to use the ``direct`` libguestfs backend::
export LIBGUESTFS_BACKEND=direct
To build the image, run the following from the root of the OVB repo::
make -C ipxe
#. Upload an ipxe-boot image for the baremetal instances, for both UEFI boot and
legacy BIOS boot::
openstack image create --progress --disk-format raw --property os_shutdown_timeout=5 --file ipxe/ipxe-boot.img ipxe-boot
openstack image create --progress --disk-format raw --property os_shutdown_timeout=5 --property hw_firmware_type=uefi --property hw_machine_type=q35 --file ipxe/ipxe-boot.img ipxe-boot-uefi
.. note:: The path provided to ipxe-boot.qcow2 is relative to the root of
the OVB repo. If the command is run from a different working
directory, the path will need to be adjusted accordingly.
.. note:: os_shutdown_timeout=5 is to avoid server shutdown delays since
since these servers won't respond to graceful shutdown requests.
#. Upload a CentOS 7 image for use as the base image::
wget http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
glance image-create --name CentOS-7-x86_64-GenericCloud --disk-format qcow2 --container-format bare < CentOS-7-x86_64-GenericCloud.qcow2
#. (Optional) Create a pre-populated base BMC image. This is a CentOS 7 image
with the required packages for the BMC pre-installed. This eliminates one
potential point of failure during the deployment of an OVB environment
because the BMC will not require any external network resources::
wget https://repos.fedorapeople.org/repos/openstack-m/ovb/bmc-base.qcow2
glance image-create --name bmc-base --disk-format qcow2 --container-format bare < bmc-base.qcow2
To use this image, configure ``bmc_image`` in env.yaml to be ``bmc-base`` instead
of the generic CentOS 7 image.
#. Create recommended flavors::
nova flavor-create baremetal auto 8192 50 2
nova flavor-create bmc auto 512 20 1
These flavors can be customized if desired. For large environments
with many baremetal instances it may be wise to give the bmc flavor
more memory. A 512 MB BMC will run out of memory around 20 baremetal
instances.
#. Source an rc file that will provide user credentials for the host cloud.
#. Add a Nova keypair to be injected into instances::
nova keypair-add --pub-key ~/.ssh/id_rsa.pub default
#. (Optional) Configure quotas. When running in a dedicated OVB cloud, it may
be helpful to set some quotas to very large/unlimited values to avoid
running out of quota when deploying multiple or large environments::
neutron quota-update --security_group 1000
neutron quota-update --port -1
neutron quota-update --network -1
neutron quota-update --subnet -1
nova quota-update --instances -1 --cores -1 --ram -1 [tenant uuid]

View File

@ -1,13 +0,0 @@
Host Cloud Setup
================
Instructions for setting up the host cloud[1].
1: The host cloud is any OpenStack cloud providing the necessary functionality
to run OVB. The host cloud must be running on real baremetal.
.. toctree::
patches
configuration
prepare

View File

@ -1,23 +0,0 @@
OpenStack Virtual Baremetal
===========================
OpenStack Virtual Baremetal is a tool for using OpenStack instances to test
baremetal-style deployments.
Table of Contents
-----------------
.. toctree::
:maxdepth: 2
introduction
host-cloud/setup
deploy/deploy
usage/usage
troubleshooting
api
Index
-----
* :ref:`genindex`
* :ref:`modindex`

View File

@ -1,57 +0,0 @@
Introduction
============
OpenStack Virtual Baremetal is a way to use OpenStack instances to do
simulated baremetal deployments. This project is a collection of tools
and documentation that make it much easier to do so. It primarily consists
of the following pieces:
- Patches and documentation for setting up a host cloud.
- A deployment CLI that leverages the OpenStack Heat project to deploy the
VMs, networks, and other resources needed.
- An OpenStack BMC that can be used to control OpenStack instances via IPMI
commands.
- A tool to collect details from the "baremetal" VMs so they can be added as
nodes in the OpenStack Ironic baremetal deployment project.
A basic OVB environment is just a BMC VM configured to control a number
of "baremetal" VMs. This allows them to be treated largely the same
way a real baremetal system with a BMC would. A number of additional
features can also be enabled to add more to the environment.
OVB was initially conceived as an improved method to deploy environments for
OpenStack TripleO development and testing. As such, much of the terminology
is specific to TripleO. However, it should be possible to use it for any
non-TripleO scenarios where a baremetal-style deployment is desired.
Benefits and Drawbacks
----------------------
As noted above, OVB started as part of the OpenStack TripleO project.
Previous methods for deploying virtual environments for TripleO focused on
setting up all the vms for a given environment on a single box. This had a
number of drawbacks:
- Each developer needed to have their own system. Sharing was possible, but
more complex and generally not done. Multi-tenancy is a basic design
tenet of OpenStack so this is not a problem when using it to provision the
VMs. A large number of developers can make use of a much smaller number of
physical systems.
- If a deployment called for more VMs than could fit on a single system, it
was a complex manual process to scale out to multiple systems. An OVB
environment is only limited by the number of instances the host cloud can
support.
- Pre-OVB test environments were generally static because there was not an API
for dynamic provisioning. By using the OpenStack API to create all of the
resources, test environments can be easily tailored to their intended use
case.
One drawback to OVB at this time is that it does have hard requirements on a
few OpenStack features (Heat, Neutron port-security, private image uploads,
for example) that are not all widely available in public clouds. Fortunately,
as they move to newer and newer versions of OpenStack that situation should
improve.
It should also be noted that without the Nova PXE boot patch, OVB is not
compatible with any workflows that write to the root disk before deployment.
This includes Ironic node cleaning.

View File

@ -1,73 +0,0 @@
Troubleshooting
===============
A list of common problems and their solutions.
Nodes hang while downloading the deploy ramdisk or kernel
---------------------------------------------------------
**Cause**: Improper MTU settings on deployment interfaces.
**Solution**: Set the MTU on the deployment interfaces to allow PXE booting to
work correctly. For TripleO-based deployments, see the readme
for details on how to do this. For others, make sure that the
deployment nic on the undercloud vm has the MTU set appropriately
and that the DHCP server responding to PXE requests advertises the
same MTU. Note that this MTU should be 50 bytes smaller than the
physical MTU of the host cloud.
Nodes are deployed, but cannot talk to each other
-------------------------------------------------
In OpenStack deployments, this often presents as rabbitmq connectivity issues
from compute nodes.
**Cause**: Improper MTU settings on deployed instances.
**Solution**: Essentially the same as the previous problem. Ensure that the MTU
being used on the deployed instances is 50 bytes smaller than the
physical MTU of the host cloud. Again, for TripleO-based
deployments the readme has details on how to do this.
Nodes fail to PXE boot
----------------------
**Cause**: The nodes are not configured to PXE boot properly.
**Solution**: This depends on the method being used to PXE boot. If the Nova
patch is being used to provide this functionality, then ensure
that it has been applied on all compute nodes and those nodes'
nova-compute service has been restarted. If the ipxe-boot image
is being used without the Nova patch, the baremetal instances must
be rebuilt to the ipxe-boot image before subsequent deployments.
Nodes fail to PXE boot 2
------------------------
DHCP requests are seen on the undercloud
VM, but responses never get to the baremetal instances.
**Cause**: Neutron port security blocking DHCP from the undercloud.
**Solution**: Ensure that the Neutron port-security extension is present in
the host cloud. It is required for OVB to function properly.
The BMC does not respond to IPMI requests
-----------------------------------------
**Cause**: Several. Neutron may not be configured to allow the BMC to listen
on arbitrary addresses. The BMC deployment may have failed for some
reason.
**Solution**: Neutron must be configured to allow the BMC to listen on
arbitrary addresses. This requires the port-security extension as in the
previous solution. If this is already configured correctly, then the BMC may
have failed to deploy properly. This can usually be determined by looking at
the nova console-log of the BMC instance. A correctly working BMC will
display 'Managing instance [uuid]' for each baremetal node in the
environment. If those messages are not found, then the BMC has
failed to start properly. The relevant error messages should be
found in the console-log of the BMC. If that is not sufficient to
troubleshoot the problem, the BMC can be accessed using the
ssh key configured in the OVB environment yaml as the 'centos'
user.

View File

@ -1,68 +0,0 @@
Using a Deployed OVB Environment
================================
After an OVB environment has been deployed, there are a few things to know.
#. The undercloud vm can be used with something like TripleO
to do a baremetal-style deployment to the virtual baremetal instances
deployed previously.
#. To reset the environment, usually it is sufficient to do a ``nova rebuild``
on the undercloud to return it to the original image. To ensure that
no traces of the old environment remain, the baremetal vms can be rebuilt
to the ipxe-boot image as well.
.. note:: If you are relying on the ipxe-boot image to provide PXE boot
support in your cloud because Nova does not know how to PXE boot
natively, the baremetal instances must always be rebuilt before
subsequent deployments.
.. note:: **Do not** rebuild the bmc. It is unnecessary and not guaranteed
to work.
#. If the host cloud's tenant network MTU is 1500 or less, it will be necessary
to configure the deployed interfaces with a smaller MTU. The tenant network
MTU minus 50 is usually a safe value. For the undercloud this can be done
by setting ``local_mtu`` in ``undercloud.conf``.
.. note::
In Mitaka and older versions of TripleO it will be necessary to do the
MTU configuration manually. That can be done with the following
commands (as root)::
# Replace 'eth1' with the actual device to be used for the
# provisioning network
ip link set eth1 mtu 1350
echo -e "\ndhcp-option-force=26,1350" >> /etc/dnsmasq-ironic.conf
systemctl restart 'neutron-*'
#. If using the full network isolation provided by one of the
``all-networks*.yaml`` environments then a TripleO overcloud can be deployed
in the OVB environment by using the network templates in the
``overcloud-templates`` directory. The names are fairly descriptive, but
this is a brief explanation of each:
- **network-templates:** IPv4 multi-nic. Usable with the network layout
deployed by the ``all-networks.yaml`` environment.
- **ipv6-network-templates:** IPv6 multi-nic. Usable with the network layout
deployed by the ``all-networks.yaml`` environment.
- **bond-network-templates:** IPv4 multi-nic, with duplicate `public`
interfaces for testing bonded nics. Usable with the network layout
deployed by the ``all-networks-public-bond.yaml`` environment.
The undercloud's ``public`` interface should be configured with the address
of the default route from the templates in use. Firewall rules for
forwarding the traffic from that interface should also be added. The
following commands will make the necessary configuration::
cat >> /tmp/eth2.cfg <<EOF_CAT
network_config:
- type: interface
name: eth2
use_dhcp: false
addresses:
- ip_netmask: 10.0.0.1/24
- ip_netmask: 2001:db8:fd00:1000::1/64
EOF_CAT
sudo os-net-config -c /tmp/eth2.cfg -v
sudo iptables -A POSTROUTING -s 10.0.0.0/24 ! -d 10.0.0.0/24 -j MASQUERADE -t nat

View File

@ -1 +0,0 @@
all-networks.yaml

View File

@ -1 +0,0 @@
all-networks-public-bond.yaml

View File

@ -1,68 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Deploy with All Networks Enabled and Two Public Interfaces
# description: |
# Deploy an OVB stack that adds interfaces for all the standard TripleO
# network isolation networks. This version will deploy duplicate
# public network interfaces on the baremetal instances so that the
# public network can be configured as a bond.
parameter_defaults:
# Name of internal API network
# Type: string
overcloud_internal_net: overcloud_internal
# CIDR for internal API network subnet. This is typically irrelevant and
# does not need to be changed.
# Type: string
overcloud_internal_net_cidr: 172.17.0.0/24
# IP version for the overcloud_internal_net subnet
# Type: number
overcloud_internal_net_ip_version: 4
# Name of storage management network
# Type: string
overcloud_storage_mgmt_net: overcloud_storage_mgmt
# CIDR for storage management network subnet. This is typically irrelevant
# and does not need to be changed.
# Type: string
overcloud_storage_mgmt_net_cidr: 172.19.0.0/24
# IP version for the overcloud_storage_mgmt_net subnet
# Type: number
overcloud_storage_mgmt_net_ip_version: 4
# Name of storage network
# Type: string
overcloud_storage_net: overcloud_storage
# CIDR for storage network subnet. This is typically irrelevant and
# does not need to be changed.
# Type: string
overcloud_storage_net_cidr: 172.18.0.0/24
# IP version for the overcloud_storage_net subnet
# Type: number
overcloud_storage_net_ip_version: 4
# Name of tenant network
# Type: string
overcloud_tenant_net: overcloud_tenant
# CIDR for tenant network subnet. This is typically irrelevant and
# does not need to be changed.
# Type: string
overcloud_tenant_net_cidr: 172.16.0.0/24
# IP version for the overcloud_tenant_net subnet
# Type: number
overcloud_tenant_net_ip_version: 4
resource_registry:
OS::OVB::BaremetalNetworks: ../templates/baremetal-networks-all.yaml
OS::OVB::BaremetalPorts: ../templates/baremetal-ports-public-bond.yaml

View File

@ -1,66 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Deploy with All Networks Enabled
# description: |
# Deploy an OVB stack that adds interfaces for all the standard TripleO
# network isolation networks.
parameter_defaults:
# Name of internal API network
# Type: string
overcloud_internal_net: overcloud_internal
# CIDR for internal API network subnet. This is typically irrelevant and
# does not need to be changed.
# Type: string
overcloud_internal_net_cidr: 172.17.0.0/24
# IP version for the overcloud_internal_net subnet
# Type: number
overcloud_internal_net_ip_version: 4
# Name of storage management network
# Type: string
overcloud_storage_mgmt_net: overcloud_storage_mgmt
# CIDR for storage management network subnet. This is typically irrelevant
# and does not need to be changed.
# Type: string
overcloud_storage_mgmt_net_cidr: 172.19.0.0/24
# IP version for the overcloud_storage_mgmt_net subnet
# Type: number
overcloud_storage_mgmt_net_ip_version: 4
# Name of storage network
# Type: string
overcloud_storage_net: overcloud_storage
# CIDR for storage network subnet. This is typically irrelevant and
# does not need to be changed.
# Type: string
overcloud_storage_net_cidr: 172.18.0.0/24
# IP version for the overcloud_storage_net subnet
# Type: number
overcloud_storage_net_ip_version: 4
# Name of tenant network
# Type: string
overcloud_tenant_net: overcloud_tenant
# CIDR for tenant network subnet. This is typically irrelevant and
# does not need to be changed.
# Type: string
overcloud_tenant_net_cidr: 172.16.0.0/24
# IP version for the overcloud_tenant_net subnet
# Type: number
overcloud_tenant_net_ip_version: 4
resource_registry:
OS::OVB::BaremetalNetworks: ../templates/baremetal-networks-all.yaml
OS::OVB::BaremetalPorts: ../templates/baremetal-ports-all.yaml

View File

@ -1,45 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Base Configuration Options for Extra Nodes with All Ports Open
# description: |
# Configuration options that need to be set when deploying an OVB
# environment with extra undercloud-like nodes. This environment
# should be used like a role file, but will deploy an undercloud-like
# node instead of more baremetal nodes.
parameter_defaults:
# If True, enable config drive on baremetal instances.
# Type: boolean
baremetal_config_drive: False
# Recommended to be at least 1 vcpu, 4 GB RAM, 50 GB disk
# Type: string
baremetal_flavor: baremetal
# The base image to use for baremetal instances
# Type: string
baremetal_image: CentOS-7-x86_64-GenericCloud
# If True, enable config drive on the server.
# Type: boolean
config_drive: False
# Nova keypair to inject into the undercloud and bmc
# Type: string
key_name: default
# Number of baremetal nodes to deploy
# Type: number
node_count: 1
# The default role for nodes in this environment. This parameter is
# ignored by Heat, but used by build-nodes-json.
# Type: string
role: extra
resource_registry:
OS::OVB::BMC: OS::Heat::None
OS::OVB::BaremetalPorts: ../templates/baremetal-ports-extra-node-all.yaml

View File

@ -1,45 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Base Configuration Options for Extra Nodes
# description: |
# Configuration options that need to be set when deploying an OVB
# environment with extra undercloud-like nodes. This environment
# should be used like a role file, but will deploy an undercloud-like
# node instead of more baremetal nodes.
parameter_defaults:
# If True, enable config drive on baremetal instances.
# Type: boolean
baremetal_config_drive: False
# Recommended to be at least 1 vcpu, 4 GB RAM, 50 GB disk
# Type: string
baremetal_flavor: baremetal
# The base image to use for baremetal instances
# Type: string
baremetal_image: CentOS-7-x86_64-GenericCloud
# If True, enable config drive on the server.
# Type: boolean
config_drive: False
# Nova keypair to inject into the undercloud and bmc
# Type: string
key_name: default
# Number of baremetal nodes to deploy
# Type: number
node_count: 1
# The default role for nodes in this environment. This parameter is
# ignored by Heat, but used by build-nodes-json.
# Type: string
role: extra
resource_registry:
OS::OVB::BMC: OS::Heat::None
OS::OVB::BaremetalPorts: ../templates/baremetal-ports-extra-node.yaml

View File

@ -1,28 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Base Configuration Options for Secondary Roles
# description: |
# Configuration options that need to be set when deploying an OVB
# environment that has multiple roles.
parameter_defaults:
# Recommended to be at least 1 vcpu, 4 GB RAM, 50 GB disk
# Type: string
baremetal_flavor: baremetal
# Nova keypair to inject into the undercloud and bmc
# Type: string
key_name: default
# Number of baremetal nodes to deploy
# Type: number
node_count: 2
# The default role for nodes in this environment. This parameter is
# ignored by Heat, but used by build-nodes-json.
# Type: string
role: compute

View File

@ -1,100 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Base Configuration Options
# description: |
# Basic configuration options needed for all OVB environments
parameter_defaults:
# Recommended to be at least 1 vcpu, 4 GB RAM, 50 GB disk
# Type: string
baremetal_flavor: baremetal
# The base image to use for baremetal instances
# Type: string
baremetal_image: ipxe-boot
# Prefix for the name of the baremetal instances
# Type: string
baremetal_prefix: baremetal
# The Nova flavor to use for the bmc instance
# Type: string
bmc_flavor: m1.small
# The base image for the bmc instance. A CentOS 7 image is currently the
# only one supported.
# Type: string
bmc_image: CentOS-7-x86_64-GenericCloud
# Prefix for the name of the bmc instance
# Type: string
bmc_prefix: bmc
# If True, enable config drive on the server.
# Type: boolean
config_drive: False
# An external network from which floating ips can be provisioned
# Type: string
external_net: external
# Nova keypair to inject into the undercloud and bmc
# Type: string
key_name: default
# Number of baremetal nodes to deploy
# Type: number
node_count: 2
# Name of a private network which can have floating ips associated with it
# Type: string
private_net: private
# Name of a network that will be used for provisioning traffic
# Type: string
provision_net: provision
# Whether this network should be shared across all tenants
# Type: boolean
provision_net_shared: False
# Name of the overcloud external network
# Type: string
public_net: public
# Allocation Pools for the public network
# Type: json
public_net_allocation_pools: []
# CIDR for external network subnet
# Type: string
public_net_cidr: 10.0.0.0/24
# IP version for the public subnet
# Type: number
public_net_ip_version: 4
# Whether this network should be shared across all tenants
# Type: boolean
public_net_shared: False
# The default role for nodes in this environment. This parameter is
# ignored by Heat, but used by build-nodes-json.
# Type: string
role: ''
# Nova flavor to use for the undercloud instance
# Type: string
undercloud_flavor: m1.xlarge
# Image to boot as the undercloud instance
# Type: string
undercloud_image: CentOS-7-x86_64-GenericCloud
# Name of the undercloud instance
# Type: string
undercloud_name: undercloud

View File

@ -1,18 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Enable Instance Status Caching in BMC
# description: |
# Enable caching of instance status in the BMC. This should reduce load on
# the host cloud, but at the cost of potential inconsistency if the state
# of a baremetal instance is changed without using the BMC.
parameter_defaults:
# Enable instance status caching on the BMC. This can reduce load on the
# host cloud, but if an instance's status is changed outside the BMC it may
# become out of sync.
# Type: boolean
bmc_use_cache: True

View File

@ -1,17 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Boot Baremetal Instances from Volume
# description: |
# Boot the baremetal instances from Cinder volumes instead of
# ephemeral storage.
parameter_defaults:
# The size of the baremetal instance volumes
# Type: number
baremetal_volume_size: 41
resource_registry:
OS::OVB::ServerPair: ../templates/virtual-baremetal-servers-volume.yaml

View File

@ -1,22 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Boot Undercloud and Baremetal Instances from Volume
# description: |
# Boot the undercloud and baremetal instances from Cinder volumes instead of
# ephemeral storage.
parameter_defaults:
# The size of the baremetal instance volumes
# Type: number
baremetal_volume_size: 41
# The size of the volume for the undercloud instance
# Type: number
undercloud_volume_size: 50
resource_registry:
OS::OVB::ServerPair: ../templates/virtual-baremetal-servers-volume.yaml
OS::OVB::UndercloudEnvironment: ../templates/undercloud-volume.yaml

View File

@ -1,17 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Boot Undercloud Instance from Volume
# description: |
# Boot the undercloud instance from a Cinder volume instead of
# ephemeral storage.
parameter_defaults:
# The size of the volume for the undercloud instance
# Type: number
undercloud_volume_size: 50
resource_registry:
OS::OVB::UndercloudEnvironment: ../templates/undercloud-volume.yaml

View File

@ -1,21 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Create a Private Network
# description: |
# Create the private network as part of the OVB stack instead of using an
# existing one.
parameter_defaults:
# List of DNS servers for the private network
# Type: comma_delimited_list
dns_nameservers: ['8.8.8.8']
# CIDR for private network subnet
# Type: string
private_net_cidr: 10.0.1.0/24
resource_registry:
OS::OVB::PrivateNetwork: ../templates/private-net-create.yaml

View File

@ -1,13 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Disable BMC
# description: |
# Deploy a stack without a BMC. This will obviously make it impossible to
# control the instances via IPMI. It will also prevent use of
# ovb-build-nodes-json because there will be no BMC addresses.
resource_registry:
OS::OVB::BMC: ../templates/bmc-none.yaml

View File

@ -1,34 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Configuration for router advertisement daemon (radvd)
# description: |
# Contains the available parameters that need to be configured when using
# a IPv6 network. Requires the ipv6-radvd.yaml environment.
parameter_defaults:
# Controls radvd parameters AdvManagedFlag and AdvAutonomous. For stateful
# addressing these should be AdvManagedFlag: on, AdvAutonomous: off, for
# statelss (SLAAC) these should be AdvManagedFlag: off, AdvAutonomous: on.
# Type: boolean
IPv6_dhcpv6-statefull: False
# The Nova flavor to use for the radvd instance
# Type: string
radvd_flavor: m1.small
# The base image for the radvd instance. A CentOS 7 image is currently
# the only one supported.
# Type: string
radvd_image: CentOS-7-x86_64-GenericCloud
# Prefix for the name of the radvd instance
# Type: string
radvd_prefix: radvd
# radvd address on the provision network subnet
# Type: string
radvd_provision_address: fd12:3456:789a:1::fffe

View File

@ -1,12 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Enable router advertisement daemon (radvd)
# description: |
# Deploy the stack with a router advertisement daemon running for the
# provisioning network.
resource_registry:
OS::OVB::RouterAdvertisementDaemon: ../templates/ipv6-radvd.yaml

View File

@ -1,13 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Public Network External Router
# description: |
# Deploy a router that connects the public and external networks. This
# allows the public network to be used as a gateway instead of routing all
# traffic through the undercloud.
resource_registry:
OS::OVB::UndercloudNetworks: ../templates/undercloud-networks-public-router.yaml

View File

@ -1,12 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Disable the Undercloud in a QuintupleO Stack
# description: |
# Deploy a QuintupleO environment, but do not create the undercloud
# instance.
resource_registry:
OS::OVB::UndercloudEnvironment: OS::Heat::None

View File

@ -1,42 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Configuration for Routed Networks
# description: |
# Contains the available parameters that need to be configured when using
# a routed networks environment. Requires the routed-networks.yaml or
# routed-networks-ipv6.yaml environment.
parameter_defaults:
# The IP addresses of DHCP servers to relay DHCP requests to.
# Mandatory. This parameter must be set by the user.
# Type: json
dhcp_ips: <None>
# The Nova flavor to use for the dhcrelay instance
# Type: string
dhcp_relay_flavor: m1.small
# The base image for the dhcrelay instance. A CentOS 7 image is currently
# the only one supported.
# Type: string
dhcp_relay_image: CentOS-7-x86_64-GenericCloud
# DHCP relay address on the provision2 network subnet
# Type: string
dhcp_relay_provision2_address: 192.168.25.253
# DHCP relay address on the provision3 network subnet
# Type: string
dhcp_relay_provision3_address: 192.168.26.253
# DHCP relay address on the provision network subnet
# Type: string
dhcp_relay_provision_address: 192.168.24.253
# Prefix for the name of the dhcrelay instance
# Type: string
dhcrelay_prefix: dhcrelay

View File

@ -1,20 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Enable Routed Networks IPv6
# description: |
# Enable use of routed IPv6 networks, where there may be multiple separate
# networks connected with a router, router advertisement daemon (radvd),
# and DHCP relay. Do not pass any other network configuration environments
# after this one or they may override the changes made by this environment.
# When this environment is in use, the routed-networks-configuration
# environment should usually be included as well.
resource_registry:
OS::OVB::BaremetalNetworks: ../templates/baremetal-networks-routed.yaml
OS::OVB::DHCPRelay: ../templates/dhcpv6-relay.yaml
OS::OVB::ProvisionNetRouter: OS::Heat::None
OS::OVB::ProvisionNetRouterInterface: OS::Heat::None
OS::OVB::UndercloudNetworks: ../templates/undercloud-networks-routed.yaml

View File

@ -1,48 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Base Role Configuration for Routed Networks
# description: |
# A base role environment that contains the necessary parameters for
# deploying with routed networks.
parameter_defaults:
# Recommended to be at least 1 vcpu, 4 GB RAM, 50 GB disk
# Type: string
baremetal_flavor: baremetal
# Nova keypair to inject into the undercloud and bmc
# Type: string
key_name: default
# Number of baremetal nodes to deploy
# Type: number
node_count: 2
# Name of internal API network
# Type: string
overcloud_internal_net: overcloud_internal2
# Name of storage management network
# Type: string
overcloud_storage_mgmt_net: overcloud_storage_mgmt2
# Name of storage network
# Type: string
overcloud_storage_net: overcloud_storage2
# Name of tenant network
# Type: string
overcloud_tenant_net: overcloud_tenant2
# Name of a network that will be used for provisioning traffic
# Type: string
provision_net: provision2
# The default role for nodes in this environment. This parameter is
# ignored by Heat, but used by build-nodes-json.
# Type: string
role: leaf1

View File

@ -1,18 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Enable Routed Networks
# description: |
# Enable use of routed networks, where there may be multiple separate
# networks connected with a router and DHCP relay. Do not pass any other
# network configuration environments after this one or they may override
# the changes made by this environment. When this environment is in use,
# the routed-networks-configuration environment should usually be
# included as well.
resource_registry:
OS::OVB::BaremetalNetworks: ../templates/baremetal-networks-routed.yaml
OS::OVB::DHCPRelay: ../templates/dhcp-relay.yaml
OS::OVB::UndercloudNetworks: ../templates/undercloud-networks-routed.yaml

View File

@ -1,22 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Assign the Undercloud an Existing Floating IP
# description: |
# When deploying the undercloud, assign it an existing floating IP instead
# of creating a new one.
parameter_defaults:
# Address of existing floating ip to use.
# Type: string
undercloud_floating_ip: ''
# ID of existing floating ip to use.
# Mandatory. This parameter must be set by the user.
# Type: string
undercloud_floating_ip_id: <None>
resource_registry:
OS::OVB::UndercloudFloating: ../templates/undercloud-floating-existing.yaml

View File

@ -1,11 +0,0 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Do Not Assign a Floating IP to the Undercloud
# description: |
# When deploying the undercloud, do not assign a floating ip to it.
resource_registry:
OS::OVB::UndercloudFloating: ../templates/undercloud-floating-none.yaml

2
ipxe/.gitignore vendored
View File

@ -1,2 +0,0 @@
ipxe-boot.img
ipxe-boot.qcow2

View File

@ -1,86 +0,0 @@
# The location of the directory containing the iPXE make file
# Override this to build from a different source directory
IPXE_SRCDIR=ipxe/src
# The specific image to use as the OVB iPXE boot image
# Override this to use a different image (e.g. ipxe.hd)
IPXE_IMG=bin/ipxe.iso
IPXE_EFI=bin-x86_64-efi/ipxe.efi
ipxe_img_path=$(IPXE_SRCDIR)/$(IPXE_IMG)
ipxe_efi_path=$(IPXE_SRCDIR)/$(IPXE_EFI)
all: ipxe-boot.img
ipxe-boot.img: $(ipxe_img_path) efi.img
tmp_dir=$$(mktemp -d) && \
cp efi.img $$tmp_dir/efi.img && \
mkdir -p $$tmp_dir/boot/efi && \
xorriso -osirrox on -indev $(ipxe_img_path) -extract / $$tmp_dir && \
xorriso -as mkisofs \
-isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \
-c boot.catalog \
-b isolinux.bin \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-eltorito-alt-boot \
-e efi.img \
-no-emul-boot \
-isohybrid-gpt-basdat \
-o ipxe-boot.img \
$$tmp_dir
efi.img: $(ipxe_efi_path)
tmp_dir=$$(mktemp -d) && \
mkdir -p $$tmp_dir/EFI/BOOT && \
cp $(ipxe_efi_path) $$tmp_dir/EFI/BOOT/BOOTX64.EFI && \
virt-make-fs --format=raw --type=fat $$tmp_dir efi.img
# iPXE is configured by setting config macros in the source tree. The repo
# contains a number of config headers in ipxe/src/config/*.h which contain
# defaults. These defaults can be overridden by creating a corresponding header
# in ipxe/src/config/local.
# For example, the source repo contains ipxe/src/config/general.h, which
# explicitly does not define NET_PROTO_IPV6. To enable IPv6 support in iPXE we
# need to create ipxe/src/config/local/general.h and define NET_PROTO_IPV6 in
# that header.
# The following allows OVB to keep iPXE configuration under ipxe-config in this
# repo, and copies it into place in the iPXE repo during build.
# config_headers is a list of the filenames of all overridden headers in ipxe-config/
config_headers = $(foreach header,$(wildcard ipxe-config/*.h),\
$(patsubst ipxe-config/%,%,$(header)))
# repo_config_path is the path to local override headers in the ipxe repo
repo_config_path = $(IPXE_SRCDIR)/config/local
# repo_config_headers is a list of all overridden headers in the iPXE repo
repo_config_headers = $(foreach header,$(config_headers),$(repo_config_path)/$(header))
# Copy individual repo_config_headers from ipxe-config/
$(repo_config_path): $(IPXE_SRCDIR)
mkdir -p $@
$(repo_config_path)/%.h: ipxe-config/%.h | $(repo_config_path)
cp $< $@
$(IPXE_SRCDIR):
git submodule init
git submodule update
# We disable -Werror so we can build older commits with newer gcc
# Don't use parallel make, as this races to initialise config headers in a
# clean repo.
$(ipxe_img_path): $(repo_config_headers) script.ipxe
$(MAKE) -C ipxe/src NO_WERROR=1 EMBED=../../script.ipxe $(IPXE_IMG)
$(ipxe_efi_path): $(repo_config_headers) script.ipxe
$(MAKE) -C ipxe/src NO_WERROR=1 EMBED=../../script.ipxe $(IPXE_EFI)
clean:
rm -rf ipxe
mkdir ipxe
rm -f ipxe-boot.img ipxe-boot.qcow2
.PHONY: $(ipxe_img_path) clean

View File

@ -1,7 +0,0 @@
IPXE image-building tools
-------------------------
This directory contains tools for for building an IPXE image. Documentation
to build the image is found at:
https://openstack-virtual-baremetal.readthedocs.io/en/latest/host-cloud/prepare.html

@ -1 +0,0 @@
Subproject commit f58b5109f46088bdbb5345a9d94b636c54345bdf

View File

@ -1,3 +0,0 @@
Headers in this directory will be copied to src/config/local/ in the ipxe build
directory. Values defined in a local header will override the default in the
corresponding header in src/config/.

View File

@ -1 +0,0 @@
#define NET_PROTO_IPV6 /* Enable IPv6 */

View File

@ -1,51 +0,0 @@
#!ipxe
#
# This is the iPXE boot script that we embed into the iPXE binary.
#
# The default behaviour is to get DHCP and assume that DHCP includes
# the filename option. It will only try eth0. If it fails, then it
# just stops.
#
# This script makes it attempt to boot from eth0. If that fails, it
# will try the next interface. This will retry 10 times before
# rebooting.
#
# Inspired by:
# https://github.com/danderson/netboot/blob/master/pixiecore/boot.ipxe
#
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||
set attempts:int32 10
set x:int32 1
:loop
autoboot || goto retry
goto boot
:retry
echo iPXE boot failed, retrying (attempt ${x}/${attempts}).
sleep 1
iseq ${x} ${attempts} && goto fail ||
inc x
goto loop
:boot
echo Booting using ${ifname}.
# This is a hack to workaround LP bug 1845487:
# https://bugs.launchpad.net/puppet-ironic/+bug/1845487
# It should be removed when the fix for that bug is available and backported to
# all supported releases.
isset ${mtu} && echo -n Overriding MTU from dhcp of ${mtu}.
set mtu 1350
echo Set MTU to ${mtu}.
chain ${filename}
:fail
echo Failed to iPXE boot successfully after ${attempts} attempts.
echo
echo Rebooting in 5 seconds...
sleep 5
reboot

View File

@ -1,73 +0,0 @@
# Copyright 2017 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
import os
import os_client_config
# Older versions of os-client-config pop this from the environment when
# make_client is called. Cache it on import so we know what the original
# value was, regardless of any funny business that happens later.
OS_CLOUD = os.environ.get('OS_CLOUD')
def _create_auth_parameters():
"""Read keystone auth parameters from appropriate source
If the environment variable OS_CLOUD is set, read the auth information
from os_client_config. Otherwise, read it from environment variables.
When reading from the environment, also validate that all of the required
values are set.
:returns: A dict containing the following keys: os_user, os_password,
os_tenant, os_auth_url, os_project, os_user_domain,
os_project_domain.
"""
config = os_client_config.OpenStackConfig().get_one_cloud(OS_CLOUD)
auth = config.config['auth']
username = auth['username']
password = auth['password']
# os_client_config seems to always call this project_name
tenant = auth['project_name']
auth_url = auth['auth_url']
project = auth['project_name']
user_domain = (auth.get('user_domain_name') or
auth.get('user_domain_id', ''))
project_domain = (auth.get('project_domain_name') or
auth.get('project_domain_id', ''))
return {'os_user': username,
'os_password': password,
'os_tenant': tenant,
'os_auth_url': auth_url,
'os_project': project,
'os_user_domain': user_domain,
'os_project_domain': project_domain,
}
def _cloud_json():
"""Return the current cloud's data in JSON
Retrieves the cloud from os-client-config and serializes it to JSON.
"""
c = os_client_config.OpenStackConfig().get_one_cloud(OS_CLOUD)
minimal_config = {}
for k in ('auth', 'region_name', 'interface', 'identity_api_version'):
if k in c.config:
minimal_config[k] = c.config[k]
return json.dumps(minimal_config)

View File

@ -1,343 +0,0 @@
#!/usr/bin/env python
# Copyright 2015 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import argparse
import json
import os
import re
import yaml
import os_client_config
_KNOWN_INTERFACE_NAMES = ('boot', 'console', 'deploy',
'inspect', 'management', 'network',
'power', 'raid', 'rescue', 'storage',
'vendor')
def _parse_args():
parser = argparse.ArgumentParser(
prog='build-nodes-json.py',
description='Tool for collecting virtual IPMI details',
)
parser.add_argument('--env', '-e',
dest='env',
default=None,
help='YAML file containing OVB environment details')
parser.add_argument('--bmc_prefix',
dest='bmc_prefix',
default='bmc',
help='BMC name prefix')
parser.add_argument('--baremetal_prefix',
dest='baremetal_prefix',
default='baremetal',
help='Baremetal name prefix')
parser.add_argument('--private_net',
dest='private_net',
default='private',
help='DEPRECATED: This parameter is ignored.')
parser.add_argument('--provision_net',
dest='provision_net',
default='provision',
help='DEPRECATED: This parameter is ignored.')
parser.add_argument('--nodes_json',
dest='nodes_json',
default='nodes.json',
help='Destination to store the nodes json file to')
parser.add_argument('--add_undercloud',
dest='add_undercloud',
action='store_true',
help='DEPRECATED: Use --network_details instead. '
'Adds the undercloud details to the json file.')
parser.add_argument('--network_details',
dest='network_details',
action='store_true',
help='Include addresses for all nodes on all networks '
'in a network_details key')
parser.add_argument('--driver', default='ipmi',
help='Bare metal driver to use')
parser.add_argument('--interface',
dest='interfaces',
action='append',
help='Interface driver to set, can be specified '
'multiple times. For example boot=pxe')
parser.add_argument('--physical_network',
action='store_true',
help='Set the physical network attribute of baremetal '
'ports. (Requires Rocky or later Ironic)')
parser.add_argument('--use-mac',
action='store_true',
help='Use the deprecated "mac" field in nodes JSON '
'instead of the "ports" field.')
parser.add_argument('--id',
help='Identifier to remove from network resource '
'names when setting physical network attribute '
'of baremetal ports. (This should match the --id '
'used with for the ovb-deploy command.)')
args = parser.parse_args()
return args
def _get_names(args):
if args.env is None:
bmc_base = args.bmc_prefix
baremetal_base = args.baremetal_prefix
# FIXME: This is not necessarily true.
undercloud_name = 'undercloud'
else:
with open(args.env) as f:
e = yaml.safe_load(f)
bmc_base = e['parameter_defaults']['bmc_prefix']
baremetal_base = e['parameter_defaults']['baremetal_prefix']
role = e.get('parameter_defaults', {}).get('role')
if role and baremetal_base.endswith('-' + role):
baremetal_base = baremetal_base[:-len(role) - 1]
undercloud_name = e.get('parameter_defaults', {}).get('undercloud_name') # noqa: E501
return bmc_base, baremetal_base, undercloud_name
def _get_clients():
cloud = os.environ.get('OS_CLOUD')
nova = os_client_config.make_client('compute', cloud=cloud)
neutron = os_client_config.make_client('network', cloud=cloud)
glance = os_client_config.make_client('image', cloud=cloud)
return nova, neutron, glance
def _get_ports(neutron, bmc_base, baremetal_base):
all_ports = sorted(neutron.list_ports()['ports'], key=lambda x: x['name'])
bmc_ports = list([p for p in all_ports
if p['name'].startswith(bmc_base)])
bm_ports = list([p for p in all_ports
if p['name'].startswith(baremetal_base)])
# Filter the bm_ports without a matching bmc_port, when using roles
# one role can have bmc enabled, and other roles have it disabled.
valid_suffixes = [p['name'].split(bmc_base)[-1] for p in bmc_ports]
valid_bm_ports = [p for p in bm_ports
if p['name'].split(baremetal_base)[-1] in valid_suffixes]
if len(bmc_ports) != len(valid_bm_ports):
raise RuntimeError('Found different numbers of baremetal and '
'bmc ports. bmc: %s baremetal: %s' % (bmc_ports,
bm_ports))
bmc_bm_port_pairs = zip(bmc_ports, valid_bm_ports)
provision_net_map = {}
for port in bm_ports:
provision_net_map.update({
port.get('id'):
neutron.list_subnets(
id=port['fixed_ips'][0]['subnet_id'])['subnets'][0].get(
'name')})
return bm_ports, bmc_bm_port_pairs, provision_net_map
def _build_network_details(nova, bm_ports, undercloud_name):
network_details = {}
for baremetal_port in bm_ports:
baremetal = nova.servers.get(baremetal_port['device_id'])
network_details[baremetal.name] = {}
network_details[baremetal.name]['id'] = baremetal.id
network_details[baremetal.name]['ips'] = baremetal.addresses
extra_nodes = []
if undercloud_name:
undercloud_node_template = {
'name': undercloud_name,
'id': '',
'ips': [],
}
try:
undercloud_instance = nova.servers.list(
search_opts={'name': undercloud_name})[0]
except IndexError:
print('Undercloud %s specified in the environment file is not '
'available in nova. No undercloud details will be '
'included in the output.' % undercloud_name)
else:
undercloud_node_template['id'] = undercloud_instance.id
undercloud_node_template['ips'] = nova.servers.ips(
undercloud_instance)
extra_nodes.append(undercloud_node_template)
network_details[undercloud_name] = dict(
id=undercloud_instance.id,
ips=undercloud_instance.addresses)
return extra_nodes, network_details
def _parse_interfaces(interface_args):
if not interface_args:
return {}
interfaces = {}
for i_arg in interface_args:
try:
(i, v) = i_arg.split(('='), 1)
except ValueError:
raise RuntimeError('Malformed interface "%s". Use the key=value '
'format.' % i_arg)
if i not in _KNOWN_INTERFACE_NAMES:
raise RuntimeError('Unknown interface "%s". Supported interfaces: '
'%s' % (i, ', '.join(_KNOWN_INTERFACE_NAMES)))
interfaces['%s_interface' % i] = v
return interfaces
def _build_nodes(nova, glance, bmc_bm_port_pairs, provision_net_map,
baremetal_base, args):
node_template = {
'pm_type': args.driver,
'cpu': '',
'memory': '',
'disk': '',
'arch': 'x86_64',
'pm_user': 'admin',
'pm_password': 'password',
'pm_addr': '',
'capabilities': 'boot_option:local',
'name': '',
}
nodes = []
cache = {}
node_template.update(_parse_interfaces(args.interfaces))
for bmc_port, baremetal_port in bmc_bm_port_pairs:
baremetal = nova.servers.get(baremetal_port['device_id'])
node = dict(node_template)
node['pm_addr'] = bmc_port['fixed_ips'][0]['ip_address']
provision_net = provision_net_map.get(baremetal_port['id'])
mac = baremetal.addresses[provision_net][0]['OS-EXT-IPS-MAC:mac_addr']
if args.use_mac:
node['mac'] = [mac]
else:
port = node.setdefault('ports', [{'address': mac}])[0]
if args.physical_network:
if args.id:
port['physical_network'] = re.sub('-' + args.id + '$', '',
provision_net)
else:
port['physical_network'] = provision_net
if not cache.get(baremetal.flavor['id']):
cache[baremetal.flavor['id']] = nova.flavors.get(
baremetal.flavor['id'])
flavor = cache.get(baremetal.flavor['id'])
node['cpu'] = flavor.vcpus
node['memory'] = flavor.ram
node['disk'] = flavor.disk
# NOTE(bnemec): Older versions of Ironic won't allow _ characters in
# node names, so translate to the allowed character -
node['name'] = baremetal.name.replace('_', '-')
# If a node has uefi firmware ironic needs to be aware of this, in nova
# this is set using a image property called "hw_firmware_type"
# NOTE(bnemec): Boot from volume does not have an image associated with
# the instance so we can't do this.
if baremetal.image:
if not cache.get(baremetal.image['id']):
cache[baremetal.image['id']] = glance.images.get(
baremetal.image['id'])
image = cache.get(baremetal.image['id'])
if image.get('hw_firmware_type') == 'uefi':
node['capabilities'] += ",boot_mode:uefi"
else:
node['capabilities'] += ",boot_mode:bios"
else:
# With boot from volume the flavor disk size doesn't matter. We
# need to look up the volume disk size.
cloud = os.environ.get('OS_CLOUD')
cinder = os_client_config.make_client('volume', cloud=cloud)
vol_id = baremetal.to_dict()[
'os-extended-volumes:volumes_attached'][0]['id']
volume = cinder.volumes.get(vol_id)
node['disk'] = volume.size
bm_name_end = baremetal.name[len(baremetal_base):]
if '-' in bm_name_end:
profile = bm_name_end[1:].split('_')[0]
node['capabilities'] += ',profile:%s' % profile
nodes.append(node)
return nodes
def _write_nodes(nodes, extra_nodes, network_details, args):
with open(args.nodes_json, 'w') as node_file:
resulting_json = {'nodes': nodes}
if args.add_undercloud and extra_nodes:
resulting_json['extra_nodes'] = extra_nodes
if args.network_details:
resulting_json['network_details'] = network_details
contents = json.dumps(resulting_json, indent=2)
node_file.write(contents)
print(contents)
print('Wrote node definitions to %s' % args.nodes_json)
def _get_node_profile(node):
parts = node['capabilities'].split(',')
for p in parts:
if p.startswith('profile'):
return p.split(':')[-1]
return ''
def _write_role_nodes(nodes, args):
by_profile = {}
for n in nodes:
by_profile.setdefault(_get_node_profile(n), []).append(n)
# Don't write role-specific files if no roles were used.
if len(by_profile) == 1 and list(by_profile.keys())[0] == '':
return
for profile, profile_nodes in by_profile.items():
filepart = profile
if not profile:
filepart = 'no-profile'
outfile = '%s-%s.json' % (os.path.splitext(args.nodes_json)[0],
filepart)
with open(outfile, 'w') as f:
contents = json.dumps({'nodes': profile_nodes}, indent=2)
f.write(contents)
print(contents)
print('Wrote profile "%s" node definitions to %s' %
(profile, outfile))
def main():
args = _parse_args()
bmc_base, baremetal_base, undercloud_name = _get_names(args)
nova, neutron, glance = _get_clients()
(bm_ports,
bmc_bm_port_pairs,
provision_net_map) = _get_ports(neutron, bmc_base, baremetal_base)
(extra_nodes,
network_details) = _build_network_details(nova, bm_ports, undercloud_name)
nodes = _build_nodes(nova, glance, bmc_bm_port_pairs, provision_net_map,
baremetal_base, args)
_write_nodes(nodes, extra_nodes, network_details, args)
_write_role_nodes(nodes, args)
if __name__ == '__main__':
main()

View File

@ -1,406 +0,0 @@
#!/usr/bin/env python
# Copyright 2016 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import argparse
import sys
import time
import yaml
from heatclient.common import template_utils
import os_client_config
# TODO(sshnaidm): To make this python3 friendly with relative imports
try:
from openstack_virtual_baremetal import auth
except ImportError:
import auth
def _parse_args():
parser = argparse.ArgumentParser(description='Deploy an OVB environment')
parser.add_argument(
'--env', '-e',
help='Path to Heat environment file describing the OVB '
'environment to be deployed. Default: %(default)s',
action='append',
default=[])
parser.add_argument(
'--id',
help='Identifier to add to all resource names. The '
'resulting names will look like undercloud-ID or '
'baremetal-ID. By default no changes will be made to '
'the resource names. If an id is specified, a new '
'environment file will be written to env-ID.yaml. ')
parser.add_argument(
'--name',
help='Name for the Heat stack to be created. Defaults '
'to "baremetal" in a standard deployment. If '
'--quintupleo is specified then the default is '
'"quintupleo".')
parser.add_argument(
'--quintupleo',
help='Deploy a full environment suitable for TripleO '
'development.',
action='store_true',
default=False)
parser.add_argument(
'--role',
help='Additional environment file describing a '
'secondary role to be deployed alongside the '
'primary one described in the main environment.',
action='append',
default=[])
parser.add_argument(
'--poll',
help='Poll until the Heat stack(s) are complete. '
'Automatically enabled when multiple roles are '
'deployed.',
action='store_true',
default=False)
return parser.parse_args()
def _process_args(args):
if args.id:
if not args.quintupleo:
raise RuntimeError('--id requires --quintupleo')
id_env = 'env-%s.yaml' % args.id
if id_env in args.env:
raise ValueError('Input env file "%s" would be overwritten by ID '
'env file. Either rename the input file or '
'change the deploy ID.' % id_env)
if args.role and not args.quintupleo:
raise RuntimeError('--role requires --quintupleo')
# NOTE(bnemec): We changed the way the --env parameter works such that the
# default is no longer 'env.yaml' but instead an empty list. However, for
# compatibility we need to maintain the ability to default to env.yaml
# if --env is not explicitly specified.
if not args.env:
args.env = ['env.yaml']
if args.name:
stack_name = args.name
else:
stack_name = 'baremetal'
if args.quintupleo:
stack_name = 'quintupleo'
if not args.quintupleo:
stack_template = 'templates/virtual-baremetal.yaml'
else:
stack_template = 'templates/quintupleo.yaml'
return stack_name, stack_template
def _add_identifier(env_data, name, identifier, default=None):
"""Append identifier to the end of parameter name in env_data
Look for ``name`` in the ``parameter_defaults`` key of ``env_data`` and
append '-``identifier``' to it.
"""
value = env_data['parameter_defaults'].get(name)
if value is None:
value = default
if value is None:
raise RuntimeError('No base value found when adding id')
if identifier:
value = '%s-%s' % (value, identifier)
env_data['parameter_defaults'][name] = value
def _build_env_data(env_paths):
"""Merge env data from the provided paths
Given a list of files in env_paths, merge the contents of all those
environment files and return the results.
:param env_paths: A list of env files to operate on.
:returns: A dict containing the merged contents of the provided files.
"""
_, env_data = template_utils.process_multiple_environments_and_files(
env_paths)
return env_data
def _generate_id_env(args):
env_data = _build_env_data(args.env)
_add_identifier(env_data, 'provision_net', args.id, default='provision')
_add_identifier(env_data, 'provision_net2', args.id, default='provision2')
_add_identifier(env_data, 'provision_net3', args.id, default='provision3')
_add_identifier(env_data, 'public_net', args.id, default='public')
_add_identifier(env_data, 'baremetal_prefix', args.id, default='baremetal')
role = env_data['parameter_defaults'].get('role')
if role:
_add_identifier(env_data, 'baremetal_prefix', role)
priv_network = env_data['parameter_defaults'].get('private_net_cidr')
if priv_network:
_add_identifier(env_data, 'private_net', args.id, default='private')
_add_identifier(env_data, 'bmc_prefix', args.id, default='bmc')
_add_identifier(env_data, 'undercloud_name', args.id, default='undercloud')
_add_identifier(env_data, 'dhcrelay_prefix', args.id, default='dhcrelay')
_add_identifier(env_data, 'radvd_prefix', args.id, default='radvd')
_add_identifier(env_data, 'overcloud_internal_net', args.id,
default='internal')
_add_identifier(env_data, 'overcloud_storage_net', args.id,
default='storage')
_add_identifier(env_data, 'overcloud_storage_mgmt_net', args.id,
default='storage_mgmt')
_add_identifier(env_data, 'overcloud_tenant_net', args.id,
default='tenant')
# TODO(bnemec): Network names should be parameterized so we don't have to
# hardcode them into deploy.py like this.
_add_identifier(env_data, 'overcloud_internal_net2', args.id,
default='overcloud_internal2')
_add_identifier(env_data, 'overcloud_storage_net2', args.id,
default='overcloud_storage2')
_add_identifier(env_data, 'overcloud_storage_mgmt_net2', args.id,
default='overcloud_storage_mgmt2')
_add_identifier(env_data, 'overcloud_tenant_net2', args.id,
default='overcloud_tenant2')
_add_identifier(env_data, 'overcloud_internal_router', args.id,
default='internal_router')
_add_identifier(env_data, 'overcloud_storage_router', args.id,
default='storage_router')
_add_identifier(env_data, 'overcloud_storage_mgmt_router', args.id,
default='storage_mgmt_router')
_add_identifier(env_data, 'overcloud_tenant_router', args.id,
default='tenant_router')
_add_identifier(env_data, 'provision_router_name', args.id,
default='provision_router')
# We don't modify any resource_registry entries, and because we may be
# writing the new env file to a different path it can break relative paths
# in the resource_registry.
env_data.pop('resource_registry', None)
env_path = 'env-%s.yaml' % args.id
with open(env_path, 'w') as f:
yaml.safe_dump(env_data, f, default_flow_style=False)
return args.env + [env_path]
def _validate_env(args, env_paths):
"""Check for invalid environment configurations
:param args: Argparse args.
:param env_paths: Path(s) of the environment file(s) to validate.
"""
if not args.id:
env_data = _build_env_data(env_paths)
role = env_data.get('parameter_defaults', {}).get('role')
prefix = env_data['parameter_defaults']['baremetal_prefix']
if role and prefix.endswith('-' + role):
raise RuntimeError('baremetal_prefix ends with role name. This '
'will break build-nodes-json. Please choose '
'a different baremetal_prefix or role name.')
for path in env_paths:
if 'port-security.yaml' in path:
print('WARNING: port-security environment file detected. '
'port-security is now the default. The existing '
'port-security environment files are deprecated and may be '
'removed in the future. Please use the environment files '
'without "port-security" in their filename instead.'
)
def _get_heat_client():
return os_client_config.make_client('orchestration',
cloud=auth.OS_CLOUD)
def _deploy(stack_name, stack_template, env_paths, poll):
hclient = _get_heat_client()
template_files, template = template_utils.get_template_contents(
stack_template)
env_files, env = template_utils.process_multiple_environments_and_files(
['templates/resource-registry.yaml'] + env_paths)
all_files = {}
all_files.update(template_files)
all_files.update(env_files)
# NOTE(bnemec): Unfortunately, we can't pass this in as parameter_default
# because the Heat API doesn't accept parameter_defaults.
parameters = {'cloud_data': auth._cloud_json()}
hclient.stacks.create(stack_name=stack_name,
template=template,
environment=env,
files=all_files,
parameters=parameters)
print('Deployment of stack "%s" started.' % stack_name)
if poll:
_poll_stack(stack_name, hclient)
def _poll_stack(stack_name, hclient):
"""Poll status for stack_name until it completes or fails"""
print('Waiting for stack to complete', end="")
done = False
while not done:
print('.', end="")
# By the time we get here we know Heat was up at one point because
# we were able to start the stack create. Therefore, we can
# reasonably guess that any errors from this call are going to be
# transient.
try:
stack = hclient.stacks.get(stack_name, resolve_outputs=False)
except Exception as e:
# Print the error so the user can determine whether they need
# to cancel the deployment, but keep trying otherwise.
print('WARNING: Exception occurred while polling stack: %s' % e)
time.sleep(10)
continue
sys.stdout.flush()
if stack.status == 'COMPLETE':
print('Stack %s created successfully' % stack_name)
done = True
elif stack.status == 'FAILED':
print(stack.to_dict().get('stack_status_reason'))
raise RuntimeError('Failed to create stack %s' % stack_name)
else:
time.sleep(10)
# Abstract out the role file interactions for easier unit testing
def _load_role_data(base_envs, role_file, args):
base_data = _build_env_data(base_envs)
with open(role_file) as f:
role_data = yaml.safe_load(f)
orig_data = _build_env_data(args.env)
return base_data, role_data, orig_data
def _write_role_file(role_env, role_file):
with open(role_file, 'w') as f:
yaml.safe_dump(role_env, f, default_flow_style=False)
def _process_role(role_file, base_envs, stack_name, args):
"""Merge a partial role env with the base env
:param role: Filename of an environment file containing the definition
of the role.
:param base_envs: Filename(s) of the environment file(s) used to deploy the
stack containing shared resources such as the undercloud and
networks.
:param stack_name: Name of the stack deployed using base_envs.
:param args: The command-line arguments object from argparse.
"""
base_data, role_data, orig_data = _load_role_data(base_envs, role_file,
args)
inherited_keys = ['baremetal_image', 'bmc_flavor', 'bmc_image',
'external_net', 'key_name', 'os_auth_url',
'os_password', 'os_tenant', 'os_user',
'private_net', 'provision_net', 'public_net',
'overcloud_internal_net', 'overcloud_storage_mgmt_net',
'overcloud_storage_net', 'overcloud_tenant_net',
]
# Parameters that are inherited but can be overridden by the role
allowed_parameter_keys = ['baremetal_image', 'bmc_flavor', 'key_name',
'provision_net', 'overcloud_internal_net',
'overcloud_storage_net',
'overcloud_storage_mgmt_net',
'overcloud_tenant_net',
]
allowed_registry_keys = ['OS::OVB::BaremetalPorts', 'OS::OVB::BMCPort',
'OS::OVB::UndercloudNetworks', 'OS::OVB::BMC',
]
# NOTE(bnemec): Not sure what purpose this serves. Can probably be removed.
role_env = role_data
# resource_registry is intentionally omitted as it should not be inherited
role_env.setdefault('parameter_defaults', {}).update({
k: v for k, v in base_data.get('parameter_defaults', {}).items()
if k in inherited_keys and
(k not in role_env.get('parameter_defaults', {}) or
k not in allowed_parameter_keys)
})
# Most of the resource_registry should not be included in role envs.
# Only allow specific entries that may be needed.
role_env.setdefault('resource_registry', {})
role_env['resource_registry'] = {
k: v for k, v in role_env['resource_registry'].items()
if k in allowed_registry_keys}
role_reg = role_env['resource_registry']
base_reg = base_data['resource_registry']
for k in allowed_registry_keys:
if k not in role_reg and k in base_reg:
role_reg[k] = base_reg[k]
# We need to start with the unmodified prefix
base_prefix = orig_data['parameter_defaults']['baremetal_prefix']
# But we do need to add the id if one is in use
if args.id:
base_prefix += '-%s' % args.id
bmc_prefix = base_data['parameter_defaults']['bmc_prefix']
role = role_data['parameter_defaults']['role']
if '_' in role:
raise RuntimeError('_ character not allowed in role name "%s".' % role)
role_env['parameter_defaults']['baremetal_prefix'] = ('%s-%s' %
(base_prefix, role))
role_env['parameter_defaults']['bmc_prefix'] = '%s-%s' % (bmc_prefix, role)
# At this time roles are only attached to a single set of networks, so
# we use just the primary network parameters.
def maybe_add_id(role_env, name, args):
"""Add id only if one is not already present
When we inherit network names, they will already have the id present.
However, if the user overrides the network name (for example, when
using multiple routed networks) then it should not have the id.
We can detect which is the case by looking at whether the name already
ends with -id.
"""
if (args.id and
not role_env['parameter_defaults'].get(name, '')
.endswith('-' + args.id)):
_add_identifier(role_env, name, args.id)
maybe_add_id(role_env, 'provision_net', args)
maybe_add_id(role_env, 'overcloud_internal_net', args)
maybe_add_id(role_env, 'overcloud_storage_net', args)
maybe_add_id(role_env, 'overcloud_storage_mgmt_net', args)
maybe_add_id(role_env, 'overcloud_tenant_net', args)
role_env['parameter_defaults']['networks'] = {
'private': role_env['parameter_defaults']['private_net'],
'provision': role_env['parameter_defaults']['provision_net'],
'public': role_env['parameter_defaults']['public_net'],
}
role_file = 'env-%s-%s.yaml' % (stack_name, role)
_write_role_file(role_env, role_file)
return role_file, role
def _deploy_roles(stack_name, args, env_paths):
for r in args.role:
role_env, role_name = _process_role(r, env_paths, stack_name, args)
_deploy(stack_name + '-%s' % role_name,
'templates/virtual-baremetal.yaml',
[role_env], poll=True)
def main():
args = _parse_args()
stack_name, stack_template = _process_args(args)
env_paths = args.env
if args.id:
env_paths = _generate_id_env(args)
_validate_env(args, env_paths)
poll = args.poll
if args.role:
poll = True
_deploy(stack_name, stack_template, env_paths, poll=poll)
_deploy_roles(stack_name, args, env_paths)
if __name__ == '__main__':
main()

View File

@ -1,244 +0,0 @@
#!/usr/bin/env python
# Copyright 2015 Red Hat, Inc.
# Copyright 2015 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Virtual BMC for controlling OpenStack instances, based on fakebmc from
# python-pyghmi
# Sample ipmitool commands:
# ipmitool -I lanplus -U admin -P password -H 127.0.0.1 power on
# ipmitool -I lanplus -U admin -P password -H 127.0.0.1 power status
# ipmitool -I lanplus -U admin -P password -H 127.0.0.1 chassis bootdev pxe|disk # noqa: E501
# ipmitool -I lanplus -U admin -P password -H 127.0.0.1 mc reset cold
import argparse
import os
import sys
import time
from novaclient import exceptions
import os_client_config
import pyghmi.ipmi.bmc as bmc
class OpenStackBmc(bmc.Bmc):
def __init__(self, authdata, port, address, instance, cache_status,
os_cloud):
super(OpenStackBmc, self).__init__(authdata,
port=port,
address=address)
self.novaclient = os_client_config.make_client('compute',
cloud=os_cloud)
self.instance = None
self.cache_status = cache_status
self.cached_status = None
self.cached_task = None
self.target_status = None
# At times the bmc service is started before important things like
# networking have fully initialized. Keep trying to find the
# instance indefinitely, since there's no point in continuing if
# we don't have an instance.
while True:
try:
self.instance = self._find_instance(instance)
if self.instance is not None:
name = self.novaclient.servers.get(self.instance).name
self.log('Managing instance: %s UUID: %s' %
(name, self.instance))
break
except Exception as e:
self.log('Exception finding instance "%s": %s' % (instance, e))
time.sleep(1)
def _find_instance(self, instance):
try:
self.novaclient.servers.get(instance)
return instance
except exceptions.NotFound:
name_regex = '^%s$' % instance
i = self.novaclient.servers.list(search_opts={'name': name_regex})
if len(i) > 1:
self.log('Ambiguous instance name %s' % instance)
sys.exit(1)
try:
return i[0].id
except IndexError:
self.log('Could not find specified instance %s' % instance)
sys.exit(1)
def get_boot_device(self):
"""Return the currently configured boot device"""
server = self.novaclient.servers.get(self.instance)
if server.metadata.get('libvirt:pxe-first'):
retval = 'network'
else:
retval = 'hd'
self.log('Reporting boot device', retval)
return retval
def set_boot_device(self, bootdevice):
"""Set the boot device for the managed instance
:param bootdevice: One of ['network', 'hd] to set the boot device to
network or hard disk respectively.
"""
server = self.novaclient.servers.get(self.instance)
if bootdevice == 'network':
self.novaclient.servers.set_meta_item(
server, 'libvirt:pxe-first', '1'
)
else:
self.novaclient.servers.set_meta_item(
server, 'libvirt:pxe-first', ''
)
self.log('Set boot device to', bootdevice)
def cold_reset(self):
# Reset of the BMC, not managed system, here we will exit the demo
self.log('Shutting down in response to BMC cold reset request')
sys.exit(0)
def _instance_active(self):
no_cached_data = (self.cached_status is None)
instance_changing_state = (self.cached_status != self.target_status)
cache_disabled = (not self.cache_status)
if (no_cached_data or instance_changing_state or cache_disabled):
instance = self.novaclient.servers.get(self.instance)
self.cached_status = instance.status
self.cached_task = getattr(instance, 'OS-EXT-STS:task_state')
instance_is_active = (self.cached_status == 'ACTIVE')
instance_is_shutoff = (self.cached_status == 'SHUTOFF')
instance_is_powering_on = (self.cached_task == 'powering-on')
return (
instance_is_active or
(instance_is_shutoff and instance_is_powering_on)
)
def get_power_state(self):
"""Returns the current power state of the managed instance"""
state = self._instance_active()
self.log('Reporting power state "%s" for instance %s' %
(state, self.instance))
return state
def power_off(self):
"""Stop the managed instance"""
# this should be power down without waiting for clean shutdown
self.target_status = 'SHUTOFF'
if self._instance_active():
try:
self.novaclient.servers.stop(self.instance)
self.log('Powered off %s' % self.instance)
except exceptions.Conflict as e:
# This can happen if we get two requests to start a server in
# short succession. The instance may then be in a powering-on
# state, which means it is invalid to start it again.
self.log('Ignoring exception: "%s"' % e)
else:
self.log('%s is already off.' % self.instance)
def power_on(self):
"""Start the managed instance"""
self.target_status = 'ACTIVE'
if not self._instance_active():
try:
self.novaclient.servers.start(self.instance)
self.log('Powered on %s' % self.instance)
except exceptions.Conflict as e:
# This can happen if we get two requests to start a server in
# short succession. The instance may then be in a powering-on
# state, which means it is invalid to start it again.
self.log('Ignoring exception: "%s"' % e)
else:
self.log('%s is already on.' % self.instance)
def power_reset(self):
"""Not implemented"""
print('WARNING: Received request for unimplemented action power_reset')
def power_shutdown(self):
"""Stop the managed instance"""
# should attempt a clean shutdown
self.target_status = 'SHUTOFF'
self.novaclient.servers.stop(self.instance)
self.log('Politely shut down %s' % self.instance)
def log(self, *msg):
"""Helper function that prints msg and flushes stdout"""
print(' '.join(msg))
sys.stdout.flush()
def main():
parser = argparse.ArgumentParser(
prog='openstackbmc',
description='Virtual BMC for controlling OpenStack instance',
)
parser.add_argument('--bmcuser',
dest='bmcuser',
default=os.environ.get('BMC_USER', 'admin'),
help='Username to use for virtual BMC, defaults to '
'admin')
parser.add_argument('--bmcpass',
dest='bmcpass',
default=os.environ.get('BMC_PASSWORD', 'password'),
help='Password to use for virtual BMC, defaults to '
'password')
parser.add_argument('--port',
dest='port',
type=int,
default=os.environ.get('BMC_PORT', 623),
help='Port to listen on; defaults to 623')
parser.add_argument('--address',
dest='address',
default=os.environ.get('BMC_ADDRESS', '::'),
help='Address to bind to; defaults to ::')
parser.add_argument('--instance',
dest='instance',
default=os.environ.get('INSTANCE_ID'),
help='The uuid or name of the OpenStack instance '
'to manage')
parser.add_argument('--cache-status',
dest='cache_status',
default=False,
action='store_true',
help='Cache the status of the managed instance. This '
'can reduce load on the host cloud, but if the '
'instance status is changed outside the BMC then '
'it may become out of sync.')
parser.add_argument('--os-cloud',
dest='os_cloud',
default=os.environ.get('OS_CLOUD'),
help='Use the specified cloud from clouds.yaml. '
'Defaults to the OS_CLOUD environment variable.')
args = parser.parse_args()
# Default to ipv6 format, but if we get an ipv4 address passed in use the
# appropriate format for pyghmi to listen on it.
addr_format = '%s'
if ':' not in args.address:
addr_format = '::ffff:%s'
mybmc = OpenStackBmc({args.bmcuser: args.bmcpass}, port=args.port,
address=addr_format % args.address,
instance=args.instance,
cache_status=args.cache_status,
os_cloud=args.os_cloud)
mybmc.listen()
if __name__ == '__main__':
main()

View File

@ -1,162 +0,0 @@
# Copyright 2017 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import fixtures
import json
import testtools
from openstack_virtual_baremetal import auth
class TestCreateAuthParameters(testtools.TestCase):
@mock.patch('openstack_virtual_baremetal.auth.OS_CLOUD', 'foo')
@mock.patch('os_client_config.OpenStackConfig')
def test_create_auth_parameters_os_cloud(self, mock_osc):
mock_data = mock.Mock()
mock_data.config = {'auth': {'username': 'admin',
'password': 'password',
'project_name': 'admin',
'auth_url': 'http://host:5000',
}}
mock_instance = mock.Mock()
mock_instance.get_one_cloud.return_value = mock_data
mock_osc.return_value = mock_instance
result = auth._create_auth_parameters()
expected = {'os_user': 'admin',
'os_password': 'password',
'os_tenant': 'admin',
'os_auth_url': 'http://host:5000',
'os_project': 'admin',
'os_user_domain': '',
'os_project_domain': '',
}
self.assertEqual(expected, result)
@mock.patch('openstack_virtual_baremetal.auth.OS_CLOUD', 'foo')
@mock.patch('os_client_config.OpenStackConfig')
def test_create_auth_parameters_os_cloud_v3_id(self, mock_osc):
mock_data = mock.Mock()
mock_data.config = {'auth': {'username': 'admin',
'password': 'password',
'project_name': 'admin',
'auth_url': 'http://host:5000',
'user_domain_id': 'default',
'project_domain_id': 'default',
}}
mock_instance = mock.Mock()
mock_instance.get_one_cloud.return_value = mock_data
mock_osc.return_value = mock_instance
result = auth._create_auth_parameters()
expected = {'os_user': 'admin',
'os_password': 'password',
'os_tenant': 'admin',
'os_auth_url': 'http://host:5000',
'os_project': 'admin',
'os_user_domain': 'default',
'os_project_domain': 'default',
}
self.assertEqual(expected, result)
@mock.patch('openstack_virtual_baremetal.auth.OS_CLOUD', 'foo')
@mock.patch('os_client_config.OpenStackConfig')
def test_create_auth_parameters_os_cloud_v3_name(self, mock_osc):
mock_data = mock.Mock()
mock_data.config = {'auth': {'username': 'admin',
'password': 'password',
'project_name': 'admin',
'auth_url': 'http://host:5000',
'user_domain_name': 'default',
'project_domain_name': 'default',
}}
mock_instance = mock.Mock()
mock_instance.get_one_cloud.return_value = mock_data
mock_osc.return_value = mock_instance
result = auth._create_auth_parameters()
expected = {'os_user': 'admin',
'os_password': 'password',
'os_tenant': 'admin',
'os_auth_url': 'http://host:5000',
'os_project': 'admin',
'os_user_domain': 'default',
'os_project_domain': 'default',
}
self.assertEqual(expected, result)
def test_create_auth_parameters_env_v3(self):
self.useFixture(fixtures.EnvironmentVariable('OS_USERNAME', 'admin'))
self.useFixture(fixtures.EnvironmentVariable('OS_PASSWORD', 'pw'))
self.useFixture(fixtures.EnvironmentVariable('OS_TENANT_NAME',
'admin'))
self.useFixture(fixtures.EnvironmentVariable('OS_AUTH_URL', 'auth/v3'))
self.useFixture(fixtures.EnvironmentVariable('OS_PROJECT_NAME',
'admin'))
self.useFixture(fixtures.EnvironmentVariable('OS_USER_DOMAIN_ID',
'default'))
self.useFixture(fixtures.EnvironmentVariable('OS_PROJECT_DOMAIN_ID',
'default'))
result = auth._create_auth_parameters()
expected = {'os_user': 'admin',
'os_password': 'pw',
'os_tenant': 'admin',
'os_auth_url': 'auth/v3',
'os_project': 'admin',
'os_user_domain': 'default',
'os_project_domain': 'default',
}
self.assertEqual(expected, result)
def test_create_auth_parameters_env_name(self):
self.useFixture(fixtures.EnvironmentVariable('OS_USERNAME', 'admin'))
self.useFixture(fixtures.EnvironmentVariable('OS_PASSWORD', 'pw'))
self.useFixture(fixtures.EnvironmentVariable('OS_TENANT_NAME',
None))
self.useFixture(fixtures.EnvironmentVariable('OS_AUTH_URL', 'auth/v3'))
self.useFixture(fixtures.EnvironmentVariable('OS_PROJECT_NAME',
'admin'))
self.useFixture(fixtures.EnvironmentVariable('OS_USER_DOMAIN_NAME',
'default'))
self.useFixture(fixtures.EnvironmentVariable('OS_PROJECT_DOMAIN_NAME',
'default'))
result = auth._create_auth_parameters()
expected = {'os_user': 'admin',
'os_password': 'pw',
'os_tenant': 'admin',
'os_auth_url': 'auth/v3',
'os_project': 'admin',
'os_user_domain': 'default',
'os_project_domain': 'default',
}
self.assertEqual(expected, result)
class TestCloudJSON(testtools.TestCase):
@mock.patch('openstack_virtual_baremetal.auth.OS_CLOUD', 'foo')
@mock.patch('os_client_config.OpenStackConfig')
def test_cloud_json(self, mock_osc):
mock_data = mock.Mock()
mock_data.config = {'auth': {'username': 'admin',
'password': 'password',
'project_name': 'admin',
'auth_url': 'http://host:5000',
'user_domain_name': 'default',
'project_domain_name': 'default',
}}
mock_instance = mock.Mock()
mock_instance.get_one_cloud.return_value = mock_data
mock_osc.return_value = mock_instance
result = auth._cloud_json()
expected = json.dumps(mock_data.config)
self.assertEqual(expected, result)

View File

@ -1,721 +0,0 @@
# Copyright 2016 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
import json
import sys
from unittest import mock
import fixtures
import testtools
from openstack_virtual_baremetal import build_nodes_json
TEST_NODES = [{'arch': 'x86_64',
'capabilities': 'boot_option:local,boot_mode:bios',
'cpu': 128,
'disk': 1024,
'ports': [{'address': 'aa:aa:aa:aa:aa:aa'}],
'memory': 145055,
'name': 'bm-0',
'pm_addr': '1.1.1.1',
'pm_password': 'password',
'pm_type': 'pxe_ipmitool',
'pm_user': 'admin'},
{'arch': 'x86_64',
'capabilities': 'boot_option:local',
'cpu': 128,
'disk': 1024,
'ports': [{'address': 'aa:aa:aa:aa:aa:ab'}],
'memory': 145055,
'name': 'bm-1',
'pm_addr': '1.1.1.2',
'pm_password': 'password',
'pm_type': 'pxe_ipmitool',
'pm_user': 'admin'}]
class TestBuildNodesJson(testtools.TestCase):
def test_parse_args(self):
mock_argv = ['build-nodes-json', '--env', 'foo.yaml', '--bmc_prefix',
'bmc-foo', '--baremetal_prefix', 'baremetal-foo',
'--provision_net', 'provision-foo', '--nodes_json',
'nodes-foo.json', '--driver', 'ipmi',
'--physical_network', '--use-mac'
]
with mock.patch.object(sys, 'argv', mock_argv):
args = build_nodes_json._parse_args()
self.assertEqual('foo.yaml', args.env)
self.assertEqual('bmc-foo', args.bmc_prefix)
self.assertEqual('baremetal-foo', args.baremetal_prefix)
self.assertEqual('provision-foo', args.provision_net)
self.assertEqual('nodes-foo.json', args.nodes_json)
self.assertEqual('ipmi', args.driver)
self.assertTrue(args.physical_network)
self.assertTrue(args.use_mac)
def test_get_names_no_env(self):
args = mock.Mock()
args.env = None
args.bmc_prefix = 'bmc-foo'
args.baremetal_prefix = 'baremetal-foo'
args.add_undercloud = False
bmc_base, baremetal_base, undercloud_name = (
build_nodes_json._get_names(args))
self.assertEqual('bmc-foo', bmc_base)
self.assertEqual('baremetal-foo', baremetal_base)
self.assertEqual('undercloud', undercloud_name)
def test_get_names_no_env_w_undercloud(self):
args = mock.Mock()
args.env = None
args.bmc_prefix = 'bmc-foo'
args.baremetal_prefix = 'baremetal-foo'
args.add_undercloud = True
bmc_base, baremetal_base, undercloud_name = (
build_nodes_json._get_names(args))
self.assertEqual('bmc-foo', bmc_base)
self.assertEqual('baremetal-foo', baremetal_base)
self.assertEqual('undercloud', undercloud_name)
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
@mock.patch('yaml.safe_load')
def test_get_names_env(self, mock_load, mock_open):
args = mock.Mock()
args.env = 'foo.yaml'
args.add_undercloud = False
mock_env = {
'parameter_defaults': {
'bmc_prefix': 'bmc-foo',
'baremetal_prefix': 'baremetal-foo',
},
}
mock_load.return_value = mock_env
bmc_base, baremetal_base, undercloud_name = (
build_nodes_json._get_names(args))
self.assertEqual('bmc-foo', bmc_base)
self.assertEqual('baremetal-foo', baremetal_base)
self.assertIsNone(undercloud_name)
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
@mock.patch('yaml.safe_load')
def test_get_names_env_no_role(self, mock_load, mock_open):
args = mock.Mock()
args.env = 'foo.yaml'
args.add_undercloud = False
mock_env = {
'parameter_defaults': {
'bmc_prefix': 'bmc',
'baremetal_prefix': 'baremetal',
'role': 'foo',
},
}
mock_load.return_value = mock_env
bmc_base, baremetal_base, undercloud_name = (
build_nodes_json._get_names(args))
self.assertEqual('bmc', bmc_base)
self.assertEqual('baremetal', baremetal_base)
self.assertIsNone(undercloud_name)
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
@mock.patch('yaml.safe_load')
def test_get_names_env_strip_role(self, mock_load, mock_open):
args = mock.Mock()
args.env = 'foo.yaml'
args.add_undercloud = False
mock_env = {
'parameter_defaults': {
'bmc_prefix': 'bmc-foo',
'baremetal_prefix': 'baremetal-foo-bar',
'role': 'bar',
},
}
mock_load.return_value = mock_env
bmc_base, baremetal_base, undercloud_name = (
build_nodes_json._get_names(args))
self.assertEqual('bmc-foo', bmc_base)
self.assertEqual('baremetal-foo', baremetal_base)
self.assertIsNone(undercloud_name)
@mock.patch('os_client_config.make_client')
def test_get_clients_os_cloud(self, mock_make_client):
self.useFixture(fixtures.EnvironmentVariable('OS_CLOUD', 'foo'))
build_nodes_json._get_clients()
calls = [mock.call('compute', cloud='foo'),
mock.call('network', cloud='foo'),
mock.call('image', cloud='foo')]
self.assertEqual(calls, mock_make_client.mock_calls)
@mock.patch('os_client_config.make_client')
def test_get_clients_os_cloud_unset(self, mock_make_client):
self.useFixture(fixtures.EnvironmentVariable('OS_CLOUD', None))
build_nodes_json._get_clients()
calls = [mock.call('compute', cloud=None),
mock.call('network', cloud=None),
mock.call('image', cloud=None)]
self.assertEqual(calls, mock_make_client.mock_calls)
def test_get_ports(self):
neutron = mock.Mock()
fake_fixed_ips = [{'subnet_id': 'provision_id'}]
fake_ports = {
'ports': [
{'name': 'random',
'id': 'random_id',
'fixed_ips': fake_fixed_ips},
{'name': 'bmc_1',
'id': 'bmc_1_id',
'fixed_ips': fake_fixed_ips},
{'name': 'bmc_0',
'id': 'bmc_0_id',
'fixed_ips': fake_fixed_ips},
{'name': 'baremetal_1',
'id': 'baremetal_1_id',
'fixed_ips': fake_fixed_ips},
{'name': 'baremetal_0',
'id': 'baremetal_0_id',
'fixed_ips': fake_fixed_ips},
]
}
fake_subnets = {
'subnets': [
{'name': 'provision',
'id': 'provision_id'}
]
}
neutron.list_ports.return_value = fake_ports
neutron.list_subnets.return_value = fake_subnets
(bm_ports,
bmc_bm_port_pairs,
provision_net_map) = build_nodes_json._get_ports(
neutron, 'bmc', 'baremetal')
self.assertEqual([fake_ports['ports'][4], fake_ports['ports'][3]],
bm_ports)
self.assertEqual([fake_ports['ports'][2], fake_ports['ports'][1]],
[bmc_port for bmc_port, bm_port in bmc_bm_port_pairs])
self.assertEqual({'baremetal_0_id': 'provision',
'baremetal_1_id': 'provision'}, provision_net_map)
def test_get_ports_mismatch(self):
neutron = mock.Mock()
fake_ports = {'ports': [{'name': 'bmc_0'}]}
neutron.list_ports.return_value = fake_ports
self.assertRaises(RuntimeError, build_nodes_json._get_ports, neutron,
'bmc', 'baremetal')
def test_get_ports_multiple(self):
neutron = mock.Mock()
fake_fixed_ips = [{'subnet_id': 'provision_id'}]
fake_ports = {
'ports': [
{'name': 'random',
'id': 'random_id',
'fixed_ips': fake_fixed_ips},
{'name': 'bmc-foo_0',
'id': 'bmc_foo_0_id',
'fixed_ips': fake_fixed_ips},
{'name': 'bmc-bar_0',
'id': 'bmc_bar_0_id',
'fixed_ips': fake_fixed_ips},
{'name': 'baremetal-foo_0',
'id': 'baremetal_foo_0_id',
'fixed_ips': fake_fixed_ips},
{'name': 'baremetal-bar_0',
'id': 'baremetal_bar_0_id',
'fixed_ips': fake_fixed_ips},
]
}
fake_subnets = {
'subnets': [
{'name': 'provision',
'id': 'provision_id'}
]
}
neutron.list_ports.return_value = fake_ports
neutron.list_subnets.return_value = fake_subnets
(bm_ports,
bmc_bm_port_pairs,
provision_net_map) = build_nodes_json._get_ports(
neutron, '<bmc-foo', 'baremetal-foo')
self.assertEqual([fake_ports['ports'][3]], bm_ports)
for bmc_port, bm_port in bmc_bm_port_pairs:
self.assertEqual([fake_ports['ports'][1]], bmc_port)
self.assertEqual([fake_ports['ports'][3]], bm_port)
def _fake_port(self, device_id, ip, mac):
return {'device_id': device_id,
'fixed_ips': [{'ip_address': ip}],
}
def _create_build_nodes_mocks(self, nova, servers,
provision_net='provision'):
nova.servers.get.side_effect = servers
servers[0].name = 'bm_0'
servers[0].flavor = {'id': '1'}
servers[0].addresses = {provision_net: [
{'OS-EXT-IPS-MAC:mac_addr': 'aa:aa:aa:aa:aa:aa',
'addr': '2.1.1.1'}]}
servers[0].image = {'id': 'f00'}
servers[0].id = '123abc'
servers[1].name = 'bm_1'
servers[1].flavor = {'id': '1'}
servers[1].addresses = {provision_net: [
{'OS-EXT-IPS-MAC:mac_addr': 'aa:aa:aa:aa:aa:ab',
'addr': '2.1.1.2'}]}
servers[1].image = {'id': 'f00'}
servers[1].id = '456def'
mock_flavor = mock.Mock()
mock_flavor.vcpus = 128
mock_flavor.ram = 145055
mock_flavor.disk = 1024
nova.flavors.get.return_value = mock_flavor
@mock.patch('os_client_config.make_client')
def test_build_network_details(self, mock_make_client):
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers)
servers[1].image = None
mock_to_dict = {'os-extended-volumes:volumes_attached':
[{'id': 'v0lume'}]}
servers[1].to_dict.return_value = mock_to_dict
mock_cinder = mock.Mock()
mock_make_client.return_value = mock_cinder
mock_vol = mock.Mock()
mock_vol.size = 100
mock_cinder.volumes.get.return_value = mock_vol
servers[2].name = 'undercloud'
servers[2].flavor = {'id': '1'}
servers[2].addresses = {'provision': [{'OS-EXT-IPS-MAC:mac_addr':
'aa:aa:aa:aa:aa:ac'}]}
servers[2].image = {'id': 'f00'}
nova.servers.list.return_value = [servers[2]]
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
(extra_nodes,
network_details) = build_nodes_json._build_network_details(
nova, bm_ports, 'undercloud')
self.assertEqual(1, len(extra_nodes))
self.assertEqual('undercloud', extra_nodes[0]['name'])
self.assertEqual(
'2.1.1.1', network_details['bm_0']['ips']['provision'][0]['addr'])
self.assertEqual(
'2.1.1.2', network_details['bm_1']['ips']['provision'][0]['addr'])
@mock.patch('os_client_config.make_client')
def test_build_nodes(self, mock_make_client):
args = mock.Mock()
args.physical_network = False
args.use_mac = False
args.driver = 'pxe_ipmitool'
args.id = False
args.interfaces = []
bmc_ports = [{'fixed_ips': [{'ip_address': '1.1.1.1'}]},
{'fixed_ips': [{'ip_address': '1.1.1.2'}]}
]
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
provision_net_map = {'port_id_server1': 'provision',
'port_id_server2': 'provision',
'port_id_server3': 'provision', }
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers)
servers[1].image = None
mock_to_dict = {'os-extended-volumes:volumes_attached':
[{'id': 'v0lume'}]}
servers[1].to_dict.return_value = mock_to_dict
mock_cinder = mock.Mock()
mock_make_client.return_value = mock_cinder
mock_vol = mock.Mock()
mock_vol.size = 100
mock_cinder.volumes.get.return_value = mock_vol
servers[2].name = 'undercloud'
servers[2].flavor = {'id': '1'}
servers[2].addresses = {'provision': [{'OS-EXT-IPS-MAC:mac_addr':
'aa:aa:aa:aa:aa:ac'}]}
servers[2].image = {'id': 'f00'}
nova.servers.list.return_value = [servers[2]]
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
glance = mock.Mock()
nodes = build_nodes_json._build_nodes(
nova, glance, zip(bmc_ports, bm_ports), provision_net_map, 'bm',
args)
expected_nodes = copy.deepcopy(TEST_NODES)
expected_nodes[1]['disk'] = 100
self.assertEqual(expected_nodes, nodes)
@mock.patch('os_client_config.make_client')
def test_build_nodes_with_driver(self, mock_make_client):
args = mock.Mock()
args.physical_network = False
args.use_mac = False
args.driver = 'ipmi'
args.id = False
args.interfaces = ['boot=pxe']
bmc_ports = [{'fixed_ips': [{'ip_address': '1.1.1.1'}]},
{'fixed_ips': [{'ip_address': '1.1.1.2'}]}
]
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
provision_net_map = {'port_id_server1': 'provision',
'port_id_server2': 'provision',
'port_id_server3': 'provision', }
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers)
servers[1].image = None
mock_to_dict = {'os-extended-volumes:volumes_attached':
[{'id': 'v0lume'}]}
servers[1].to_dict.return_value = mock_to_dict
mock_cinder = mock.Mock()
mock_make_client.return_value = mock_cinder
mock_vol = mock.Mock()
mock_vol.size = 100
mock_cinder.volumes.get.return_value = mock_vol
servers[2].name = 'undercloud'
servers[2].flavor = {'id': '1'}
servers[2].addresses = {'provision': [{'OS-EXT-IPS-MAC:mac_addr':
'aa:aa:aa:aa:aa:ac'}]}
servers[2].image = {'id': 'f00'}
nova.servers.list.return_value = [servers[2]]
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
glance = mock.Mock()
nodes = build_nodes_json._build_nodes(
nova, glance, zip(bmc_ports, bm_ports), provision_net_map, 'bm',
args)
expected_nodes = copy.deepcopy(TEST_NODES)
expected_nodes[1]['disk'] = 100
expected_nodes[0]['boot_interface'] = 'pxe'
expected_nodes[1]['boot_interface'] = 'pxe'
for node in expected_nodes:
node['pm_type'] = 'ipmi'
self.assertEqual(expected_nodes, nodes)
def test_build_nodes_role_uefi(self):
args = mock.Mock()
args.physical_network = False
args.use_mac = False
args.driver = 'pxe_ipmitool'
args.id = False
args.interfaces = []
bmc_ports = [{'fixed_ips': [{'ip_address': '1.1.1.1'}]},
{'fixed_ips': [{'ip_address': '1.1.1.2'}]}
]
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
provision_net_map = {'port_id_server1': 'provision',
'port_id_server2': 'provision',
'port_id_server3': 'provision', }
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers)
servers[0].name = 'bm-foo-control_0'
servers[1].name = 'bm-foo-control_1'
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
glance = mock.Mock()
mock_image_get = mock.Mock()
mock_image_get.get.return_value = 'uefi'
glance.images.get.return_value = mock_image_get
nodes = build_nodes_json._build_nodes(
nova, glance, zip(bmc_ports, bm_ports), provision_net_map,
'bm-foo', args)
expected_nodes = copy.deepcopy(TEST_NODES)
expected_nodes[0]['name'] = 'bm-foo-control-0'
expected_nodes[0]['capabilities'] = ('boot_option:local,'
'boot_mode:uefi,'
'profile:control')
expected_nodes[1]['name'] = 'bm-foo-control-1'
expected_nodes[1]['capabilities'] = ('boot_option:local,'
'boot_mode:uefi,'
'profile:control')
self.assertEqual(expected_nodes, nodes)
@mock.patch('os_client_config.make_client')
def test_build_nodes_use_mac(self, mock_make_client):
args = mock.Mock()
args.physical_network = False
args.use_mac = True
args.driver = 'pxe_ipmitool'
args.id = False
args.interfaces = []
bmc_ports = [{'fixed_ips': [{'ip_address': '1.1.1.1'}]},
{'fixed_ips': [{'ip_address': '1.1.1.2'}]}
]
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
provision_net_map = {'port_id_server1': 'provision',
'port_id_server2': 'provision',
'port_id_server3': 'provision', }
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers)
servers[1].image = None
mock_to_dict = {'os-extended-volumes:volumes_attached':
[{'id': 'v0lume'}]}
servers[1].to_dict.return_value = mock_to_dict
mock_cinder = mock.Mock()
mock_make_client.return_value = mock_cinder
mock_vol = mock.Mock()
mock_vol.size = 100
mock_cinder.volumes.get.return_value = mock_vol
servers[2].name = 'undercloud'
servers[2].flavor = {'id': '1'}
servers[2].addresses = {'provision': [{'OS-EXT-IPS-MAC:mac_addr':
'aa:aa:aa:aa:aa:ac'}]}
servers[2].image = {'id': 'f00'}
nova.servers.list.return_value = [servers[2]]
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
glance = mock.Mock()
nodes = build_nodes_json._build_nodes(
nova, glance, zip(bmc_ports, bm_ports), provision_net_map, 'bm',
args)
expected_nodes = copy.deepcopy(TEST_NODES)
expected_nodes[1]['disk'] = 100
del expected_nodes[0]['ports']
del expected_nodes[1]['ports']
expected_nodes[0]['mac'] = [TEST_NODES[0]['ports'][0]['address']]
expected_nodes[1]['mac'] = [TEST_NODES[1]['ports'][0]['address']]
self.assertEqual(expected_nodes, nodes)
@mock.patch('os_client_config.make_client')
def test_build_nodes_with_physnet(self, mock_make_client):
args = mock.Mock()
args.physical_network = True
args.use_mac = False
args.driver = 'pxe_ipmitool'
args.id = False
args.interfaces = []
bmc_ports = [{'fixed_ips': [{'ip_address': '1.1.1.1'}]},
{'fixed_ips': [{'ip_address': '1.1.1.2'}]}
]
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
provision_net_map = {'port_id_server1': 'provision',
'port_id_server2': 'provision',
'port_id_server3': 'provision', }
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers)
servers[1].image = None
mock_to_dict = {'os-extended-volumes:volumes_attached':
[{'id': 'v0lume'}]}
servers[1].to_dict.return_value = mock_to_dict
mock_cinder = mock.Mock()
mock_make_client.return_value = mock_cinder
mock_vol = mock.Mock()
mock_vol.size = 100
mock_cinder.volumes.get.return_value = mock_vol
servers[2].name = 'undercloud'
servers[2].flavor = {'id': '1'}
servers[2].addresses = {'provision': [{'OS-EXT-IPS-MAC:mac_addr':
'aa:aa:aa:aa:aa:ac'}]}
servers[2].image = {'id': 'f00'}
nova.servers.list.return_value = [servers[2]]
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
glance = mock.Mock()
nodes = build_nodes_json._build_nodes(
nova, glance, zip(bmc_ports, bm_ports), provision_net_map, 'bm',
args)
expected_nodes = copy.deepcopy(TEST_NODES)
expected_nodes[1]['disk'] = 100
expected_nodes[0]['ports'][0]['physical_network'] = 'provision'
expected_nodes[1]['ports'][0]['physical_network'] = 'provision'
self.assertEqual(expected_nodes, nodes)
@mock.patch('os_client_config.make_client')
def test_build_nodes_with_physnet_strip_id(self, mock_make_client):
args = mock.Mock()
args.physical_network = True
args.use_mac = False
args.driver = 'pxe_ipmitool'
args.id = '123'
args.interfaces = []
bmc_ports = [{'fixed_ips': [{'ip_address': '1.1.1.1'}]},
{'fixed_ips': [{'ip_address': '1.1.1.2'}]}
]
bm_ports = [{'device_id': '1', 'id': 'port_id_server1'},
{'device_id': '2', 'id': 'port_id_server2'}]
provision_net_map = {'port_id_server1': 'ctlplane-123',
'port_id_server2': 'ctlplane-123',
'port_id_server3': 'ctlplane-123', }
nova = mock.Mock()
servers = [mock.Mock(), mock.Mock(), mock.Mock()]
self._create_build_nodes_mocks(nova, servers,
provision_net='ctlplane-123')
servers[1].image = None
mock_to_dict = {'os-extended-volumes:volumes_attached':
[{'id': 'v0lume'}]}
servers[1].to_dict.return_value = mock_to_dict
mock_cinder = mock.Mock()
mock_make_client.return_value = mock_cinder
mock_vol = mock.Mock()
mock_vol.size = 100
mock_cinder.volumes.get.return_value = mock_vol
servers[2].name = 'undercloud'
servers[2].flavor = {'id': '1'}
servers[2].addresses = {'ctlplane-123': [
{'OS-EXT-IPS-MAC:mac_addr': 'aa:aa:aa:aa:aa:ac'}]}
servers[2].image = {'id': 'f00'}
nova.servers.list.return_value = [servers[2]]
ips_return_val = 'ips call value'
nova.servers.ips.return_value = ips_return_val
glance = mock.Mock()
nodes = build_nodes_json._build_nodes(
nova, glance, zip(bmc_ports, bm_ports), provision_net_map, 'bm',
args)
expected_nodes = copy.deepcopy(TEST_NODES)
expected_nodes[1]['disk'] = 100
expected_nodes[0]['ports'][0]['physical_network'] = 'ctlplane'
expected_nodes[1]['ports'][0]['physical_network'] = 'ctlplane'
self.assertEqual(expected_nodes, nodes)
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
def test_write_nodes(self, mock_open):
args = mock.Mock()
mock_open.return_value = mock.MagicMock()
args.nodes_json = 'test.json'
args.network_details = False
extra_nodes = []
build_nodes_json._write_nodes(TEST_NODES, extra_nodes, {}, args)
data = json.dumps({'nodes': TEST_NODES}, indent=2)
f = mock_open.return_value.__enter__.return_value
f.write.assert_called_once_with(data)
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
def test_write_nodes_extra_node(self, mock_open):
args = mock.Mock()
mock_open.return_value = mock.MagicMock()
args.nodes_json = 'test.json'
args.network_details = True
extra_nodes = [{'foo': 'bar'}]
network_details = {'bar': 'baz'}
build_nodes_json._write_nodes(TEST_NODES, extra_nodes,
network_details, args)
data = json.dumps({'nodes': TEST_NODES,
'extra_nodes': extra_nodes,
'network_details': network_details}, indent=2)
f = mock_open.return_value.__enter__.return_value
f.write.assert_called_once_with(data)
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
def test_write_role_nodes(self, mock_open):
test_nodes = copy.deepcopy(TEST_NODES)
args = mock.Mock()
args.nodes_json = 'test.json'
build_nodes_json._write_role_nodes(test_nodes, args)
mock_open.assert_not_called()
@mock.patch('openstack_virtual_baremetal.build_nodes_json.open',
create=True)
def test_write_role_nodes_profile(self, mock_open):
test_nodes = copy.deepcopy(TEST_NODES)
test_nodes[1]['capabilities'] = ('boot_option:local,'
'boot_mode:uefi,'
'profile:extra')
args = mock.Mock()
args.nodes_json = 'test.json'
build_nodes_json._write_role_nodes(test_nodes, args)
self.assertIn(mock.call('test-no-profile.json', 'w'),
mock_open.mock_calls)
self.assertIn(mock.call('test-extra.json', 'w'),
mock_open.mock_calls)
f = mock_open.return_value.__enter__.return_value
f.write.assert_any_call(json.dumps({'nodes': [test_nodes[0]]},
indent=2))
f.write.assert_any_call(json.dumps({'nodes': [test_nodes[1]]},
indent=2))
@mock.patch('openstack_virtual_baremetal.build_nodes_json.'
'_write_role_nodes')
@mock.patch('openstack_virtual_baremetal.build_nodes_json._write_nodes')
@mock.patch('openstack_virtual_baremetal.build_nodes_json._build_nodes')
@mock.patch('openstack_virtual_baremetal.build_nodes_json.'
'_build_network_details')
@mock.patch('openstack_virtual_baremetal.build_nodes_json._get_ports')
@mock.patch('openstack_virtual_baremetal.build_nodes_json._get_clients')
@mock.patch('openstack_virtual_baremetal.build_nodes_json._get_names')
@mock.patch('openstack_virtual_baremetal.build_nodes_json._parse_args')
def test_main(self, mock_parse_args, mock_get_names, mock_get_clients,
mock_get_ports, mock_build_net_details, mock_build_nodes,
mock_write_nodes, mock_write_role_nodes):
args = mock.Mock()
mock_parse_args.return_value = args
bmc_base = mock.Mock()
baremetal_base = mock.Mock()
provision_net_map = mock.Mock()
undercloud_name = 'undercloud'
mock_get_names.return_value = (bmc_base, baremetal_base,
undercloud_name)
nova = mock.Mock()
neutron = mock.Mock()
glance = mock.Mock()
mock_get_clients.return_value = (nova, neutron, glance)
bmc_bm_port_pairs = mock.Mock()
bm_ports = mock.Mock()
mock_get_ports.return_value = (bm_ports, bmc_bm_port_pairs,
provision_net_map)
nodes = mock.Mock()
extra_nodes = mock.Mock()
network_details = mock.Mock()
mock_build_net_details.return_value = (extra_nodes, network_details)
mock_build_nodes.return_value = nodes
build_nodes_json.main()
mock_parse_args.assert_called_once_with()
mock_get_names.assert_called_once_with(args)
mock_get_clients.assert_called_once_with()
mock_get_ports.assert_called_once_with(neutron, bmc_base,
baremetal_base)
mock_build_net_details.assert_called_once_with(nova, bm_ports,
undercloud_name)
mock_build_nodes.assert_called_once_with(nova, glance,
bmc_bm_port_pairs,
provision_net_map,
baremetal_base,
args)
mock_write_nodes.assert_called_once_with(nodes, extra_nodes,
network_details, args)
mock_write_role_nodes.assert_called_once_with(nodes, args)

View File

@ -1,473 +0,0 @@
#!/usr/bin/env python
# Copyright 2016 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
from unittest import mock
import unittest
import yaml
import testtools
from openstack_virtual_baremetal import deploy
class TestProcessArgs(unittest.TestCase):
def _basic_mock_args(self):
"""Return a mock with basic args set"""
mock_args = mock.Mock()
mock_args.name = None
mock_args.quintupleo = False
mock_args.id = None
mock_args.env = []
mock_args.role = []
return mock_args
def test_basic(self):
mock_args = self._basic_mock_args()
name, template = deploy._process_args(mock_args)
self.assertEqual('baremetal', name)
self.assertEqual('templates/virtual-baremetal.yaml', template)
def test_name(self):
mock_args = self._basic_mock_args()
mock_args.name = 'foo'
name, template = deploy._process_args(mock_args)
self.assertEqual('foo', name)
self.assertEqual('templates/virtual-baremetal.yaml', template)
def test_quintupleo(self):
mock_args = self._basic_mock_args()
mock_args.quintupleo = True
name, template = deploy._process_args(mock_args)
self.assertEqual('quintupleo', name)
self.assertEqual('templates/quintupleo.yaml', template)
def test_quintupleo_name(self):
mock_args = self._basic_mock_args()
mock_args.name = 'foo'
mock_args.quintupleo = True
name, template = deploy._process_args(mock_args)
self.assertEqual('foo', name)
self.assertEqual('templates/quintupleo.yaml', template)
def test_id_quintupleo(self):
mock_args = self._basic_mock_args()
mock_args.id = 'foo'
self.assertRaises(RuntimeError, deploy._process_args, mock_args)
def test_role_quintupleo(self):
mock_args = self._basic_mock_args()
mock_args.role = 'foo.yaml'
self.assertRaises(RuntimeError, deploy._process_args, mock_args)
def test_maintain_old_default(self):
mock_args = self._basic_mock_args()
mock_args.name = 'foo'
mock_args.quintupleo = True
name, template = deploy._process_args(mock_args)
self.assertEqual('foo', name)
self.assertEqual('templates/quintupleo.yaml', template)
self.assertEqual(['env.yaml'], mock_args.env)
def test_no_overwrite(self):
mock_args = self._basic_mock_args()
mock_args.quintupleo = True
mock_args.id = 'foo'
mock_args.env = ['env-foo.yaml']
self.assertRaises(ValueError, deploy._process_args, mock_args)
test_env = u"""parameter_defaults:
provision_net: provision
public_net: public
baremetal_prefix: baremetal
bmc_prefix: bmc
"""
test_env_extra = u"""
overcloud_internal_net: internalapi
role: ''
"""
test_env_output = {
'baremetal_prefix': 'baremetal-foo',
'undercloud_name': 'undercloud-foo',
'provision_net': 'provision-foo',
'public_net': 'public-foo',
'bmc_prefix': 'bmc-foo',
'overcloud_internal_net': 'internal-foo',
'overcloud_storage_net': 'storage-foo',
'overcloud_storage_mgmt_net': 'storage_mgmt-foo',
'overcloud_tenant_net': 'tenant-foo'
}
class TestIdEnv(unittest.TestCase):
def test_add_identifier(self):
env_data = {'parameter_defaults': {'foo': 'bar'}}
deploy._add_identifier(env_data, 'foo', 'baz')
self.assertEqual('bar-baz', env_data['parameter_defaults']['foo'])
def test_add_identifier_different_section(self):
env_data = {'parameter_defaults': {'foo': 'bar'}}
deploy._add_identifier(env_data, 'foo', 'baz')
self.assertEqual('bar-baz', env_data['parameter_defaults']['foo'])
@mock.patch('openstack_virtual_baremetal.deploy._build_env_data')
@mock.patch('yaml.safe_dump')
def test_generate(self, mock_safe_dump, mock_bed):
mock_args = mock.Mock()
mock_args.id = 'foo'
mock_args.env = ['foo.yaml']
mock_bed.return_value = yaml.safe_load(test_env)
path = deploy._generate_id_env(mock_args)
self.assertEqual(['foo.yaml', 'env-foo.yaml'], path)
dumped_dict = mock_safe_dump.call_args_list[0][0][0]
for k, v in test_env_output.items():
self.assertEqual(v, dumped_dict['parameter_defaults'][k])
@mock.patch('openstack_virtual_baremetal.deploy._build_env_data')
@mock.patch('yaml.safe_dump')
def test_generate_undercloud_name(self, mock_safe_dump, mock_bed):
mock_args = mock.Mock()
mock_args.id = 'foo'
mock_args.env = ['foo.yaml']
env = (test_env + test_env_extra +
' undercloud_name: test-undercloud\n')
mock_bed.return_value = yaml.safe_load(env)
env_output = dict(test_env_output)
env_output['undercloud_name'] = 'test-undercloud-foo'
env_output['overcloud_internal_net'] = 'internalapi-foo'
path = deploy._generate_id_env(mock_args)
self.assertEqual(['foo.yaml', 'env-foo.yaml'], path)
dumped_dict = mock_safe_dump.call_args_list[0][0][0]
for k, v in env_output.items():
self.assertEqual(v, dumped_dict['parameter_defaults'][k])
@mock.patch('openstack_virtual_baremetal.deploy._build_env_data')
@mock.patch('yaml.safe_dump')
def test_generate_with_role(self, mock_safe_dump, mock_bed):
mock_args = mock.Mock()
mock_args.id = 'foo'
mock_args.env = ['foo.yaml']
env = (test_env + test_env_extra)
mock_bed.return_value = yaml.safe_load(env)
mock_bed.return_value['parameter_defaults']['role'] = 'compute'
env_output = dict(test_env_output)
env_output['overcloud_internal_net'] = 'internalapi-foo'
env_output['baremetal_prefix'] = 'baremetal-foo-compute'
path = deploy._generate_id_env(mock_args)
self.assertEqual(['foo.yaml', 'env-foo.yaml'], path)
dumped_dict = mock_safe_dump.call_args_list[0][0][0]
for k, v in env_output.items():
self.assertEqual(v, dumped_dict['parameter_defaults'][k])
# _process_role test data
role_base_data = {
'parameter_defaults': {
'overcloud_storage_mgmt_net': 'storage_mgmt-foo',
'overcloud_internal_net': 'internal-foo',
'overcloud_storage_net': 'storage-foo',
'overcloud_tenant_net': 'tenant-foo',
'provision_net': 'provision-foo',
'public_net': 'public-foo',
'private_net': 'private',
'role': 'control',
'os_user': 'admin',
'key_name': 'default',
'undercloud_name': 'undercloud-foo',
'bmc_image': 'bmc-base',
'baremetal_flavor': 'baremetal',
'os_auth_url': 'http://1.1.1.1:5000/v2.0',
'os_password': 'password',
'os_tenant': 'admin',
'bmc_prefix': 'bmc-foo',
'undercloud_image': 'centos7-base',
'baremetal_image': 'ipxe-boot',
'external_net': 'external',
'baremetal_prefix': 'baremetal-foo-control',
'undercloud_flavor': 'undercloud-16',
'node_count': 3,
'bmc_flavor': 'bmc'
},
'resource_registry': {
'OS::OVB::BaremetalNetworks': 'templates/baremetal-networks-all.yaml',
'OS::OVB::BaremetalPorts':
'templates/baremetal-ports-public-bond.yaml',
'OS::OVB::BMCPort': 'templates/bmc-port.yaml'
}
}
role_specific_data = {
'parameter_defaults': {
'role': 'compute',
'key_name': 'default',
'baremetal_flavor': 'baremetal',
'baremetal_image': 'centos',
'bmc_image': 'bmc-base',
'bmc_prefix': 'bmc',
'node_count': 2,
'bmc_flavor': 'bmc'
},
'resource_registry': {
'OS::OVB::BaremetalNetworks': 'templates/baremetal-networks-all.yaml',
'OS::OVB::BaremetalPorts': 'templates/baremetal-ports-all.yaml'
}
}
role_original_data = {
'parameter_defaults': {
'role': 'control',
'baremetal_prefix': 'baremetal',
'public_net': 'public',
'private_net': 'private',
'provision_net': 'provision',
'os_user': 'admin',
'key_name': 'default',
'undercloud_name': 'undercloud',
'baremetal_flavor': 'baremetal',
'os_auth_url': 'http://1.1.1.1:5000/v2.0',
'bmc_image': 'bmc-base',
'os_tenant': 'admin',
'bmc_prefix': 'bmc',
'undercloud_image': 'centos7-base',
'baremetal_image': 'ipxe-boot',
'external_net': 'external',
'os_password': 'password',
'undercloud_flavor': 'undercloud-16',
'node_count': 3,
'bmc_flavor': 'bmc'
},
'resource_registry': {
'OS::OVB::BaremetalNetworks': 'templates/baremetal-networks-all.yaml',
'OS::OVB::BaremetalPorts':
'templates/baremetal-ports-public-bond.yaml',
'OS::OVB::BMCPort': 'templates/bmc-port.yaml'
}
}
# end _process_role test data
class TestDeploy(testtools.TestCase):
def _test_deploy(self, mock_ghc, mock_tu, mock_poll, mock_cj, poll=False):
mock_client = mock.Mock()
mock_ghc.return_value = mock_client
template_files = {'template.yaml': {'foo': 'bar'}}
template = {'foo': 'bar'}
mock_tu.get_template_contents.return_value = (
template_files, template
)
env_files = {'templates/resource_registry.yaml': {'bar': 'baz'},
'env.yaml': {'parameter_defaults': {}}}
env = {'parameter_defaults': {}}
mock_tu.process_multiple_environments_and_files.return_value = (
env_files, env
)
all_files = {}
all_files.update(template_files)
all_files.update(env_files)
auth = {'os_user': 'admin',
'os_password': 'password',
'os_tenant': 'admin',
'os_auth_url': 'http://1.1.1.1:5000/v2.0',
}
params = {'auth': auth}
expected_params = {'cloud_data': params}
mock_cj.return_value = params
deploy._deploy('test', 'template.yaml', ['env.yaml', 'test.yaml'],
poll)
mock_tu.get_template_contents.assert_called_once_with('template.yaml')
process = mock_tu.process_multiple_environments_and_files
process.assert_called_once_with(['templates/resource-registry.yaml',
'env.yaml', 'test.yaml'])
mock_client.stacks.create.assert_called_once_with(
stack_name='test',
template=template,
environment=env,
files=all_files,
parameters=expected_params)
if not poll:
mock_poll.assert_not_called()
else:
mock_poll.assert_called_once_with('test', mock_client)
@mock.patch('openstack_virtual_baremetal.auth._cloud_json')
@mock.patch('openstack_virtual_baremetal.deploy._poll_stack')
@mock.patch('openstack_virtual_baremetal.deploy.template_utils')
@mock.patch('openstack_virtual_baremetal.deploy._get_heat_client')
def test_deploy(self, mock_ghc, mock_tu, mock_poll, mock_cj):
self._test_deploy(mock_ghc, mock_tu, mock_poll, mock_cj)
@mock.patch('openstack_virtual_baremetal.auth._cloud_json')
@mock.patch('openstack_virtual_baremetal.deploy._poll_stack')
@mock.patch('openstack_virtual_baremetal.deploy.template_utils')
@mock.patch('openstack_virtual_baremetal.deploy._get_heat_client')
def test_deploy_poll(self, mock_ghc, mock_tu, mock_poll, mock_cj):
self._test_deploy(mock_ghc, mock_tu, mock_poll, mock_cj, True)
@mock.patch('time.sleep')
def test_poll(self, mock_sleep):
hclient = mock.Mock()
stacks = [mock.Mock(), mock.Mock()]
stacks[0].status = 'IN_PROGRESS'
stacks[1].status = 'COMPLETE'
hclient.stacks.get.side_effect = stacks
deploy._poll_stack('foo', hclient)
self.assertEqual(
[
mock.call('foo', resolve_outputs=False),
mock.call('foo', resolve_outputs=False)
], hclient.stacks.get.mock_calls)
@mock.patch('time.sleep')
def test_poll_fail(self, mock_sleep):
hclient = mock.Mock()
stacks = [mock.Mock(), mock.Mock()]
stacks[0].status = 'IN_PROGRESS'
stacks[1].status = 'FAILED'
hclient.stacks.get.side_effect = stacks
self.assertRaises(RuntimeError, deploy._poll_stack, 'foo', hclient)
self.assertEqual(
[
mock.call('foo', resolve_outputs=False),
mock.call('foo', resolve_outputs=False)
], hclient.stacks.get.mock_calls)
@mock.patch('time.sleep')
def test_poll_retry(self, mock_sleep):
hclient = mock.Mock()
stacks = [mock.Mock(), Exception, mock.Mock()]
stacks[0].status = 'IN_PROGRESS'
stacks[2].status = 'COMPLETE'
hclient.stacks.get.side_effect = stacks
deploy._poll_stack('foo', hclient)
self.assertEqual(
[
mock.call('foo', resolve_outputs=False),
mock.call('foo', resolve_outputs=False),
mock.call('foo', resolve_outputs=False)
], hclient.stacks.get.mock_calls)
@mock.patch('openstack_virtual_baremetal.deploy._write_role_file')
@mock.patch('openstack_virtual_baremetal.deploy._load_role_data')
def test_process_role(self, mock_load, mock_write):
mock_load.return_value = (role_base_data, role_specific_data,
role_original_data)
args = mock.Mock()
args.id = 'foo'
role_file, role = deploy._process_role('foo-compute.yaml', 'foo.yaml',
'foo', args)
mock_load.assert_called_once_with('foo.yaml', 'foo-compute.yaml', args)
self.assertEqual('env-foo-compute.yaml', role_file)
self.assertEqual('compute', role)
output = mock_write.call_args[0][0]
# These values are computed in _process_role
self.assertEqual('baremetal-foo-compute',
output['parameter_defaults']['baremetal_prefix'])
self.assertEqual('bmc-foo-compute',
output['parameter_defaults']['bmc_prefix'])
# These should be inherited
self.assertEqual('tenant-' + args.id,
output['parameter_defaults']['overcloud_tenant_net'])
self.assertEqual('internal-' + args.id,
output['parameter_defaults']['overcloud_internal_net']
)
self.assertEqual('storage-' + args.id,
output['parameter_defaults']['overcloud_storage_net'])
self.assertEqual('storage_mgmt-' + args.id,
output['parameter_defaults'][
'overcloud_storage_mgmt_net'])
# This parameter should be overrideable
self.assertEqual('centos',
output['parameter_defaults']['baremetal_image'])
# This should not be present in a role env, even if set in the file
self.assertNotIn('OS::OVB::BaremetalNetworks',
output['resource_registry'])
# This should be the value set in the role env, not the base one
self.assertEqual(
'templates/baremetal-ports-all.yaml',
output['resource_registry']['OS::OVB::BaremetalPorts'])
# This should be inherited from the base env
self.assertEqual('templates/bmc-port.yaml',
output['resource_registry']['OS::OVB::BMCPort'])
@mock.patch('openstack_virtual_baremetal.deploy._load_role_data')
def test_process_role_invalid_name(self, mock_load):
bad_role_specific_data = copy.deepcopy(role_specific_data)
bad_role_specific_data['parameter_defaults']['role'] = 'foo_bar'
mock_load.return_value = (role_base_data, bad_role_specific_data,
role_original_data)
args = mock.Mock()
args.id = 'foo'
self.assertRaises(RuntimeError, deploy._process_role,
'foo-foo_bar.yaml', 'foo.yaml', 'foo', args)
@mock.patch('openstack_virtual_baremetal.deploy._deploy')
@mock.patch('openstack_virtual_baremetal.deploy._process_role')
def test_deploy_roles(self, mock_process, mock_deploy):
args = mock.Mock()
args.role = ['foo-compute.yaml']
mock_process.return_value = ('env-foo-compute.yaml', 'compute')
deploy._deploy_roles('foo', args, 'foo.yaml')
mock_process.assert_called_once_with('foo-compute.yaml', 'foo.yaml',
'foo', args)
mock_deploy.assert_called_once_with('foo-compute',
'templates/virtual-baremetal.yaml',
['env-foo-compute.yaml'],
poll=True)
@mock.patch('openstack_virtual_baremetal.deploy._process_role')
def test_deploy_roles_empty(self, mock_process):
args = mock.Mock()
args.role = []
deploy._deploy_roles('foo', args, 'foo.yaml')
mock_process.assert_not_called()
def _test_validate_env_ends_with_profile(self, mock_id, mock_bed):
test_env = dict(role_original_data)
test_env['parameter_defaults']['baremetal_prefix'] = (
'baremetal-control')
mock_bed.return_value = test_env
args = mock.Mock()
args.id = mock_id
if not mock_id:
self.assertRaises(RuntimeError, deploy._validate_env,
args, ['foo.yaml'])
else:
deploy._validate_env(args, ['foo.yaml'])
@mock.patch('openstack_virtual_baremetal.deploy._build_env_data')
def test_validate_env_fails(self, mock_bed):
self._test_validate_env_ends_with_profile(None, mock_bed)
@mock.patch('openstack_virtual_baremetal.deploy._build_env_data')
def test_validate_env_with_id(self, mock_bed):
self._test_validate_env_ends_with_profile('foo', mock_bed)
@mock.patch('openstack_virtual_baremetal.deploy._build_env_data')
def test_validate_env(self, mock_bed):
mock_bed.return_value = role_original_data
args = mock.Mock()
args.id = None
deploy._validate_env(args, ['foo.yaml'])
class TestGetHeatClient(testtools.TestCase):
@mock.patch('openstack_virtual_baremetal.auth.OS_CLOUD', 'foo')
@mock.patch('os_client_config.make_client')
def test_os_cloud(self, mock_make_client):
deploy._get_heat_client()
mock_make_client.assert_called_once_with('orchestration', cloud='foo')
if __name__ == '__main__':
unittest.main()

View File

@ -1,338 +0,0 @@
# Copyright 2016 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sys
from unittest import mock
import unittest
import fixtures
from novaclient import exceptions
import testtools
from openstack_virtual_baremetal import openstackbmc
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'log')
@mock.patch('pyghmi.ipmi.bmc.Bmc.__init__')
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_find_instance')
@mock.patch('os_client_config.make_client')
class TestOpenStackBmcInit(testtools.TestCase):
def test_init_os_cloud(self, mock_make_client, mock_find_instance,
mock_bmc_init, mock_log):
mock_client = mock.Mock()
mock_server = mock.Mock()
mock_server.name = 'foo-instance'
mock_client.servers.get.return_value = mock_server
mock_make_client.return_value = mock_client
mock_find_instance.return_value = 'abc-123'
bmc = openstackbmc.OpenStackBmc(authdata={'admin': 'password'},
port=623,
address='::ffff:127.0.0.1',
instance='foo',
cache_status=False,
os_cloud='bar'
)
mock_make_client.assert_called_once_with('compute', cloud='bar')
mock_find_instance.assert_called_once_with('foo')
self.assertEqual('abc-123', bmc.instance)
mock_client.servers.get.assert_called_once_with('abc-123')
mock_log.assert_called_once_with('Managing instance: %s UUID: %s' %
('foo-instance', 'abc-123'))
@mock.patch('time.sleep')
def test_init_retry(self, _, mock_make_client, mock_find_instance,
mock_bmc_init, mock_log):
self.useFixture(fixtures.EnvironmentVariable('OS_CLOUD', None))
mock_client = mock.Mock()
mock_server = mock.Mock()
mock_server.name = 'foo-instance'
mock_client.servers.get.return_value = mock_server
mock_make_client.return_value = mock_client
mock_find_instance.side_effect = (Exception, 'abc-123')
bmc = openstackbmc.OpenStackBmc(authdata={'admin': 'password'},
port=623,
address='::ffff:127.0.0.1',
instance='foo',
cache_status=False,
os_cloud='foo'
)
mock_make_client.assert_called_once_with('compute', cloud='foo')
find_calls = [mock.call('foo'), mock.call('foo')]
self.assertEqual(find_calls, mock_find_instance.mock_calls)
self.assertEqual('abc-123', bmc.instance)
mock_client.servers.get.assert_called_once_with('abc-123')
log_calls = [mock.call('Exception finding instance "%s": %s' %
('foo', '')),
mock.call('Managing instance: %s UUID: %s' %
('foo-instance', 'abc-123'))
]
self.assertEqual(log_calls, mock_log.mock_calls)
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'__init__', return_value=None)
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'log')
@mock.patch('novaclient.client.Client')
class TestOpenStackBmc(unittest.TestCase):
def _create_bmc(self, mock_nova):
self.mock_client = mock.Mock()
mock_nova.return_value = self.mock_client
self.bmc = openstackbmc.OpenStackBmc(authdata={'admin': 'password'},
port=623,
address='::ffff:127.0.0.1',
instance='foo',
cache_status=False,
os_cloud='bar'
)
self.bmc.novaclient = self.mock_client
self.bmc.instance = 'abc-123'
self.bmc.cached_status = None
self.bmc.cached_task = None
self.bmc.target_status = None
self.bmc.cache_status = False
def test_find_instance(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
self.mock_client.servers.get.return_value = mock_server
instance = self.bmc._find_instance('abc-123')
self.assertEqual('abc-123', instance)
def test_find_instance_by_name(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.id = 'abc-123'
self.mock_client.servers.get.side_effect = exceptions.NotFound('foo')
self.mock_client.servers.list.return_value = [mock_server]
instance = self.bmc._find_instance('abc-123')
self.assertEqual('abc-123', instance)
@mock.patch('sys.exit')
def test_find_instance_multiple(self, mock_exit, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
self.mock_client.servers.get.side_effect = exceptions.NotFound('foo')
self.mock_client.servers.list.return_value = [mock_server, mock_server]
self.bmc._find_instance('abc-123')
mock_exit.assert_called_once_with(1)
@mock.patch('sys.exit')
def test_find_instance_not_found(self, mock_exit, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
self.mock_client.servers.get.side_effect = exceptions.NotFound('foo')
self.mock_client.servers.list.return_value = []
self.bmc._find_instance('abc-123')
mock_exit.assert_called_once_with(1)
def test_get_boot_device(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.metadata.get.return_value = None
self.mock_client.servers.get.return_value = mock_server
device = self.bmc.get_boot_device()
self.assertEqual('hd', device)
def test_get_boot_device_network(self, mock_nova, mock_log, mock_init):
def fake_get(key):
if key == 'libvirt:pxe-first':
return '1'
return ''
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.metadata.get.side_effect = fake_get
self.mock_client.servers.get.return_value = mock_server
device = self.bmc.get_boot_device()
self.assertEqual('network', device)
def test_set_boot_device_hd(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
self.mock_client.servers.get.return_value = mock_server
self.bmc.set_boot_device('hd')
self.mock_client.servers.set_meta_item.assert_called_once_with(
mock_server,
'libvirt:pxe-first',
'')
def test_set_boot_device_net(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
self.mock_client.servers.get.return_value = mock_server
self.bmc.set_boot_device('network')
self.mock_client.servers.set_meta_item.assert_called_once_with(
mock_server,
'libvirt:pxe-first',
'1')
def test_instance_active(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.status = 'ACTIVE'
self.mock_client.servers.get.return_value = mock_server
self.assertTrue(self.bmc._instance_active())
def test_instance_inactive(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.status = 'SHUTOFF'
self.mock_client.servers.get.return_value = mock_server
self.assertFalse(self.bmc._instance_active())
def test_instance_active_mismatch(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.status = 'ACTIVE'
self.mock_client.servers.get.return_value = mock_server
self.bmc.target_status = 'ACTIVE'
self.bmc.cached_status = 'SHUTOFF'
self.bmc.cache_status = True
self.assertTrue(self.bmc._instance_active())
def test_instance_active_cached(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
self.bmc.target_status = 'ACTIVE'
self.bmc.cached_status = 'ACTIVE'
self.bmc.cache_status = True
self.assertTrue(self.bmc._instance_active())
self.assertFalse(self.mock_client.servers.get.called)
def test_instance_active_while_powering_on(self, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_server = mock.Mock()
mock_server.status = 'SHUTOFF'
setattr(mock_server, 'OS-EXT-STS:task_state', 'powering-on')
self.mock_client.servers.get.return_value = mock_server
self.assertTrue(self.bmc._instance_active())
def test_cache_disabled(self, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
self.bmc.target_status = 'ACTIVE'
self.bmc.cached_status = 'ACTIVE'
mock_server = mock.Mock()
mock_server.status = 'SHUTOFF'
self.mock_client.servers.get.return_value = mock_server
self.assertFalse(self.bmc._instance_active())
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_get_power_state(self, mock_active, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = True
self.assertTrue(self.bmc.get_power_state())
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_power_off(self, mock_active, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = True
self.bmc.power_off()
self.mock_client.servers.stop.assert_called_once_with('abc-123')
self.assertEqual('SHUTOFF', self.bmc.target_status)
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_power_off_conflict(self, mock_active, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = True
self.mock_client.servers.stop.side_effect = exceptions.Conflict('a')
self.bmc.power_off()
self.mock_client.servers.stop.assert_called_once_with('abc-123')
mock_log.assert_called_once_with('Ignoring exception: '
'"Conflict (HTTP a)"')
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_power_off_already_off(self, mock_active, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = False
val = self.bmc.power_off()
self.assertIsNone(val)
mock_log.assert_called_once_with('abc-123 is already off.')
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_power_on(self, mock_active, mock_nova, mock_log, mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = False
self.bmc.power_on()
self.mock_client.servers.start.assert_called_once_with('abc-123')
self.assertEqual('ACTIVE', self.bmc.target_status)
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_power_on_conflict(self, mock_active, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = False
self.mock_client.servers.start.side_effect = exceptions.Conflict('a')
self.bmc.power_on()
self.mock_client.servers.start.assert_called_once_with('abc-123')
mock_log.assert_called_once_with('Ignoring exception: '
'"Conflict (HTTP a)"')
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc.'
'_instance_active')
def test_power_on_already_on(self, mock_active, mock_nova, mock_log,
mock_init):
self._create_bmc(mock_nova)
mock_active.return_value = True
val = self.bmc.power_on()
self.assertIsNone(val)
mock_log.assert_called_once_with('abc-123 is already on.')
class TestMain(unittest.TestCase):
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc')
def test_main(self, mock_bmc):
mock_instance = mock.Mock()
mock_bmc.return_value = mock_instance
mock_argv = ['openstackbmc', '--port', '111', '--address', '1.2.3.4',
'--instance', 'foobar', '--os-cloud', 'foo']
with mock.patch.object(sys, 'argv', mock_argv):
openstackbmc.main()
mock_bmc.assert_called_once_with({'admin': 'password'},
port=111,
address='::ffff:1.2.3.4',
instance='foobar',
cache_status=False,
os_cloud='foo'
)
mock_instance.listen.assert_called_once_with()
@mock.patch('openstack_virtual_baremetal.openstackbmc.OpenStackBmc')
def test_main_default_addr(self, mock_bmc):
mock_instance = mock.Mock()
mock_bmc.return_value = mock_instance
mock_argv = ['openstackbmc', '--port', '111',
'--instance', 'foobar', '--os-cloud', 'bar']
with mock.patch.object(sys, 'argv', mock_argv):
openstackbmc.main()
mock_bmc.assert_called_once_with({'admin': 'password'},
port=111,
address='::',
instance='foobar',
cache_status=False,
os_cloud='bar'
)
mock_instance.listen.assert_called_once_with()

View File

@ -1,23 +0,0 @@
Generated Network Isolation Templates
-------------------------------------
These templates were generated by the UI tool at
https://github.com/cybertron/tripleo-scripts#net-iso-genpy
ui-settings.pickle is specific to the tool. TripleO will not use it when
doing deployments with these templates, but it is needed to be able to
load the templates into the UI again. Note that the UI only reads this file,
so any changes made by hand to the templates will not be reflected in the UI.
The network-isolation.yaml file needs to reference the port files shipped with
tripleo-heat-templates, so by default the tool generates the paths assuming
network-isolation.yaml will be copied into the environments/ directory of
tripleo-heat-templates.
If the standard tripleo-heat-templates are in use, then the
network-isolation-absolute.yaml file can be used instead. It has hard-coded
references to the port files in /usr/share/openstack-tripleo-heat-templates.
If the generated network isolation templates are at ~/generated-templates, an
example deployment command would look like:
openstack overcloud deploy --templates -e ~/generated-templates/network-isolation-absolute.yaml -e ~/generated-templates/network-environment.yaml

View File

@ -1,26 +0,0 @@
resource_registry:
OS::TripleO::BlockStorage::Net::SoftwareConfig: nic-configs/cinder-storage.yaml
OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml
OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml
OS::TripleO::ObjectStorage::Net::SoftwareConfig: nic-configs/swift-storage.yaml
OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml
parameter_defaults:
ControlPlaneSubnetCidr: '24'
ControlPlaneDefaultRoute: 192.168.24.1
EC2MetadataIp: 192.168.24.1
ExternalNetCidr: 10.0.0.0/24
ExternalAllocationPools: [{"start": "10.0.0.10", "end": "10.0.0.50"}]
ExternalInterfaceDefaultRoute: 10.0.0.1
NeutronExternalNetworkBridge: "''"
InternalApiNetCidr: 172.17.0.0/24
InternalApiAllocationPools: [{"start": "172.17.0.10", "end": "172.17.0.250"}]
StorageNetCidr: 172.18.0.0/24
StorageAllocationPools: [{"start": "172.18.0.10", "end": "172.18.0.250"}]
StorageMgmtNetCidr: 172.19.0.0/24
StorageMgmtAllocationPools: [{"start": "172.19.0.10", "end": "172.19.0.250"}]
TenantNetCidr: 172.16.0.0/24
TenantAllocationPools: [{"start": "172.16.0.10", "end": "172.16.0.250"}]
DnsServers: ["8.8.8.8", "8.8.4.4"]
BondInterfaceOvsOptions: bond_mode=balance-slb

View File

@ -1,28 +0,0 @@
resource_registry:
# Redis
OS::TripleO::Network::Ports::RedisVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/vip.yaml
# External
OS::TripleO::Network::External: /usr/share/openstack-tripleo-heat-templates/network/external.yaml
OS::TripleO::Network::Ports::ExternalVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/external.yaml
OS::TripleO::Controller::Ports::ExternalPort: /usr/share/openstack-tripleo-heat-templates/network/ports/external.yaml
# InternalApi
OS::TripleO::Network::InternalApi: /usr/share/openstack-tripleo-heat-templates/network/internal_api.yaml
OS::TripleO::Network::Ports::InternalApiVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api.yaml
OS::TripleO::Controller::Ports::InternalApiPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api.yaml
OS::TripleO::Compute::Ports::InternalApiPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api.yaml
# Storage
OS::TripleO::Network::Storage: /usr/share/openstack-tripleo-heat-templates/network/storage.yaml
OS::TripleO::Network::Ports::StorageVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
OS::TripleO::Controller::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
OS::TripleO::Compute::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
OS::TripleO::CephStorage::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
# StorageMgmt
OS::TripleO::Network::StorageMgmt: /usr/share/openstack-tripleo-heat-templates/network/storage_mgmt.yaml
OS::TripleO::Network::Ports::StorageMgmtVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt.yaml
OS::TripleO::Controller::Ports::StorageMgmtPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt.yaml
OS::TripleO::CephStorage::Ports::StorageMgmtPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt.yaml
# Tenant
OS::TripleO::Network::Tenant: /usr/share/openstack-tripleo-heat-templates/network/tenant.yaml
OS::TripleO::Network::Ports::TenantVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
OS::TripleO::Controller::Ports::TenantPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
OS::TripleO::Compute::Ports::TenantPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml

View File

@ -1,28 +0,0 @@
resource_registry:
# Redis
OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/vip.yaml
# External
OS::TripleO::Network::External: ../network/external.yaml
OS::TripleO::Network::Ports::ExternalVipPort: ../network/ports/external.yaml
OS::TripleO::Controller::Ports::ExternalPort: ../network/ports/external.yaml
# InternalApi
OS::TripleO::Network::InternalApi: ../network/internal_api.yaml
OS::TripleO::Network::Ports::InternalApiVipPort: ../network/ports/internal_api.yaml
OS::TripleO::Controller::Ports::InternalApiPort: ../network/ports/internal_api.yaml
OS::TripleO::Compute::Ports::InternalApiPort: ../network/ports/internal_api.yaml
# Storage
OS::TripleO::Network::Storage: ../network/storage.yaml
OS::TripleO::Network::Ports::StorageVipPort: ../network/ports/storage.yaml
OS::TripleO::Controller::Ports::StoragePort: ../network/ports/storage.yaml
OS::TripleO::Compute::Ports::StoragePort: ../network/ports/storage.yaml
OS::TripleO::CephStorage::Ports::StoragePort: ../network/ports/storage.yaml
# StorageMgmt
OS::TripleO::Network::StorageMgmt: ../network/storage_mgmt.yaml
OS::TripleO::Network::Ports::StorageMgmtVipPort: ../network/ports/storage_mgmt.yaml
OS::TripleO::Controller::Ports::StorageMgmtPort: ../network/ports/storage_mgmt.yaml
OS::TripleO::CephStorage::Ports::StorageMgmtPort: ../network/ports/storage_mgmt.yaml
# Tenant
OS::TripleO::Network::Tenant: ../network/tenant.yaml
OS::TripleO::Network::Ports::TenantVipPort: ../network/ports/tenant.yaml
OS::TripleO::Controller::Ports::TenantPort: ../network/ports/tenant.yaml
OS::TripleO::Compute::Ports::TenantPort: ../network/ports/tenant.yaml

View File

@ -1,221 +0,0 @@
heat_template_version: ocata
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
ExternalInterfaceRoutes:
default: []
description: >
Routes for the external network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ExternalMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
external network.
type: number
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
InternalApiInterfaceRoutes:
default: []
description: >
Routes for the internal_api network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
InternalApiMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
internal_api network.
type: number
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageInterfaceRoutes:
default: []
description: >
Routes for the storage network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage network.
type: number
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
StorageMgmtInterfaceRoutes:
default: []
description: >
Routes for the storage_mgmt network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMgmtMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage_mgmt network.
type: number
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
TenantInterfaceRoutes:
default: []
description: >
Routes for the tenant network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
TenantMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
tenant network.
type: number
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
ManagementInterfaceRoutes:
default: []
description: >
Routes for the management network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ManagementMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
management network.
type: number
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
ControlPlaneStaticRoutes:
default: []
description: >
Routes for the ctlplane network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ControlPlaneMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the network.
(The parameter is automatically resolved from the ctlplane network's mtu attribute.)
type: number
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
str_replace:
params:
$network_config:
network_config:
- type: interface
name: nic1
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask:
list_join:
- /
- - {get_param: ControlPlaneIp}
- {get_param: ControlPlaneSubnetCidr}
routes:
- ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- default: true
next_hop: {get_param: ControlPlaneDefaultRoute}
- type: interface
name: nic5
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageIpSubnet}
- type: interface
name: nic6
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageMgmtIpSubnet}
template:
get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
group: script
type: OS::Heat::SoftwareConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,194 +0,0 @@
heat_template_version: ocata
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
ExternalInterfaceRoutes:
default: []
description: >
Routes for the external network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ExternalMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
external network.
type: number
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
InternalApiInterfaceRoutes:
default: []
description: >
Routes for the internal_api network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
InternalApiMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
internal_api network.
type: number
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageInterfaceRoutes:
default: []
description: >
Routes for the storage network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage network.
type: number
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
StorageMgmtInterfaceRoutes:
default: []
description: >
Routes for the storage_mgmt network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMgmtMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage_mgmt network.
type: number
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
TenantInterfaceRoutes:
default: []
description: >
Routes for the tenant network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
TenantMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
tenant network.
type: number
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
ManagementInterfaceRoutes:
default: []
description: >
Routes for the management network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ManagementMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
management network.
type: number
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
ControlPlaneStaticRoutes:
default: []
description: >
Routes for the ctlplane network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ControlPlaneMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the network.
(The parameter is automatically resolved from the ctlplane network's mtu attribute.)
type: number
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
str_replace:
params:
$network_config:
network_config: []
template:
get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
group: script
type: OS::Heat::SoftwareConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,232 +0,0 @@
heat_template_version: ocata
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
ExternalInterfaceRoutes:
default: []
description: >
Routes for the external network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ExternalMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
external network.
type: number
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
InternalApiInterfaceRoutes:
default: []
description: >
Routes for the internal_api network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
InternalApiMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
internal_api network.
type: number
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageInterfaceRoutes:
default: []
description: >
Routes for the storage network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage network.
type: number
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
StorageMgmtInterfaceRoutes:
default: []
description: >
Routes for the storage_mgmt network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMgmtMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage_mgmt network.
type: number
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
TenantInterfaceRoutes:
default: []
description: >
Routes for the tenant network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
TenantMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
tenant network.
type: number
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
ManagementInterfaceRoutes:
default: []
description: >
Routes for the management network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ManagementMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
management network.
type: number
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
ControlPlaneStaticRoutes:
default: []
description: >
Routes for the ctlplane network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ControlPlaneMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the network.
(The parameter is automatically resolved from the ctlplane network's mtu attribute.)
type: number
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
str_replace:
params:
$network_config:
network_config:
- type: interface
name: nic1
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask:
list_join:
- /
- - {get_param: ControlPlaneIp}
- {get_param: ControlPlaneSubnetCidr}
routes:
- ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- default: true
next_hop: {get_param: ControlPlaneDefaultRoute}
- type: interface
name: nic4
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: InternalApiIpSubnet}
- type: interface
name: nic5
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageIpSubnet}
- type: ovs_bridge
name: br-tenant
dns_servers: {get_param: DnsServers}
use_dhcp: false
addresses:
- ip_netmask: {get_param: TenantIpSubnet}
members:
- type: interface
name: nic7
mtu: 1350
primary: true
template:
get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
group: script
type: OS::Heat::SoftwareConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,258 +0,0 @@
heat_template_version: ocata
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
ExternalInterfaceRoutes:
default: []
description: >
Routes for the external network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ExternalMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
external network.
type: number
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
InternalApiInterfaceRoutes:
default: []
description: >
Routes for the internal_api network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
InternalApiMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
internal_api network.
type: number
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageInterfaceRoutes:
default: []
description: >
Routes for the storage network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage network.
type: number
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
StorageMgmtInterfaceRoutes:
default: []
description: >
Routes for the storage_mgmt network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMgmtMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage_mgmt network.
type: number
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
TenantInterfaceRoutes:
default: []
description: >
Routes for the tenant network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
TenantMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
tenant network.
type: number
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
ManagementInterfaceRoutes:
default: []
description: >
Routes for the management network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ManagementMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
management network.
type: number
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
ControlPlaneStaticRoutes:
default: []
description: >
Routes for the ctlplane network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ControlPlaneMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the network.
(The parameter is automatically resolved from the ctlplane network's mtu attribute.)
type: number
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
str_replace:
params:
$network_config:
network_config:
- type: interface
name: nic1
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask:
list_join:
- /
- - {get_param: ControlPlaneIp}
- {get_param: ControlPlaneSubnetCidr}
routes:
- ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- type: ovs_bridge
name: br-ex
dns_servers: {get_param: DnsServers}
use_dhcp: false
addresses:
- ip_netmask: {get_param: ExternalIpSubnet}
routes:
- ip_netmask: 0.0.0.0/0
next_hop: {get_param: ExternalInterfaceDefaultRoute}
members:
- type: ovs_bond
name: bond1
ovs_options: {get_param: BondInterfaceOvsOptions}
members:
- type: interface
name: nic2
mtu: 1350
primary: true
- type: interface
name: nic3
mtu: 1350
primary: false
- type: interface
name: nic4
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: InternalApiIpSubnet}
- type: interface
name: nic5
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageIpSubnet}
- type: interface
name: nic6
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageMgmtIpSubnet}
- type: ovs_bridge
name: br-tenant
dns_servers: {get_param: DnsServers}
use_dhcp: false
addresses:
- ip_netmask: {get_param: TenantIpSubnet}
members:
- type: interface
name: nic7
mtu: 1350
primary: true
template:
get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
group: script
type: OS::Heat::SoftwareConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,194 +0,0 @@
heat_template_version: ocata
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
ExternalInterfaceRoutes:
default: []
description: >
Routes for the external network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ExternalMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
external network.
type: number
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
InternalApiInterfaceRoutes:
default: []
description: >
Routes for the internal_api network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
InternalApiMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
internal_api network.
type: number
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageInterfaceRoutes:
default: []
description: >
Routes for the storage network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage network.
type: number
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
StorageMgmtInterfaceRoutes:
default: []
description: >
Routes for the storage_mgmt network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
StorageMgmtMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
storage_mgmt network.
type: number
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
TenantInterfaceRoutes:
default: []
description: >
Routes for the tenant network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
TenantMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
tenant network.
type: number
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
ManagementInterfaceRoutes:
default: []
description: >
Routes for the management network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ManagementMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the
management network.
type: number
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
ControlPlaneStaticRoutes:
default: []
description: >
Routes for the ctlplane network traffic.
JSON route e.g. [{'destination':'10.0.0.0/16', 'nexthop':'10.0.0.1'}]
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
ControlPlaneMtu:
default: 1500
description: The maximum transmission unit (MTU) size(in bytes) that is
guaranteed to pass through the data path of the segments in the network.
(The parameter is automatically resolved from the ctlplane network's mtu attribute.)
type: number
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
str_replace:
params:
$network_config:
network_config: []
template:
get_file: /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh
group: script
type: OS::Heat::SoftwareConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,699 +0,0 @@
(dp0
S'global_data'
p1
(dp2
S'control'
p3
(dp4
S'route'
p5
V192.168.24.1
p6
sS'mask'
p7
I24
sS'ec2'
p8
V192.168.24.1
p9
ssS'major'
p10
I1
sS'management'
p11
(dp12
S'start'
p13
V172.20.0.10
p14
sS'cidr'
p15
V172.20.0.0/24
p16
sS'vlan'
p17
I6
sS'end'
p18
V172.20.0.250
p19
ssS'dns2'
p20
V8.8.4.4
p21
sS'dns1'
p22
V8.8.8.8
p23
sS'storage'
p24
(dp25
g13
V172.18.0.10
p26
sg15
V172.18.0.0/24
p27
sg17
I3
sg18
V172.18.0.250
p28
ssS'auto_routes'
p29
I01
sS'bond_options'
p30
Vbond_mode=balance-slb
p31
sS'version'
p32
I2
sS'external'
p33
(dp34
S'bridge'
p35
V''
p36
sg18
V10.0.0.50
p37
sg17
I1
sg13
V10.0.0.10
p38
sg15
V10.0.0.0/24
p39
sS'gateway'
p40
V10.0.0.1
p41
ssS'internal_api'
p42
(dp43
g13
V172.17.0.10
p44
sg15
V172.17.0.0/24
p45
sg17
I2
sg18
V172.17.0.250
p46
ssS'ipv6'
p47
I00
sS'storage_mgmt'
p48
(dp49
g13
V172.19.0.10
p50
sg15
V172.19.0.0/24
p51
sg17
I4
sg18
V172.19.0.250
p52
ssS'minor'
p53
I2
sS'tenant'
p54
(dp55
g13
V172.16.0.10
p56
sg15
V172.16.0.0/24
p57
sg17
I5
sg18
V172.16.0.250
p58
sssS'data'
p59
(dp60
S'cinder-storage.yaml'
p61
(lp62
sS'ceph-storage.yaml'
p63
(lp64
(dp65
Vaddresses
p66
(lp67
sVnetwork
p68
VControlPlane
p69
sVprimary
p70
I01
sVmtu
p71
I1350
sS'members'
p72
(lp73
sVroutes
p74
(lp75
sVuse_dhcp
p76
I00
sVtype
p77
Vinterface
p78
sVname
p79
Vnic1
p80
sa(dp81
Vaddresses
p82
(lp83
sVnetwork
p84
VStorage
p85
sVprimary
p86
I01
sVmtu
p87
I1350
sg72
(lp88
sVroutes
p89
(lp90
sVuse_dhcp
p91
I00
sVtype
p92
Vinterface
p93
sVname
p94
Vnic5
p95
sa(dp96
Vaddresses
p97
(lp98
sVnetwork
p99
VStorageMgmt
p100
sVprimary
p101
I01
sVmtu
p102
I1350
sg72
(lp103
sVroutes
p104
(lp105
sVuse_dhcp
p106
I00
sVtype
p107
Vinterface
p108
sVname
p109
Vnic6
p110
sasS'controller.yaml'
p111
(lp112
(dp113
Vaddresses
p114
(lp115
sVnetwork
p116
VControlPlane
p117
sVprimary
p118
I01
sVmtu
p119
I1350
sg72
(lp120
sVroutes
p121
(lp122
sVuse_dhcp
p123
I00
sVtype
p124
Vinterface
p125
sVname
p126
Vnic1
p127
sa(dp128
Vdns_servers
p129
V{get_param: DnsServers}
p130
sVaddresses
p131
(lp132
sVnetwork
p133
VExternal
p134
sVmtu
p135
I-1
sg72
(lp136
(dp137
Vnetwork
p138
VNone
p139
sVbond_type
p140
Vovs
p141
sVovs_options
p142
V{get_param: BondInterfaceOvsOptions}
p143
sVmtu
p144
I-1
sg72
(lp145
(dp146
Vaddresses
p147
(lp148
sVnetwork
p149
VNone
p150
sVprimary
p151
I01
sVmtu
p152
I1350
sVroutes
p153
(lp154
sVuse_dhcp
p155
I00
sVtype
p156
Vinterface
p157
sVname
p158
Vnic2
p159
sa(dp160
Vaddresses
p161
(lp162
sVnetwork
p163
VNone
p164
sVprimary
p165
I00
sVmtu
p166
I1350
sVroutes
p167
(lp168
sVuse_dhcp
p169
I00
sVtype
p170
Vinterface
p171
sVname
p172
Vnic3
p173
sasVroutes
p174
(lp175
sVtype
p176
Vovs_bond
p177
sVname
p178
Vbond1
p179
sasVroutes
p180
(lp181
sVuse_dhcp
p182
I00
sVtype
p183
Vovs_bridge
p184
sVname
p185
Vbr-ex
p186
sa(dp187
Vaddresses
p188
(lp189
sVnetwork
p190
VInternalApi
p191
sVprimary
p192
I01
sVmtu
p193
I1350
sg72
(lp194
sVroutes
p195
(lp196
sVuse_dhcp
p197
I00
sVtype
p198
Vinterface
p199
sVname
p200
Vnic4
p201
sa(dp202
Vaddresses
p203
(lp204
sVnetwork
p205
VStorage
p206
sVprimary
p207
I01
sVmtu
p208
I1350
sg72
(lp209
sVroutes
p210
(lp211
sVuse_dhcp
p212
I00
sVtype
p213
Vinterface
p214
sVname
p215
Vnic5
p216
sa(dp217
Vaddresses
p218
(lp219
sVnetwork
p220
VStorageMgmt
p221
sVprimary
p222
I01
sVmtu
p223
I1350
sg72
(lp224
sVroutes
p225
(lp226
sVuse_dhcp
p227
I00
sVtype
p228
Vinterface
p229
sVname
p230
Vnic6
p231
sa(dp232
Vdns_servers
p233
V{get_param: DnsServers}
p234
sVaddresses
p235
(lp236
sVnetwork
p237
VTenant
p238
sVmtu
p239
I-1
sg72
(lp240
(dp241
Vaddresses
p242
(lp243
sVnetwork
p244
VNone
p245
sVprimary
p246
I01
sVmtu
p247
I1350
sg72
(lp248
sVroutes
p249
(lp250
sVuse_dhcp
p251
I00
sVtype
p252
Vinterface
p253
sVname
p254
Vnic7
p255
sasVroutes
p256
(lp257
sVuse_dhcp
p258
I00
sVtype
p259
Vovs_bridge
p260
sVname
p261
Vbr-tenant
p262
sasS'swift-storage.yaml'
p263
(lp264
sS'compute.yaml'
p265
(lp266
(dp267
Vaddresses
p268
(lp269
sVnetwork
p270
VControlPlane
p271
sVprimary
p272
I01
sVmtu
p273
I1350
sg72
(lp274
sVroutes
p275
(lp276
sVuse_dhcp
p277
I00
sVtype
p278
Vinterface
p279
sVname
p280
Vnic1
p281
sa(dp282
Vaddresses
p283
(lp284
sVnetwork
p285
VInternalApi
p286
sVprimary
p287
I01
sVmtu
p288
I1350
sg72
(lp289
sVroutes
p290
(lp291
sVuse_dhcp
p292
I00
sVtype
p293
Vinterface
p294
sVname
p295
Vnic4
p296
sa(dp297
Vaddresses
p298
(lp299
sVnetwork
p300
VStorage
p301
sVprimary
p302
I01
sVmtu
p303
I1350
sg72
(lp304
sVroutes
p305
(lp306
sVuse_dhcp
p307
I00
sVtype
p308
Vinterface
p309
sVname
p310
Vnic5
p311
sa(dp312
Vdns_servers
p313
V{get_param: DnsServers}
p314
sVaddresses
p315
(lp316
sVnetwork
p317
VTenant
p318
sVmtu
p319
I-1
sg72
(lp320
(dp321
Vaddresses
p322
(lp323
sVnetwork
p324
VNone
p325
sVprimary
p326
I01
sVmtu
p327
I1350
sg72
(lp328
sVroutes
p329
(lp330
sVuse_dhcp
p331
I00
sVtype
p332
Vinterface
p333
sVname
p334
Vnic7
p335
sasVroutes
p336
(lp337
sVuse_dhcp
p338
I00
sVtype
p339
Vovs_bridge
p340
sVname
p341
Vbr-tenant
p342
sass.

View File

@ -1,23 +0,0 @@
Generated Network Isolation Templates
-------------------------------------
These templates were generated by the UI tool at
https://github.com/cybertron/tripleo-scripts#net-iso-genpy
ui-settings.pickle is specific to the tool. TripleO will not use it when
doing deployments with these templates, but it is needed to be able to
load the templates into the UI again. Note that the UI only reads this file,
so any changes made by hand to the templates will not be reflected in the UI.
The network-isolation.yaml file needs to reference the port files shipped with
tripleo-heat-templates, so by default the tool generates the paths assuming
network-isolation.yaml will be copied into the environments/ directory of
tripleo-heat-templates.
If the standard tripleo-heat-templates are in use, then the
network-isolation-absolute.yaml file can be used instead. It has hard-coded
references to the port files in /usr/share/openstack-tripleo-heat-templates.
If the generated network isolation templates are at ~/generated-templates, an
example deployment command would look like:
openstack overcloud deploy --templates -e ~/generated-templates/network-isolation-absolute.yaml -e ~/generated-templates/network-environment.yaml

View File

@ -1,26 +0,0 @@
resource_registry:
OS::TripleO::BlockStorage::Net::SoftwareConfig: nic-configs/cinder-storage.yaml
OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml
OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml
OS::TripleO::ObjectStorage::Net::SoftwareConfig: nic-configs/swift-storage.yaml
OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml
parameter_defaults:
ControlPlaneSubnetCidr: '24'
ControlPlaneDefaultRoute: 192.168.24.1
EC2MetadataIp: 192.168.24.1
ExternalNetCidr: 10.0.0.0/24
ExternalAllocationPools: [{"start": "10.0.0.10", "end": "10.0.0.50"}]
ExternalInterfaceDefaultRoute: 10.0.0.1
NeutronExternalNetworkBridge: "''"
InternalApiNetCidr: 172.17.0.0/24
InternalApiAllocationPools: [{"start": "172.17.0.10", "end": "172.17.0.250"}]
StorageNetCidr: 172.18.0.0/24
StorageAllocationPools: [{"start": "172.18.0.10", "end": "172.18.0.250"}]
StorageMgmtNetCidr: 172.19.0.0/24
StorageMgmtAllocationPools: [{"start": "172.19.0.10", "end": "172.19.0.250"}]
TenantNetCidr: 172.16.0.0/24
TenantAllocationPools: [{"start": "172.16.0.10", "end": "172.16.0.250"}]
DnsServers: ["8.8.8.8", "8.8.4.4"]
BondInterfaceOvsOptions: bond_mode=balance-slb

View File

@ -1,28 +0,0 @@
resource_registry:
# Redis
OS::TripleO::Network::Ports::RedisVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/vip.yaml
# External
OS::TripleO::Network::External: /usr/share/openstack-tripleo-heat-templates/network/external.yaml
OS::TripleO::Network::Ports::ExternalVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/external.yaml
OS::TripleO::Controller::Ports::ExternalPort: /usr/share/openstack-tripleo-heat-templates/network/ports/external.yaml
# InternalApi
OS::TripleO::Network::InternalApi: /usr/share/openstack-tripleo-heat-templates/network/internal_api.yaml
OS::TripleO::Network::Ports::InternalApiVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api.yaml
OS::TripleO::Controller::Ports::InternalApiPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api.yaml
OS::TripleO::Compute::Ports::InternalApiPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api.yaml
# Storage
OS::TripleO::Network::Storage: /usr/share/openstack-tripleo-heat-templates/network/storage.yaml
OS::TripleO::Network::Ports::StorageVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
OS::TripleO::Controller::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
OS::TripleO::Compute::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
OS::TripleO::CephStorage::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage.yaml
# StorageMgmt
OS::TripleO::Network::StorageMgmt: /usr/share/openstack-tripleo-heat-templates/network/storage_mgmt.yaml
OS::TripleO::Network::Ports::StorageMgmtVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt.yaml
OS::TripleO::Controller::Ports::StorageMgmtPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt.yaml
OS::TripleO::CephStorage::Ports::StorageMgmtPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt.yaml
# Tenant
OS::TripleO::Network::Tenant: /usr/share/openstack-tripleo-heat-templates/network/tenant.yaml
OS::TripleO::Network::Ports::TenantVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
OS::TripleO::Controller::Ports::TenantPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
OS::TripleO::Compute::Ports::TenantPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml

View File

@ -1,28 +0,0 @@
resource_registry:
# Redis
OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/vip.yaml
# External
OS::TripleO::Network::External: ../network/external.yaml
OS::TripleO::Network::Ports::ExternalVipPort: ../network/ports/external.yaml
OS::TripleO::Controller::Ports::ExternalPort: ../network/ports/external.yaml
# InternalApi
OS::TripleO::Network::InternalApi: ../network/internal_api.yaml
OS::TripleO::Network::Ports::InternalApiVipPort: ../network/ports/internal_api.yaml
OS::TripleO::Controller::Ports::InternalApiPort: ../network/ports/internal_api.yaml
OS::TripleO::Compute::Ports::InternalApiPort: ../network/ports/internal_api.yaml
# Storage
OS::TripleO::Network::Storage: ../network/storage.yaml
OS::TripleO::Network::Ports::StorageVipPort: ../network/ports/storage.yaml
OS::TripleO::Controller::Ports::StoragePort: ../network/ports/storage.yaml
OS::TripleO::Compute::Ports::StoragePort: ../network/ports/storage.yaml
OS::TripleO::CephStorage::Ports::StoragePort: ../network/ports/storage.yaml
# StorageMgmt
OS::TripleO::Network::StorageMgmt: ../network/storage_mgmt.yaml
OS::TripleO::Network::Ports::StorageMgmtVipPort: ../network/ports/storage_mgmt.yaml
OS::TripleO::Controller::Ports::StorageMgmtPort: ../network/ports/storage_mgmt.yaml
OS::TripleO::CephStorage::Ports::StorageMgmtPort: ../network/ports/storage_mgmt.yaml
# Tenant
OS::TripleO::Network::Tenant: ../network/tenant.yaml
OS::TripleO::Network::Ports::TenantVipPort: ../network/ports/tenant.yaml
OS::TripleO::Controller::Ports::TenantPort: ../network/ports/tenant.yaml
OS::TripleO::Compute::Ports::TenantPort: ../network/ports/tenant.yaml

View File

@ -1,119 +0,0 @@
heat_template_version: 2015-04-30
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
os_net_config:
network_config:
- type: interface
name: nic1
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask:
list_join:
- /
- - {get_param: ControlPlaneIp}
- {get_param: ControlPlaneSubnetCidr}
routes:
- ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- default: true
next_hop: {get_param: ControlPlaneDefaultRoute}
- type: interface
name: nic5
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageIpSubnet}
- type: interface
name: nic6
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageMgmtIpSubnet}
group: os-apply-config
type: OS::Heat::StructuredConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,92 +0,0 @@
heat_template_version: 2015-04-30
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
os_net_config:
network_config: []
group: os-apply-config
type: OS::Heat::StructuredConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,130 +0,0 @@
heat_template_version: 2015-04-30
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
os_net_config:
network_config:
- type: interface
name: nic1
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask:
list_join:
- /
- - {get_param: ControlPlaneIp}
- {get_param: ControlPlaneSubnetCidr}
routes:
- ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- default: true
next_hop: {get_param: ControlPlaneDefaultRoute}
- type: interface
name: nic4
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: InternalApiIpSubnet}
- type: interface
name: nic5
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageIpSubnet}
- type: ovs_bridge
name: br-tenant
dns_servers: {get_param: DnsServers}
use_dhcp: false
addresses:
- ip_netmask: {get_param: TenantIpSubnet}
members:
- type: interface
name: nic7
mtu: 1350
primary: true
group: os-apply-config
type: OS::Heat::StructuredConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,156 +0,0 @@
heat_template_version: 2015-04-30
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
os_net_config:
network_config:
- type: interface
name: nic1
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask:
list_join:
- /
- - {get_param: ControlPlaneIp}
- {get_param: ControlPlaneSubnetCidr}
routes:
- ip_netmask: 169.254.169.254/32
next_hop: {get_param: EC2MetadataIp}
- type: ovs_bridge
name: br-ex
dns_servers: {get_param: DnsServers}
use_dhcp: false
addresses:
- ip_netmask: {get_param: ExternalIpSubnet}
routes:
- ip_netmask: 0.0.0.0/0
next_hop: {get_param: ExternalInterfaceDefaultRoute}
members:
- type: ovs_bond
name: bond1
ovs_options: {get_param: BondInterfaceOvsOptions}
members:
- type: interface
name: nic2
mtu: 1350
primary: true
- type: interface
name: nic3
mtu: 1350
primary: false
- type: interface
name: nic4
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: InternalApiIpSubnet}
- type: interface
name: nic5
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageIpSubnet}
- type: interface
name: nic6
mtu: 1350
use_dhcp: false
addresses:
- ip_netmask: {get_param: StorageMgmtIpSubnet}
- type: ovs_bridge
name: br-tenant
dns_servers: {get_param: DnsServers}
use_dhcp: false
addresses:
- ip_netmask: {get_param: TenantIpSubnet}
members:
- type: interface
name: nic7
mtu: 1350
primary: true
group: os-apply-config
type: OS::Heat::StructuredConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,92 +0,0 @@
heat_template_version: 2015-04-30
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
ExternalIpSubnet:
default: ''
description: IP address/subnet on the external network
type: string
InternalApiIpSubnet:
default: ''
description: IP address/subnet on the internal_api network
type: string
StorageIpSubnet:
default: ''
description: IP address/subnet on the storage network
type: string
StorageMgmtIpSubnet:
default: ''
description: IP address/subnet on the storage_mgmt network
type: string
TenantIpSubnet:
default: ''
description: IP address/subnet on the tenant network
type: string
ManagementIpSubnet: # Only populated when including environments/network-management.yaml
default: ''
description: IP address/subnet on the management network
type: string
BondInterfaceOvsOptions:
default: 'bond_mode=active-backup'
description: The ovs_options string for the bond interface. Set things like
lacp=active and/or bond_mode=balance-slb using this option.
type: string
ExternalNetworkVlanID:
default: 10
description: Vlan ID for the external network traffic.
type: number
InternalApiNetworkVlanID:
default: 20
description: Vlan ID for the internal_api network traffic.
type: number
StorageNetworkVlanID:
default: 30
description: Vlan ID for the storage network traffic.
type: number
StorageMgmtNetworkVlanID:
default: 40
description: Vlan ID for the storage mgmt network traffic.
type: number
TenantNetworkVlanID:
default: 50
description: Vlan ID for the tenant network traffic.
type: number
ManagementNetworkVlanID:
default: 60
description: Vlan ID for the management network traffic.
type: number
ExternalInterfaceDefaultRoute:
default: '10.0.0.1'
description: default route for the external network
type: string
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
resources:
OsNetConfigImpl:
properties:
config:
os_net_config:
network_config: []
group: os-apply-config
type: OS::Heat::StructuredConfig
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value: {get_resource: OsNetConfigImpl}

View File

@ -1,699 +0,0 @@
(dp0
S'global_data'
p1
(dp2
S'control'
p3
(dp4
S'route'
p5
V192.168.24.1
p6
sS'mask'
p7
I24
sS'ec2'
p8
V192.168.24.1
p9
ssS'major'
p10
I1
sS'management'
p11
(dp12
S'start'
p13
V172.20.0.10
p14
sS'cidr'
p15
V172.20.0.0/24
p16
sS'vlan'
p17
I6
sS'end'
p18
V172.20.0.250
p19
ssS'dns2'
p20
V8.8.4.4
p21
sS'dns1'
p22
V8.8.8.8
p23
sS'storage'
p24
(dp25
g13
V172.18.0.10
p26
sg15
V172.18.0.0/24
p27
sg17
I3
sg18
V172.18.0.250
p28
ssS'auto_routes'
p29
I01
sS'bond_options'
p30
Vbond_mode=balance-slb
p31
sS'version'
p32
I1
sS'external'
p33
(dp34
S'bridge'
p35
V''
p36
sg18
V10.0.0.50
p37
sg17
I1
sg13
V10.0.0.10
p38
sg15
V10.0.0.0/24
p39
sS'gateway'
p40
V10.0.0.1
p41
ssS'internal_api'
p42
(dp43
g13
V172.17.0.10
p44
sg15
V172.17.0.0/24
p45
sg17
I2
sg18
V172.17.0.250
p46
ssS'ipv6'
p47
I00
sS'storage_mgmt'
p48
(dp49
g13
V172.19.0.10
p50
sg15
V172.19.0.0/24
p51
sg17
I4
sg18
V172.19.0.250
p52
ssS'minor'
p53
I2
sS'tenant'
p54
(dp55
g13
V172.16.0.10
p56
sg15
V172.16.0.0/24
p57
sg17
I5
sg18
V172.16.0.250
p58
sssS'data'
p59
(dp60
S'cinder-storage.yaml'
p61
(lp62
sS'ceph-storage.yaml'
p63
(lp64
(dp65
Vaddresses
p66
(lp67
sVnetwork
p68
VControlPlane
p69
sVprimary
p70
I01
sVmtu
p71
I1350
sS'members'
p72
(lp73
sVroutes
p74
(lp75
sVuse_dhcp
p76
I00
sVtype
p77
Vinterface
p78
sVname
p79
Vnic1
p80
sa(dp81
Vaddresses
p82
(lp83
sVnetwork
p84
VStorage
p85
sVprimary
p86
I01
sVmtu
p87
I1350
sg72
(lp88
sVroutes
p89
(lp90
sVuse_dhcp
p91
I00
sVtype
p92
Vinterface
p93
sVname
p94
Vnic5
p95
sa(dp96
Vaddresses
p97
(lp98
sVnetwork
p99
VStorageMgmt
p100
sVprimary
p101
I01
sVmtu
p102
I1350
sg72
(lp103
sVroutes
p104
(lp105
sVuse_dhcp
p106
I00
sVtype
p107
Vinterface
p108
sVname
p109
Vnic6
p110
sasS'controller.yaml'
p111
(lp112
(dp113
Vaddresses
p114
(lp115
sVnetwork
p116
VControlPlane
p117
sVprimary
p118
I01
sVmtu
p119
I1350
sg72
(lp120
sVroutes
p121
(lp122
sVuse_dhcp
p123
I00
sVtype
p124
Vinterface
p125
sVname
p126
Vnic1
p127
sa(dp128
Vdns_servers
p129
V{get_param: DnsServers}
p130
sVaddresses
p131
(lp132
sVnetwork
p133
VExternal
p134
sVmtu
p135
I-1
sg72
(lp136
(dp137
Vnetwork
p138
VNone
p139
sVbond_type
p140
Vovs
p141
sVovs_options
p142
V{get_param: BondInterfaceOvsOptions}
p143
sVmtu
p144
I-1
sg72
(lp145
(dp146
Vaddresses
p147
(lp148
sVnetwork
p149
VNone
p150
sVprimary
p151
I01
sVmtu
p152
I1350
sVroutes
p153
(lp154
sVuse_dhcp
p155
I00
sVtype
p156
Vinterface
p157
sVname
p158
Vnic2
p159
sa(dp160
Vaddresses
p161
(lp162
sVnetwork
p163
VNone
p164
sVprimary
p165
I00
sVmtu
p166
I1350
sVroutes
p167
(lp168
sVuse_dhcp
p169
I00
sVtype
p170
Vinterface
p171
sVname
p172
Vnic3
p173
sasVroutes
p174
(lp175
sVtype
p176
Vovs_bond
p177
sVname
p178
Vbond1
p179
sasVroutes
p180
(lp181
sVuse_dhcp
p182
I00
sVtype
p183
Vovs_bridge
p184
sVname
p185
Vbr-ex
p186
sa(dp187
Vaddresses
p188
(lp189
sVnetwork
p190
VInternalApi
p191
sVprimary
p192
I01
sVmtu
p193
I1350
sg72
(lp194
sVroutes
p195
(lp196
sVuse_dhcp
p197
I00
sVtype
p198
Vinterface
p199
sVname
p200
Vnic4
p201
sa(dp202
Vaddresses
p203
(lp204
sVnetwork
p205
VStorage
p206
sVprimary
p207
I01
sVmtu
p208
I1350
sg72
(lp209
sVroutes
p210
(lp211
sVuse_dhcp
p212
I00
sVtype
p213
Vinterface
p214
sVname
p215
Vnic5
p216
sa(dp217
Vaddresses
p218
(lp219
sVnetwork
p220
VStorageMgmt
p221
sVprimary
p222
I01
sVmtu
p223
I1350
sg72
(lp224
sVroutes
p225
(lp226
sVuse_dhcp
p227
I00
sVtype
p228
Vinterface
p229
sVname
p230
Vnic6
p231
sa(dp232
Vdns_servers
p233
V{get_param: DnsServers}
p234
sVaddresses
p235
(lp236
sVnetwork
p237
VTenant
p238
sVmtu
p239
I-1
sg72
(lp240
(dp241
Vaddresses
p242
(lp243
sVnetwork
p244
VNone
p245
sVprimary
p246
I01
sVmtu
p247
I1350
sg72
(lp248
sVroutes
p249
(lp250
sVuse_dhcp
p251
I00
sVtype
p252
Vinterface
p253
sVname
p254
Vnic7
p255
sasVroutes
p256
(lp257
sVuse_dhcp
p258
I00
sVtype
p259
Vovs_bridge
p260
sVname
p261
Vbr-tenant
p262
sasS'swift-storage.yaml'
p263
(lp264
sS'compute.yaml'
p265
(lp266
(dp267
Vaddresses
p268
(lp269
sVnetwork
p270
VControlPlane
p271
sVprimary
p272
I01
sVmtu
p273
I1350
sg72
(lp274
sVroutes
p275
(lp276
sVuse_dhcp
p277
I00
sVtype
p278
Vinterface
p279
sVname
p280
Vnic1
p281
sa(dp282
Vaddresses
p283
(lp284
sVnetwork
p285
VInternalApi
p286
sVprimary
p287
I01
sVmtu
p288
I1350
sg72
(lp289
sVroutes
p290
(lp291
sVuse_dhcp
p292
I00
sVtype
p293
Vinterface
p294
sVname
p295
Vnic4
p296
sa(dp297
Vaddresses
p298
(lp299
sVnetwork
p300
VStorage
p301
sVprimary
p302
I01
sVmtu
p303
I1350
sg72
(lp304
sVroutes
p305
(lp306
sVuse_dhcp
p307
I00
sVtype
p308
Vinterface
p309
sVname
p310
Vnic5
p311
sa(dp312
Vdns_servers
p313
V{get_param: DnsServers}
p314
sVaddresses
p315
(lp316
sVnetwork
p317
VTenant
p318
sVmtu
p319
I-1
sg72
(lp320
(dp321
Vaddresses
p322
(lp323
sVnetwork
p324
VNone
p325
sVprimary
p326
I01
sVmtu
p327
I1350
sg72
(lp328
sVroutes
p329
(lp330
sVuse_dhcp
p331
I00
sVtype
p332
Vinterface
p333
sVname
p334
Vnic7
p335
sasVroutes
p336
(lp337
sVuse_dhcp
p338
I00
sVtype
p339
Vovs_bridge
p340
sVname
p341
Vbr-tenant
p342
sass.

View File

@ -1,23 +0,0 @@
Generated Network Isolation Templates
-------------------------------------
These templates were generated by the UI tool at
https://github.com/cybertron/tripleo-scripts#net-iso-genpy
ui-settings.pickle is specific to the tool. TripleO will not use it when
doing deployments with these templates, but it is needed to be able to
load the templates into the UI again. Note that the UI only reads this file,
so any changes made by hand to the templates will not be reflected in the UI.
The network-isolation.yaml file needs to reference the port files shipped with
tripleo-heat-templates, so by default the tool generates the paths assuming
network-isolation.yaml will be copied into the environments/ directory of
tripleo-heat-templates.
If the standard tripleo-heat-templates are in use, then the
network-isolation-absolute.yaml file can be used instead. It has hard-coded
references to the port files in /usr/share/openstack-tripleo-heat-templates.
If the generated network isolation templates are at ~/generated-templates, an
example deployment command would look like:
openstack overcloud deploy --templates -e ~/generated-templates/network-isolation-absolute.yaml -e ~/generated-templates/network-environment.yaml

View File

@ -1,25 +0,0 @@
resource_registry:
OS::TripleO::BlockStorage::Net::SoftwareConfig: nic-configs/cinder-storage.yaml
OS::TripleO::Compute::Net::SoftwareConfig: nic-configs/compute.yaml
OS::TripleO::Controller::Net::SoftwareConfig: nic-configs/controller.yaml
OS::TripleO::ObjectStorage::Net::SoftwareConfig: nic-configs/swift-storage.yaml
OS::TripleO::CephStorage::Net::SoftwareConfig: nic-configs/ceph-storage.yaml
parameter_defaults:
ControlPlaneSubnetCidr: '24'
ControlPlaneDefaultRoute: 192.168.24.1
EC2MetadataIp: 192.168.24.1
ExternalNetCidr: 2001:db8:fd00:1000::/64
ExternalAllocationPools: [{"start": "2001:db8:fd00:1000::10", "end": "2001:db8:fd00:1000:ffff:ffff:ffff:fffe"}]
ExternalInterfaceDefaultRoute: 2001:db8:fd00:1000::1
NeutronExternalNetworkBridge: "''"
InternalApiNetCidr: fd00:fd00:fd00:2000::/64
InternalApiAllocationPools: [{"start": "fd00:fd00:fd00:2000::10", "end": "fd00:fd00:fd00:2000:ffff:ffff:ffff:fffe"}]
StorageNetCidr: fd00:fd00:fd00:3000::/64
StorageAllocationPools: [{"start": "fd00:fd00:fd00:3000::10", "end": "fd00:fd00:fd00:3000:ffff:ffff:ffff:fffe"}]
StorageMgmtNetCidr: fd00:fd00:fd00:4000::/64
StorageMgmtAllocationPools: [{"start": "fd00:fd00:fd00:4000::10", "end": "fd00:fd00:fd00:4000:ffff:ffff:ffff:fffe"}]
TenantNetCidr: 172.16.0.0/24
TenantAllocationPools: [{"start": "172.16.0.10", "end": "172.16.0.250"}]
DnsServers: ["8.8.8.8", "8.8.4.4"]

View File

@ -1,35 +0,0 @@
resource_registry:
# Redis
OS::TripleO::Network::Ports::RedisVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/vip_v6.yaml
# External
OS::TripleO::Network::External: /usr/share/openstack-tripleo-heat-templates/network/external_v6.yaml
OS::TripleO::Network::Ports::ExternalVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/external_v6.yaml
OS::TripleO::Controller::Ports::ExternalPort: /usr/share/openstack-tripleo-heat-templates/network/ports/external_v6.yaml
# InternalApi
OS::TripleO::Network::InternalApi: /usr/share/openstack-tripleo-heat-templates/network/internal_api_v6.yaml
OS::TripleO::Network::Ports::InternalApiVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api_v6.yaml
OS::TripleO::Controller::Ports::InternalApiPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api_v6.yaml
OS::TripleO::Compute::Ports::InternalApiPort: /usr/share/openstack-tripleo-heat-templates/network/ports/internal_api_v6.yaml
# Storage
OS::TripleO::Network::Storage: /usr/share/openstack-tripleo-heat-templates/network/storage_v6.yaml
OS::TripleO::Network::Ports::StorageVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_v6.yaml
OS::TripleO::Controller::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_v6.yaml
OS::TripleO::Compute::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_v6.yaml
OS::TripleO::CephStorage::Ports::StoragePort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_v6.yaml
# StorageMgmt
OS::TripleO::Network::StorageMgmt: /usr/share/openstack-tripleo-heat-templates/network/storage_mgmt_v6.yaml
OS::TripleO::Network::Ports::StorageMgmtVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt_v6.yaml
OS::TripleO::Controller::Ports::StorageMgmtPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt_v6.yaml
OS::TripleO::CephStorage::Ports::StorageMgmtPort: /usr/share/openstack-tripleo-heat-templates/network/ports/storage_mgmt_v6.yaml
# Tenant
OS::TripleO::Network::Tenant: /usr/share/openstack-tripleo-heat-templates/network/tenant.yaml
OS::TripleO::Network::Ports::TenantVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
OS::TripleO::Controller::Ports::TenantPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
OS::TripleO::Compute::Ports::TenantPort: /usr/share/openstack-tripleo-heat-templates/network/ports/tenant.yaml
parameter_defaults:
CephIPv6: True
CorosyncIPv6: True
MongoDbIPv6: True
NovaIPv6: True
RabbitIPv6: True
MemcachedIPv6: True

View File

@ -1,35 +0,0 @@
resource_registry:
# Redis
OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/vip_v6.yaml
# External
OS::TripleO::Network::External: ../network/external_v6.yaml
OS::TripleO::Network::Ports::ExternalVipPort: ../network/ports/external_v6.yaml
OS::TripleO::Controller::Ports::ExternalPort: ../network/ports/external_v6.yaml
# InternalApi
OS::TripleO::Network::InternalApi: ../network/internal_api_v6.yaml
OS::TripleO::Network::Ports::InternalApiVipPort: ../network/ports/internal_api_v6.yaml
OS::TripleO::Controller::Ports::InternalApiPort: ../network/ports/internal_api_v6.yaml
OS::TripleO::Compute::Ports::InternalApiPort: ../network/ports/internal_api_v6.yaml
# Storage
OS::TripleO::Network::Storage: ../network/storage_v6.yaml
OS::TripleO::Network::Ports::StorageVipPort: ../network/ports/storage_v6.yaml
OS::TripleO::Controller::Ports::StoragePort: ../network/ports/storage_v6.yaml
OS::TripleO::Compute::Ports::StoragePort: ../network/ports/storage_v6.yaml
OS::TripleO::CephStorage::Ports::StoragePort: ../network/ports/storage_v6.yaml
# StorageMgmt
OS::TripleO::Network::StorageMgmt: ../network/storage_mgmt_v6.yaml
OS::TripleO::Network::Ports::StorageMgmtVipPort: ../network/ports/storage_mgmt_v6.yaml
OS::TripleO::Controller::Ports::StorageMgmtPort: ../network/ports/storage_mgmt_v6.yaml
OS::TripleO::CephStorage::Ports::StorageMgmtPort: ../network/ports/storage_mgmt_v6.yaml
# Tenant
OS::TripleO::Network::Tenant: ../network/tenant.yaml
OS::TripleO::Network::Ports::TenantVipPort: ../network/ports/tenant.yaml
OS::TripleO::Controller::Ports::TenantPort: ../network/ports/tenant.yaml
OS::TripleO::Compute::Ports::TenantPort: ../network/ports/tenant.yaml
parameter_defaults:
CephIPv6: True
CorosyncIPv6: True
MongoDbIPv6: True
NovaIPv6: True
RabbitIPv6: True
MemcachedIPv6: True

Some files were not shown because too many files have changed in this diff Show More