remove nova baremetal driver support
This has been deleted from the nova tree, we should purge it from devstack, as it will not work any more. Change-Id: I20501fec140998b91c9ddfd84b7b10168624430a
This commit is contained in:
parent
129166c2d9
commit
2f8e08b572
1
clean.sh
1
clean.sh
@ -50,7 +50,6 @@ source $TOP_DIR/lib/swift
|
||||
source $TOP_DIR/lib/ceilometer
|
||||
source $TOP_DIR/lib/heat
|
||||
source $TOP_DIR/lib/neutron
|
||||
source $TOP_DIR/lib/baremetal
|
||||
source $TOP_DIR/lib/ironic
|
||||
source $TOP_DIR/lib/trove
|
||||
|
||||
|
@ -139,7 +139,6 @@ Scripts
|
||||
* `functions <functions.html>`__ - DevStack-specific functions
|
||||
* `functions-common <functions-common.html>`__ - Functions shared with other projects
|
||||
* `lib/apache <lib/apache.html>`__
|
||||
* `lib/baremetal <lib/baremetal.html>`__
|
||||
* `lib/ceilometer <lib/ceilometer.html>`__
|
||||
* `lib/ceph <lib/ceph.html>`__
|
||||
* `lib/cinder <lib/cinder.html>`__
|
||||
|
439
lib/baremetal
439
lib/baremetal
@ -1,439 +0,0 @@
|
||||
## vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
## Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
|
||||
## All Rights Reserved.
|
||||
##
|
||||
## 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 file provides devstack with the environment and utilities to
|
||||
# control nova-compute's baremetal driver.
|
||||
# It sets reasonable defaults to run within a single host,
|
||||
# using virtual machines in place of physical hardware.
|
||||
# However, by changing just a few options, devstack+baremetal can in fact
|
||||
# control physical hardware resources on the same network, if you know
|
||||
# the MAC address(es) and IPMI credentials.
|
||||
#
|
||||
# At a minimum, to enable the baremetal driver, you must set these in localrc:
|
||||
#
|
||||
# VIRT_DRIVER=baremetal
|
||||
# ENABLED_SERVICES="$ENABLED_SERVICES,baremetal"
|
||||
#
|
||||
#
|
||||
# We utilize diskimage-builder to create a ramdisk, and then
|
||||
# baremetal driver uses that to push a disk image onto the node(s).
|
||||
#
|
||||
# Below we define various defaults which control the behavior of the
|
||||
# baremetal compute service, and inform it of the hardware it will control.
|
||||
#
|
||||
# Below that, various functions are defined, which are called by devstack
|
||||
# in the following order:
|
||||
#
|
||||
# before nova-cpu starts:
|
||||
#
|
||||
# - prepare_baremetal_toolchain
|
||||
# - configure_baremetal_nova_dirs
|
||||
#
|
||||
# after nova and glance have started:
|
||||
#
|
||||
# - build_and_upload_baremetal_deploy_k_and_r $token
|
||||
# - create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID
|
||||
# - upload_baremetal_image $url $token
|
||||
# - add_baremetal_node <first_mac> <second_mac>
|
||||
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
|
||||
# Sub-driver settings
|
||||
# -------------------
|
||||
|
||||
# sub-driver to use for kernel deployment
|
||||
#
|
||||
# - nova.virt.baremetal.pxe.PXE
|
||||
# - nova.virt.baremetal.tilera.TILERA
|
||||
BM_DRIVER=${BM_DRIVER:-nova.virt.baremetal.pxe.PXE}
|
||||
|
||||
# sub-driver to use for remote power management
|
||||
#
|
||||
# - nova.virt.baremetal.fake.FakePowerManager, for manual power control
|
||||
# - nova.virt.baremetal.ipmi.IPMI, for remote IPMI
|
||||
# - nova.virt.baremetal.tilera_pdu.Pdu, for TilePro hardware
|
||||
BM_POWER_MANAGER=${BM_POWER_MANAGER:-nova.virt.baremetal.fake.FakePowerManager}
|
||||
|
||||
|
||||
# These should be customized to your environment and hardware
|
||||
# -----------------------------------------------------------
|
||||
|
||||
# To provide PXE, configure nova-network's dnsmasq rather than run the one
|
||||
# dedicated to baremetal. When enable this, make sure these conditions are
|
||||
# fulfilled:
|
||||
#
|
||||
# 1) nova-compute and nova-network runs on the same host
|
||||
# 2) nova-network uses FlatDHCPManager
|
||||
#
|
||||
# NOTE: the other BM_DNSMASQ_* have no effect on the behavior if this option
|
||||
# is enabled.
|
||||
BM_DNSMASQ_FROM_NOVA_NETWORK=`trueorfalse False $BM_DNSMASQ_FROM_NOVA_NETWORK`
|
||||
|
||||
# BM_DNSMASQ_IFACE should match FLAT_NETWORK_BRIDGE
|
||||
BM_DNSMASQ_IFACE=${BM_DNSMASQ_IFACE:-eth0}
|
||||
# if testing on a physical network,
|
||||
# BM_DNSMASQ_RANGE must be changed to suit your network
|
||||
BM_DNSMASQ_RANGE=${BM_DNSMASQ_RANGE:-}
|
||||
|
||||
# BM_DNSMASQ_DNS provide dns server to bootstrap clients
|
||||
BM_DNSMASQ_DNS=${BM_DNSMASQ_DNS:-}
|
||||
|
||||
# BM_FIRST_MAC *must* be set to the MAC address of the node you will
|
||||
# boot. This is passed to dnsmasq along with the kernel/ramdisk to
|
||||
# deploy via PXE.
|
||||
BM_FIRST_MAC=${BM_FIRST_MAC:-}
|
||||
|
||||
# BM_SECOND_MAC is only important if the host has >1 NIC.
|
||||
BM_SECOND_MAC=${BM_SECOND_MAC:-}
|
||||
|
||||
# Hostname for the baremetal nova-compute node, if not run on this host
|
||||
BM_HOSTNAME=${BM_HOSTNAME:-$(hostname -f)}
|
||||
|
||||
# BM_PM_* options are only necessary if BM_POWER_MANAGER=...IPMI
|
||||
BM_PM_ADDR=${BM_PM_ADDR:-0.0.0.0}
|
||||
BM_PM_USER=${BM_PM_USER:-user}
|
||||
BM_PM_PASS=${BM_PM_PASS:-pass}
|
||||
|
||||
# BM_FLAVOR_* options are arbitrary and not necessarily related to
|
||||
# physical hardware capacity. These can be changed if you are testing
|
||||
# BaremetalHostManager with multiple nodes and different flavors.
|
||||
BM_CPU_ARCH=${BM_CPU_ARCH:-x86_64}
|
||||
BM_FLAVOR_CPU=${BM_FLAVOR_CPU:-1}
|
||||
BM_FLAVOR_RAM=${BM_FLAVOR_RAM:-1024}
|
||||
BM_FLAVOR_ROOT_DISK=${BM_FLAVOR_ROOT_DISK:-10}
|
||||
BM_FLAVOR_EPHEMERAL_DISK=${BM_FLAVOR_EPHEMERAL_DISK:-0}
|
||||
BM_FLAVOR_SWAP=${BM_FLAVOR_SWAP:-1}
|
||||
BM_FLAVOR_NAME=${BM_FLAVOR_NAME:-bm.small}
|
||||
BM_FLAVOR_ID=${BM_FLAVOR_ID:-11}
|
||||
BM_FLAVOR_ARCH=${BM_FLAVOR_ARCH:-$BM_CPU_ARCH}
|
||||
|
||||
|
||||
# Use DIB to create deploy ramdisk and kernel.
|
||||
BM_BUILD_DEPLOY_RAMDISK=`trueorfalse True $BM_BUILD_DEPLOY_RAMDISK`
|
||||
# If not use DIB, these files are used as deploy ramdisk/kernel.
|
||||
# (The value must be a relative path from $TOP_DIR/files/)
|
||||
BM_DEPLOY_RAMDISK=${BM_DEPLOY_RAMDISK:-}
|
||||
BM_DEPLOY_KERNEL=${BM_DEPLOY_KERNEL:-}
|
||||
|
||||
# If you need to add any extra flavors to the deploy ramdisk image
|
||||
# eg, specific network drivers, specify them here
|
||||
#
|
||||
# NOTE(deva): this will be moved to lib/ironic in a future patch
|
||||
# for now, set the default to a suitable value for Ironic's needs
|
||||
BM_DEPLOY_FLAVOR=${BM_DEPLOY_FLAVOR:--a amd64 ubuntu deploy-ironic}
|
||||
|
||||
# set URL and version for google shell-in-a-box
|
||||
BM_SHELL_IN_A_BOX=${BM_SHELL_IN_A_BOX:-http://shellinabox.googlecode.com/files/shellinabox-2.14.tar.gz}
|
||||
|
||||
|
||||
# Functions
|
||||
# ---------
|
||||
|
||||
# Check if baremetal is properly enabled
|
||||
# Returns false if VIRT_DRIVER is not baremetal, or if ENABLED_SERVICES
|
||||
# does not contain "baremetal"
|
||||
function is_baremetal {
|
||||
if [[ "$ENABLED_SERVICES" =~ 'baremetal' && "$VIRT_DRIVER" = 'baremetal' ]]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# Install diskimage-builder and shell-in-a-box
|
||||
# so that we can build the deployment kernel & ramdisk
|
||||
function prepare_baremetal_toolchain {
|
||||
if [[ $(type -P ramdisk-image-create) == "" ]]; then
|
||||
pip_install diskimage_builder
|
||||
fi
|
||||
local shellinabox_basename=$(basename $BM_SHELL_IN_A_BOX)
|
||||
if [[ ! -e $DEST/$shellinabox_basename ]]; then
|
||||
cd $DEST
|
||||
wget $BM_SHELL_IN_A_BOX
|
||||
fi
|
||||
if [[ ! -d $DEST/${shellinabox_basename%%.tar.gz} ]]; then
|
||||
cd $DEST
|
||||
tar xzf $shellinabox_basename
|
||||
fi
|
||||
if [[ ! $(which shellinaboxd) ]]; then
|
||||
cd $DEST/${shellinabox_basename%%.tar.gz}
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
fi
|
||||
}
|
||||
|
||||
# prepare various directories needed by baremetal hypervisor
|
||||
function configure_baremetal_nova_dirs {
|
||||
# ensure /tftpboot is prepared
|
||||
sudo mkdir -p /tftpboot
|
||||
sudo mkdir -p /tftpboot/pxelinux.cfg
|
||||
|
||||
PXEBIN=/usr/share/syslinux/pxelinux.0
|
||||
if [ ! -f $PXEBIN ]; then
|
||||
PXEBIN=/usr/lib/syslinux/pxelinux.0
|
||||
if [ ! -f $PXEBIN ]; then
|
||||
die $LINENO "pxelinux.0 (from SYSLINUX) not found."
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo cp $PXEBIN /tftpboot/
|
||||
sudo chown -R $STACK_USER:$LIBVIRT_GROUP /tftpboot
|
||||
|
||||
# ensure $NOVA_STATE_PATH/baremetal is prepared
|
||||
sudo mkdir -p $NOVA_STATE_PATH/baremetal
|
||||
sudo mkdir -p $NOVA_STATE_PATH/baremetal/console
|
||||
sudo mkdir -p $NOVA_STATE_PATH/baremetal/dnsmasq
|
||||
sudo touch $NOVA_STATE_PATH/baremetal/dnsmasq/dnsmasq-dhcp.host
|
||||
sudo chown -R $STACK_USER $NOVA_STATE_PATH/baremetal
|
||||
|
||||
# ensure dnsmasq is installed but not running
|
||||
# because baremetal driver will reconfigure and restart this as needed
|
||||
is_package_installed dnsmasq || install_package dnsmasq
|
||||
stop_service dnsmasq
|
||||
}
|
||||
|
||||
# build deploy kernel+ramdisk, then upload them to glance
|
||||
# this function sets BM_DEPLOY_KERNEL_ID and BM_DEPLOY_RAMDISK_ID
|
||||
function upload_baremetal_deploy {
|
||||
token=$1
|
||||
|
||||
if [ "$BM_BUILD_DEPLOY_RAMDISK" = "True" ]; then
|
||||
BM_DEPLOY_KERNEL=bm-deploy.kernel
|
||||
BM_DEPLOY_RAMDISK=bm-deploy.initramfs
|
||||
if [ ! -e "$TOP_DIR/files/$BM_DEPLOY_KERNEL" -o ! -e "$TOP_DIR/files/$BM_DEPLOY_RAMDISK" ]; then
|
||||
ramdisk-image-create $BM_DEPLOY_FLAVOR \
|
||||
-o $TOP_DIR/files/bm-deploy
|
||||
fi
|
||||
fi
|
||||
|
||||
# load them into glance
|
||||
BM_DEPLOY_KERNEL_ID=$(openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
$BM_DEPLOY_KERNEL \
|
||||
--public --disk-format=aki \
|
||||
--container-format=aki \
|
||||
< $TOP_DIR/files/$BM_DEPLOY_KERNEL | grep ' id ' | get_field 2)
|
||||
BM_DEPLOY_RAMDISK_ID=$(openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
$BM_DEPLOY_RAMDISK \
|
||||
--public --disk-format=ari \
|
||||
--container-format=ari \
|
||||
< $TOP_DIR/files/$BM_DEPLOY_RAMDISK | grep ' id ' | get_field 2)
|
||||
}
|
||||
|
||||
# create a basic baremetal flavor, associated with deploy kernel & ramdisk
|
||||
#
|
||||
# Usage: create_baremetal_flavor <aki_uuid> <ari_uuid>
|
||||
function create_baremetal_flavor {
|
||||
aki=$1
|
||||
ari=$2
|
||||
nova flavor-create $BM_FLAVOR_NAME $BM_FLAVOR_ID \
|
||||
$BM_FLAVOR_RAM $BM_FLAVOR_ROOT_DISK $BM_FLAVOR_CPU
|
||||
nova flavor-key $BM_FLAVOR_NAME set \
|
||||
"cpu_arch"="$BM_FLAVOR_ARCH" \
|
||||
"baremetal:deploy_kernel_id"="$aki" \
|
||||
"baremetal:deploy_ramdisk_id"="$ari"
|
||||
|
||||
}
|
||||
|
||||
# Pull run-time kernel/ramdisk out of disk image and load into glance.
|
||||
# Note that $file is currently expected to be in qcow2 format.
|
||||
# Sets KERNEL_ID and RAMDISK_ID
|
||||
#
|
||||
# Usage: extract_and_upload_k_and_r_from_image $token $file
|
||||
function extract_and_upload_k_and_r_from_image {
|
||||
token=$1
|
||||
file=$2
|
||||
image_name=$(basename "$file" ".qcow2")
|
||||
|
||||
# this call returns the file names as "$kernel,$ramdisk"
|
||||
out=$(disk-image-get-kernel \
|
||||
-x -d $TOP_DIR/files -o bm-deploy -i $file)
|
||||
if [ $? -ne 0 ]; then
|
||||
die $LINENO "Failed to get kernel and ramdisk from $file"
|
||||
fi
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
out=$(echo "$out" | tail -1)
|
||||
$XTRACE
|
||||
OUT_KERNEL=${out%%,*}
|
||||
OUT_RAMDISK=${out##*,}
|
||||
|
||||
# load them into glance
|
||||
KERNEL_ID=$(openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
$image_name-kernel \
|
||||
--public --disk-format=aki \
|
||||
--container-format=aki \
|
||||
< $TOP_DIR/files/$OUT_KERNEL | grep ' id ' | get_field 2)
|
||||
RAMDISK_ID=$(openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
$image_name-initrd \
|
||||
--public --disk-format=ari \
|
||||
--container-format=ari \
|
||||
< $TOP_DIR/files/$OUT_RAMDISK | grep ' id ' | get_field 2)
|
||||
}
|
||||
|
||||
|
||||
# Re-implementation of devstack's "upload_image" function
|
||||
#
|
||||
# Takes the same parameters, but has some peculiarities which made it
|
||||
# easier to create a separate method, rather than complicate the logic
|
||||
# of the existing function.
|
||||
function upload_baremetal_image {
|
||||
local image_url=$1
|
||||
local token=$2
|
||||
|
||||
# Create a directory for the downloaded image tarballs.
|
||||
mkdir -p $FILES/images
|
||||
|
||||
# Downloads the image (uec ami+aki style), then extracts it.
|
||||
IMAGE_FNAME=`basename "$image_url"`
|
||||
if [[ ! -f $FILES/$IMAGE_FNAME || \
|
||||
"$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then
|
||||
wget -c $image_url -O $FILES/$IMAGE_FNAME
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Not found: $image_url"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
local KERNEL=""
|
||||
local RAMDISK=""
|
||||
local DISK_FORMAT=""
|
||||
local CONTAINER_FORMAT=""
|
||||
case "$IMAGE_FNAME" in
|
||||
*.tar.gz|*.tgz)
|
||||
# Extract ami and aki files
|
||||
[ "${IMAGE_FNAME%.tar.gz}" != "$IMAGE_FNAME" ] &&
|
||||
IMAGE_NAME="${IMAGE_FNAME%.tar.gz}" ||
|
||||
IMAGE_NAME="${IMAGE_FNAME%.tgz}"
|
||||
xdir="$FILES/images/$IMAGE_NAME"
|
||||
rm -Rf "$xdir";
|
||||
mkdir "$xdir"
|
||||
tar -zxf $FILES/$IMAGE_FNAME -C "$xdir"
|
||||
KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
|
||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||
RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
|
||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||
IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
|
||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||
if [[ -z "$IMAGE_NAME" ]]; then
|
||||
IMAGE_NAME=$(basename "$IMAGE" ".img")
|
||||
fi
|
||||
DISK_FORMAT=ami
|
||||
CONTAINER_FORMAT=ami
|
||||
;;
|
||||
*.qcow2)
|
||||
IMAGE="$FILES/${IMAGE_FNAME}"
|
||||
IMAGE_NAME=$(basename "$IMAGE" ".qcow2")
|
||||
DISK_FORMAT=qcow2
|
||||
CONTAINER_FORMAT=bare
|
||||
;;
|
||||
*) echo "Do not know what to do with $IMAGE_FNAME"; false;;
|
||||
esac
|
||||
|
||||
if [ "$CONTAINER_FORMAT" = "bare" ]; then
|
||||
extract_and_upload_k_and_r_from_image $token $IMAGE
|
||||
elif [ "$CONTAINER_FORMAT" = "ami" ]; then
|
||||
KERNEL_ID=$(openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
"$IMAGE_NAME-kernel" --public \
|
||||
--container-format aki \
|
||||
--disk-format aki < "$KERNEL" | grep ' id ' | get_field 2)
|
||||
RAMDISK_ID=$(openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
"$IMAGE_NAME-ramdisk" --public \
|
||||
--container-format ari \
|
||||
--disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2)
|
||||
else
|
||||
# TODO(deva): add support for other image types
|
||||
return
|
||||
fi
|
||||
|
||||
openstack \
|
||||
--os-token $token \
|
||||
--os-url http://$GLANCE_HOSTPORT \
|
||||
image create \
|
||||
"${IMAGE_NAME%.img}" --public \
|
||||
--container-format $CONTAINER_FORMAT \
|
||||
--disk-format $DISK_FORMAT \
|
||||
${KERNEL_ID:+--property kernel_id=$KERNEL_ID} \
|
||||
${RAMDISK_ID:+--property ramdisk_id=$RAMDISK_ID} < "${IMAGE}"
|
||||
|
||||
# override DEFAULT_IMAGE_NAME so that tempest can find the image
|
||||
# that we just uploaded in glance
|
||||
DEFAULT_IMAGE_NAME="${IMAGE_NAME%.img}"
|
||||
}
|
||||
|
||||
function clear_baremetal_of_all_nodes {
|
||||
list=$(nova baremetal-node-list | awk -F '| ' 'NR>3 {print $2}' )
|
||||
for node in $list; do
|
||||
nova baremetal-node-delete $node
|
||||
done
|
||||
}
|
||||
|
||||
# Inform nova-baremetal about nodes, MACs, etc.
|
||||
# Defaults to using BM_FIRST_MAC and BM_SECOND_MAC if parameters not specified
|
||||
#
|
||||
# Usage: add_baremetal_node <first_mac> <second_mac>
|
||||
function add_baremetal_node {
|
||||
mac_1=${1:-$BM_FIRST_MAC}
|
||||
mac_2=${2:-$BM_SECOND_MAC}
|
||||
|
||||
id=$(nova baremetal-node-create \
|
||||
--pm_address="$BM_PM_ADDR" \
|
||||
--pm_user="$BM_PM_USER" \
|
||||
--pm_password="$BM_PM_PASS" \
|
||||
"$BM_HOSTNAME" \
|
||||
"$BM_FLAVOR_CPU" \
|
||||
"$BM_FLAVOR_RAM" \
|
||||
"$BM_FLAVOR_ROOT_DISK" \
|
||||
"$mac_1" \
|
||||
| grep ' id ' | get_field 2 )
|
||||
[ $? -eq 0 ] || [ "$id" ] || die $LINENO "Error adding baremetal node"
|
||||
if [ -n "$mac_2" ]; then
|
||||
id2=$(nova baremetal-interface-add "$id" "$mac_2" )
|
||||
[ $? -eq 0 ] || [ "$id2" ] || die $LINENO "Error adding interface to barmetal node $id"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
||||
|
||||
# Tell emacs to use shell-script-mode
|
||||
## Local variables:
|
||||
## mode: shell-script
|
||||
## End:
|
20
lib/neutron
20
lib/neutron
@ -529,25 +529,7 @@ function create_neutron_initial_network {
|
||||
TENANT_ID=$(openstack project list | grep " demo " | get_field 1)
|
||||
die_if_not_set $LINENO TENANT_ID "Failure retrieving TENANT_ID for demo"
|
||||
|
||||
# Create a small network
|
||||
# Since neutron command is executed in admin context at this point,
|
||||
# ``--tenant-id`` needs to be specified.
|
||||
if is_baremetal; then
|
||||
if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then
|
||||
die $LINENO "Neutron settings for baremetal not set.. exiting"
|
||||
fi
|
||||
sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
|
||||
for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
|
||||
sudo ip addr del $IP dev $PUBLIC_INTERFACE
|
||||
sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
|
||||
done
|
||||
NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant-id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2)
|
||||
die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID"
|
||||
SUBNET_ID=$(neutron subnet-create --tenant-id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
|
||||
die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $TENANT_ID"
|
||||
sudo ifconfig $OVS_PHYSICAL_BRIDGE up
|
||||
sudo route add default gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE
|
||||
elif is_provider_network; then
|
||||
if is_provider_network; then
|
||||
die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
|
||||
die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE"
|
||||
NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2)
|
||||
|
6
lib/nova
6
lib/nova
@ -635,12 +635,6 @@ function init_nova {
|
||||
if is_service_enabled n-cell; then
|
||||
recreate_database $NOVA_CELLS_DB latin1
|
||||
fi
|
||||
|
||||
# (Re)create nova baremetal database
|
||||
if is_baremetal; then
|
||||
recreate_database nova_bm latin1
|
||||
$NOVA_BIN_DIR/nova-baremetal-manage db sync
|
||||
fi
|
||||
fi
|
||||
|
||||
create_nova_cache_dir
|
||||
|
@ -1,87 +0,0 @@
|
||||
# lib/nova_plugins/hypervisor-baremetal
|
||||
# Configure the baremetal hypervisor
|
||||
|
||||
# Enable with:
|
||||
# VIRT_DRIVER=baremetal
|
||||
|
||||
# Dependencies:
|
||||
# ``functions`` file
|
||||
# ``nova`` configuration
|
||||
|
||||
# install_nova_hypervisor - install any external requirements
|
||||
# configure_nova_hypervisor - make configuration changes, including those to other services
|
||||
# start_nova_hypervisor - start any external services
|
||||
# stop_nova_hypervisor - stop any external services
|
||||
# cleanup_nova_hypervisor - remove transient data and cache
|
||||
|
||||
# Save trace setting
|
||||
MY_XTRACE=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
|
||||
# Defaults
|
||||
# --------
|
||||
|
||||
NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager}
|
||||
PUBLIC_INTERFACE_DEFAULT=eth0
|
||||
FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
|
||||
FLAT_NETWORK_BRIDGE_DEFAULT=br100
|
||||
STUB_NETWORK=${STUB_NETWORK:-False}
|
||||
|
||||
|
||||
# Entry Points
|
||||
# ------------
|
||||
|
||||
# clean_nova_hypervisor - Clean up an installation
|
||||
function cleanup_nova_hypervisor {
|
||||
# This function intentionally left blank
|
||||
:
|
||||
}
|
||||
|
||||
# configure_nova_hypervisor - Set config files, create data dirs, etc
|
||||
function configure_nova_hypervisor {
|
||||
configure_baremetal_nova_dirs
|
||||
|
||||
iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm`
|
||||
LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
|
||||
iniset $NOVA_CONF DEFAULT compute_driver nova.virt.baremetal.driver.BareMetalDriver
|
||||
iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER
|
||||
iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.baremetal_host_manager.BaremetalHostManager
|
||||
iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0
|
||||
iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0
|
||||
iniset $NOVA_CONF baremetal flavor_extra_specs cpu_arch:$BM_CPU_ARCH
|
||||
iniset $NOVA_CONF baremetal driver $BM_DRIVER
|
||||
iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER
|
||||
iniset $NOVA_CONF baremetal tftp_root /tftpboot
|
||||
if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "True" ]]; then
|
||||
BM_DNSMASQ_CONF=$NOVA_CONF_DIR/dnsmasq-for-baremetal-from-nova-network.conf
|
||||
sudo cp "$FILES/dnsmasq-for-baremetal-from-nova-network.conf" "$BM_DNSMASQ_CONF"
|
||||
iniset $NOVA_CONF DEFAULT dnsmasq_config_file "$BM_DNSMASQ_CONF"
|
||||
fi
|
||||
}
|
||||
|
||||
# install_nova_hypervisor() - Install external components
|
||||
function install_nova_hypervisor {
|
||||
# This function intentionally left blank
|
||||
:
|
||||
}
|
||||
|
||||
# start_nova_hypervisor - Start any required external services
|
||||
function start_nova_hypervisor {
|
||||
# This function intentionally left blank
|
||||
:
|
||||
}
|
||||
|
||||
# stop_nova_hypervisor - Stop any external services
|
||||
function stop_nova_hypervisor {
|
||||
# This function intentionally left blank
|
||||
:
|
||||
}
|
||||
|
||||
|
||||
# Restore xtrace
|
||||
$MY_XTRACE
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# End:
|
63
stack.sh
63
stack.sh
@ -561,7 +561,6 @@ source $TOP_DIR/lib/swift
|
||||
source $TOP_DIR/lib/ceilometer
|
||||
source $TOP_DIR/lib/heat
|
||||
source $TOP_DIR/lib/neutron
|
||||
source $TOP_DIR/lib/baremetal
|
||||
source $TOP_DIR/lib/ldap
|
||||
source $TOP_DIR/lib/dstat
|
||||
|
||||
@ -1136,14 +1135,6 @@ if is_service_enabled nova; then
|
||||
init_nova_cells
|
||||
fi
|
||||
|
||||
# Extra things to prepare nova for baremetal, before nova starts
|
||||
if is_service_enabled nova && is_baremetal; then
|
||||
echo_summary "Preparing for nova baremetal"
|
||||
prepare_baremetal_toolchain
|
||||
configure_baremetal_nova_dirs
|
||||
fi
|
||||
|
||||
|
||||
# Extras Configuration
|
||||
# ====================
|
||||
|
||||
@ -1197,28 +1188,16 @@ if is_service_enabled g-reg; then
|
||||
TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
|
||||
die_if_not_set $LINENO TOKEN "Keystone fail to get token"
|
||||
|
||||
if is_baremetal; then
|
||||
echo_summary "Creating and uploading baremetal images"
|
||||
echo_summary "Uploading images"
|
||||
|
||||
# build and upload separate deploy kernel & ramdisk
|
||||
upload_baremetal_deploy $TOKEN
|
||||
|
||||
# upload images, separating out the kernel & ramdisk for PXE boot
|
||||
for image_url in ${IMAGE_URLS//,/ }; do
|
||||
upload_baremetal_image $image_url $TOKEN
|
||||
done
|
||||
else
|
||||
echo_summary "Uploading images"
|
||||
|
||||
# Option to upload legacy ami-tty, which works with xenserver
|
||||
if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then
|
||||
IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz"
|
||||
fi
|
||||
|
||||
for image_url in ${IMAGE_URLS//,/ }; do
|
||||
upload_image $image_url $TOKEN
|
||||
done
|
||||
# Option to upload legacy ami-tty, which works with xenserver
|
||||
if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then
|
||||
IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz"
|
||||
fi
|
||||
|
||||
for image_url in ${IMAGE_URLS//,/ }; do
|
||||
upload_image $image_url $TOKEN
|
||||
done
|
||||
fi
|
||||
|
||||
# Create an access key and secret key for nova ec2 register image
|
||||
@ -1325,32 +1304,6 @@ if is_service_enabled nova && is_service_enabled key; then
|
||||
fi
|
||||
|
||||
|
||||
# If we are running nova with baremetal driver, there are a few
|
||||
# last-mile configuration bits to attend to, which must happen
|
||||
# after n-api and n-sch have started.
|
||||
# Also, creating the baremetal flavor must happen after images
|
||||
# are loaded into glance, though just knowing the IDs is sufficient here
|
||||
if is_service_enabled nova && is_baremetal; then
|
||||
# create special flavor for baremetal if we know what images to associate
|
||||
[[ -n "$BM_DEPLOY_KERNEL_ID" ]] && [[ -n "$BM_DEPLOY_RAMDISK_ID" ]] && \
|
||||
create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID
|
||||
|
||||
# otherwise user can manually add it later by calling nova-baremetal-manage
|
||||
[[ -n "$BM_FIRST_MAC" ]] && add_baremetal_node
|
||||
|
||||
if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "False" ]]; then
|
||||
# NOTE: we do this here to ensure that our copy of dnsmasq is running
|
||||
sudo pkill dnsmasq || true
|
||||
sudo dnsmasq --conf-file= --port=0 --enable-tftp --tftp-root=/tftpboot \
|
||||
--dhcp-boot=pxelinux.0 --bind-interfaces --pid-file=/var/run/dnsmasq.pid \
|
||||
--interface=$BM_DNSMASQ_IFACE --dhcp-range=$BM_DNSMASQ_RANGE \
|
||||
${BM_DNSMASQ_DNS:+--dhcp-option=option:dns-server,$BM_DNSMASQ_DNS}
|
||||
fi
|
||||
# ensure callback daemon is running
|
||||
sudo pkill nova-baremetal-deploy-helper || true
|
||||
run_process baremetal "nova-baremetal-deploy-helper"
|
||||
fi
|
||||
|
||||
# Save some values we generated for later use
|
||||
CURRENT_RUN_TIME=$(date "+$TIMESTAMP_FORMAT")
|
||||
echo "# $CURRENT_RUN_TIME" >$TOP_DIR/.stackenv
|
||||
|
4
stackrc
4
stackrc
@ -551,7 +551,7 @@ esac
|
||||
# Use 64bit fedora image if heat is enabled
|
||||
if [[ "$ENABLED_SERVICES" =~ 'h-api' ]]; then
|
||||
case "$VIRT_DRIVER" in
|
||||
libvirt|baremetal|ironic)
|
||||
libvirt|ironic)
|
||||
HEAT_CFN_IMAGE_URL=${HEAT_CFN_IMAGE_URL:-"https://download.fedoraproject.org/pub/alt/openstack/20/x86_64/Fedora-x86_64-20-20140618-sda.qcow2"}
|
||||
IMAGE_URLS+=",$HEAT_CFN_IMAGE_URL"
|
||||
;;
|
||||
@ -563,7 +563,7 @@ fi
|
||||
# Trove needs a custom image for its work
|
||||
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
|
||||
case "$VIRT_DRIVER" in
|
||||
libvirt|baremetal|ironic|xenapi)
|
||||
libvirt|ironic|xenapi)
|
||||
TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu/mysql.qcow2"}
|
||||
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
|
||||
;;
|
||||
|
@ -53,7 +53,6 @@ source $TOP_DIR/lib/swift
|
||||
source $TOP_DIR/lib/ceilometer
|
||||
source $TOP_DIR/lib/heat
|
||||
source $TOP_DIR/lib/neutron
|
||||
source $TOP_DIR/lib/baremetal
|
||||
source $TOP_DIR/lib/ldap
|
||||
source $TOP_DIR/lib/dstat
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user