This has been deleted from the nova tree, we should purge it from
devstack, as it will not work any more.
Change-Id: I20501fec140998b91c9ddfd84b7b10168624430a
| ... | ... |
@@ -139,7 +139,6 @@ Scripts |
| 139 | 139 |
* `functions <functions.html>`__ - DevStack-specific functions |
| 140 | 140 |
* `functions-common <functions-common.html>`__ - Functions shared with other projects |
| 141 | 141 |
* `lib/apache <lib/apache.html>`__ |
| 142 |
-* `lib/baremetal <lib/baremetal.html>`__ |
|
| 143 | 142 |
* `lib/ceilometer <lib/ceilometer.html>`__ |
| 144 | 143 |
* `lib/ceph <lib/ceph.html>`__ |
| 145 | 144 |
* `lib/cinder <lib/cinder.html>`__ |
| 146 | 145 |
deleted file mode 100644 |
| ... | ... |
@@ -1,439 +0,0 @@ |
| 1 |
-## vim: tabstop=4 shiftwidth=4 softtabstop=4 |
|
| 2 |
- |
|
| 3 |
-## Copyright (c) 2012 Hewlett-Packard Development Company, L.P. |
|
| 4 |
-## All Rights Reserved. |
|
| 5 |
-## |
|
| 6 |
-## Licensed under the Apache License, Version 2.0 (the "License"); you may |
|
| 7 |
-## not use this file except in compliance with the License. You may obtain |
|
| 8 |
-## a copy of the License at |
|
| 9 |
-## |
|
| 10 |
-## http://www.apache.org/licenses/LICENSE-2.0 |
|
| 11 |
-## |
|
| 12 |
-## Unless required by applicable law or agreed to in writing, software |
|
| 13 |
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
| 14 |
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
| 15 |
-## License for the specific language governing permissions and limitations |
|
| 16 |
-## under the License. |
|
| 17 |
- |
|
| 18 |
- |
|
| 19 |
-# This file provides devstack with the environment and utilities to |
|
| 20 |
-# control nova-compute's baremetal driver. |
|
| 21 |
-# It sets reasonable defaults to run within a single host, |
|
| 22 |
-# using virtual machines in place of physical hardware. |
|
| 23 |
-# However, by changing just a few options, devstack+baremetal can in fact |
|
| 24 |
-# control physical hardware resources on the same network, if you know |
|
| 25 |
-# the MAC address(es) and IPMI credentials. |
|
| 26 |
-# |
|
| 27 |
-# At a minimum, to enable the baremetal driver, you must set these in localrc: |
|
| 28 |
-# |
|
| 29 |
-# VIRT_DRIVER=baremetal |
|
| 30 |
-# ENABLED_SERVICES="$ENABLED_SERVICES,baremetal" |
|
| 31 |
-# |
|
| 32 |
-# |
|
| 33 |
-# We utilize diskimage-builder to create a ramdisk, and then |
|
| 34 |
-# baremetal driver uses that to push a disk image onto the node(s). |
|
| 35 |
-# |
|
| 36 |
-# Below we define various defaults which control the behavior of the |
|
| 37 |
-# baremetal compute service, and inform it of the hardware it will control. |
|
| 38 |
-# |
|
| 39 |
-# Below that, various functions are defined, which are called by devstack |
|
| 40 |
-# in the following order: |
|
| 41 |
-# |
|
| 42 |
-# before nova-cpu starts: |
|
| 43 |
-# |
|
| 44 |
-# - prepare_baremetal_toolchain |
|
| 45 |
-# - configure_baremetal_nova_dirs |
|
| 46 |
-# |
|
| 47 |
-# after nova and glance have started: |
|
| 48 |
-# |
|
| 49 |
-# - build_and_upload_baremetal_deploy_k_and_r $token |
|
| 50 |
-# - create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID |
|
| 51 |
-# - upload_baremetal_image $url $token |
|
| 52 |
-# - add_baremetal_node <first_mac> <second_mac> |
|
| 53 |
- |
|
| 54 |
- |
|
| 55 |
-# Save trace setting |
|
| 56 |
-XTRACE=$(set +o | grep xtrace) |
|
| 57 |
-set +o xtrace |
|
| 58 |
- |
|
| 59 |
- |
|
| 60 |
-# Sub-driver settings |
|
| 61 |
-# ------------------- |
|
| 62 |
- |
|
| 63 |
-# sub-driver to use for kernel deployment |
|
| 64 |
-# |
|
| 65 |
-# - nova.virt.baremetal.pxe.PXE |
|
| 66 |
-# - nova.virt.baremetal.tilera.TILERA |
|
| 67 |
-BM_DRIVER=${BM_DRIVER:-nova.virt.baremetal.pxe.PXE}
|
|
| 68 |
- |
|
| 69 |
-# sub-driver to use for remote power management |
|
| 70 |
-# |
|
| 71 |
-# - nova.virt.baremetal.fake.FakePowerManager, for manual power control |
|
| 72 |
-# - nova.virt.baremetal.ipmi.IPMI, for remote IPMI |
|
| 73 |
-# - nova.virt.baremetal.tilera_pdu.Pdu, for TilePro hardware |
|
| 74 |
-BM_POWER_MANAGER=${BM_POWER_MANAGER:-nova.virt.baremetal.fake.FakePowerManager}
|
|
| 75 |
- |
|
| 76 |
- |
|
| 77 |
-# These should be customized to your environment and hardware |
|
| 78 |
-# ----------------------------------------------------------- |
|
| 79 |
- |
|
| 80 |
-# To provide PXE, configure nova-network's dnsmasq rather than run the one |
|
| 81 |
-# dedicated to baremetal. When enable this, make sure these conditions are |
|
| 82 |
-# fulfilled: |
|
| 83 |
-# |
|
| 84 |
-# 1) nova-compute and nova-network runs on the same host |
|
| 85 |
-# 2) nova-network uses FlatDHCPManager |
|
| 86 |
-# |
|
| 87 |
-# NOTE: the other BM_DNSMASQ_* have no effect on the behavior if this option |
|
| 88 |
-# is enabled. |
|
| 89 |
-BM_DNSMASQ_FROM_NOVA_NETWORK=`trueorfalse False $BM_DNSMASQ_FROM_NOVA_NETWORK` |
|
| 90 |
- |
|
| 91 |
-# BM_DNSMASQ_IFACE should match FLAT_NETWORK_BRIDGE |
|
| 92 |
-BM_DNSMASQ_IFACE=${BM_DNSMASQ_IFACE:-eth0}
|
|
| 93 |
-# if testing on a physical network, |
|
| 94 |
-# BM_DNSMASQ_RANGE must be changed to suit your network |
|
| 95 |
-BM_DNSMASQ_RANGE=${BM_DNSMASQ_RANGE:-}
|
|
| 96 |
- |
|
| 97 |
-# BM_DNSMASQ_DNS provide dns server to bootstrap clients |
|
| 98 |
-BM_DNSMASQ_DNS=${BM_DNSMASQ_DNS:-}
|
|
| 99 |
- |
|
| 100 |
-# BM_FIRST_MAC *must* be set to the MAC address of the node you will |
|
| 101 |
-# boot. This is passed to dnsmasq along with the kernel/ramdisk to |
|
| 102 |
-# deploy via PXE. |
|
| 103 |
-BM_FIRST_MAC=${BM_FIRST_MAC:-}
|
|
| 104 |
- |
|
| 105 |
-# BM_SECOND_MAC is only important if the host has >1 NIC. |
|
| 106 |
-BM_SECOND_MAC=${BM_SECOND_MAC:-}
|
|
| 107 |
- |
|
| 108 |
-# Hostname for the baremetal nova-compute node, if not run on this host |
|
| 109 |
-BM_HOSTNAME=${BM_HOSTNAME:-$(hostname -f)}
|
|
| 110 |
- |
|
| 111 |
-# BM_PM_* options are only necessary if BM_POWER_MANAGER=...IPMI |
|
| 112 |
-BM_PM_ADDR=${BM_PM_ADDR:-0.0.0.0}
|
|
| 113 |
-BM_PM_USER=${BM_PM_USER:-user}
|
|
| 114 |
-BM_PM_PASS=${BM_PM_PASS:-pass}
|
|
| 115 |
- |
|
| 116 |
-# BM_FLAVOR_* options are arbitrary and not necessarily related to |
|
| 117 |
-# physical hardware capacity. These can be changed if you are testing |
|
| 118 |
-# BaremetalHostManager with multiple nodes and different flavors. |
|
| 119 |
-BM_CPU_ARCH=${BM_CPU_ARCH:-x86_64}
|
|
| 120 |
-BM_FLAVOR_CPU=${BM_FLAVOR_CPU:-1}
|
|
| 121 |
-BM_FLAVOR_RAM=${BM_FLAVOR_RAM:-1024}
|
|
| 122 |
-BM_FLAVOR_ROOT_DISK=${BM_FLAVOR_ROOT_DISK:-10}
|
|
| 123 |
-BM_FLAVOR_EPHEMERAL_DISK=${BM_FLAVOR_EPHEMERAL_DISK:-0}
|
|
| 124 |
-BM_FLAVOR_SWAP=${BM_FLAVOR_SWAP:-1}
|
|
| 125 |
-BM_FLAVOR_NAME=${BM_FLAVOR_NAME:-bm.small}
|
|
| 126 |
-BM_FLAVOR_ID=${BM_FLAVOR_ID:-11}
|
|
| 127 |
-BM_FLAVOR_ARCH=${BM_FLAVOR_ARCH:-$BM_CPU_ARCH}
|
|
| 128 |
- |
|
| 129 |
- |
|
| 130 |
-# Use DIB to create deploy ramdisk and kernel. |
|
| 131 |
-BM_BUILD_DEPLOY_RAMDISK=`trueorfalse True $BM_BUILD_DEPLOY_RAMDISK` |
|
| 132 |
-# If not use DIB, these files are used as deploy ramdisk/kernel. |
|
| 133 |
-# (The value must be a relative path from $TOP_DIR/files/) |
|
| 134 |
-BM_DEPLOY_RAMDISK=${BM_DEPLOY_RAMDISK:-}
|
|
| 135 |
-BM_DEPLOY_KERNEL=${BM_DEPLOY_KERNEL:-}
|
|
| 136 |
- |
|
| 137 |
-# If you need to add any extra flavors to the deploy ramdisk image |
|
| 138 |
-# eg, specific network drivers, specify them here |
|
| 139 |
-# |
|
| 140 |
-# NOTE(deva): this will be moved to lib/ironic in a future patch |
|
| 141 |
-# for now, set the default to a suitable value for Ironic's needs |
|
| 142 |
-BM_DEPLOY_FLAVOR=${BM_DEPLOY_FLAVOR:--a amd64 ubuntu deploy-ironic}
|
|
| 143 |
- |
|
| 144 |
-# set URL and version for google shell-in-a-box |
|
| 145 |
-BM_SHELL_IN_A_BOX=${BM_SHELL_IN_A_BOX:-http://shellinabox.googlecode.com/files/shellinabox-2.14.tar.gz}
|
|
| 146 |
- |
|
| 147 |
- |
|
| 148 |
-# Functions |
|
| 149 |
-# --------- |
|
| 150 |
- |
|
| 151 |
-# Check if baremetal is properly enabled |
|
| 152 |
-# Returns false if VIRT_DRIVER is not baremetal, or if ENABLED_SERVICES |
|
| 153 |
-# does not contain "baremetal" |
|
| 154 |
-function is_baremetal {
|
|
| 155 |
- if [[ "$ENABLED_SERVICES" =~ 'baremetal' && "$VIRT_DRIVER" = 'baremetal' ]]; then |
|
| 156 |
- return 0 |
|
| 157 |
- fi |
|
| 158 |
- return 1 |
|
| 159 |
-} |
|
| 160 |
- |
|
| 161 |
-# Install diskimage-builder and shell-in-a-box |
|
| 162 |
-# so that we can build the deployment kernel & ramdisk |
|
| 163 |
-function prepare_baremetal_toolchain {
|
|
| 164 |
- if [[ $(type -P ramdisk-image-create) == "" ]]; then |
|
| 165 |
- pip_install diskimage_builder |
|
| 166 |
- fi |
|
| 167 |
- local shellinabox_basename=$(basename $BM_SHELL_IN_A_BOX) |
|
| 168 |
- if [[ ! -e $DEST/$shellinabox_basename ]]; then |
|
| 169 |
- cd $DEST |
|
| 170 |
- wget $BM_SHELL_IN_A_BOX |
|
| 171 |
- fi |
|
| 172 |
- if [[ ! -d $DEST/${shellinabox_basename%%.tar.gz} ]]; then
|
|
| 173 |
- cd $DEST |
|
| 174 |
- tar xzf $shellinabox_basename |
|
| 175 |
- fi |
|
| 176 |
- if [[ ! $(which shellinaboxd) ]]; then |
|
| 177 |
- cd $DEST/${shellinabox_basename%%.tar.gz}
|
|
| 178 |
- ./configure |
|
| 179 |
- make |
|
| 180 |
- sudo make install |
|
| 181 |
- fi |
|
| 182 |
-} |
|
| 183 |
- |
|
| 184 |
-# prepare various directories needed by baremetal hypervisor |
|
| 185 |
-function configure_baremetal_nova_dirs {
|
|
| 186 |
- # ensure /tftpboot is prepared |
|
| 187 |
- sudo mkdir -p /tftpboot |
|
| 188 |
- sudo mkdir -p /tftpboot/pxelinux.cfg |
|
| 189 |
- |
|
| 190 |
- PXEBIN=/usr/share/syslinux/pxelinux.0 |
|
| 191 |
- if [ ! -f $PXEBIN ]; then |
|
| 192 |
- PXEBIN=/usr/lib/syslinux/pxelinux.0 |
|
| 193 |
- if [ ! -f $PXEBIN ]; then |
|
| 194 |
- die $LINENO "pxelinux.0 (from SYSLINUX) not found." |
|
| 195 |
- fi |
|
| 196 |
- fi |
|
| 197 |
- |
|
| 198 |
- sudo cp $PXEBIN /tftpboot/ |
|
| 199 |
- sudo chown -R $STACK_USER:$LIBVIRT_GROUP /tftpboot |
|
| 200 |
- |
|
| 201 |
- # ensure $NOVA_STATE_PATH/baremetal is prepared |
|
| 202 |
- sudo mkdir -p $NOVA_STATE_PATH/baremetal |
|
| 203 |
- sudo mkdir -p $NOVA_STATE_PATH/baremetal/console |
|
| 204 |
- sudo mkdir -p $NOVA_STATE_PATH/baremetal/dnsmasq |
|
| 205 |
- sudo touch $NOVA_STATE_PATH/baremetal/dnsmasq/dnsmasq-dhcp.host |
|
| 206 |
- sudo chown -R $STACK_USER $NOVA_STATE_PATH/baremetal |
|
| 207 |
- |
|
| 208 |
- # ensure dnsmasq is installed but not running |
|
| 209 |
- # because baremetal driver will reconfigure and restart this as needed |
|
| 210 |
- is_package_installed dnsmasq || install_package dnsmasq |
|
| 211 |
- stop_service dnsmasq |
|
| 212 |
-} |
|
| 213 |
- |
|
| 214 |
-# build deploy kernel+ramdisk, then upload them to glance |
|
| 215 |
-# this function sets BM_DEPLOY_KERNEL_ID and BM_DEPLOY_RAMDISK_ID |
|
| 216 |
-function upload_baremetal_deploy {
|
|
| 217 |
- token=$1 |
|
| 218 |
- |
|
| 219 |
- if [ "$BM_BUILD_DEPLOY_RAMDISK" = "True" ]; then |
|
| 220 |
- BM_DEPLOY_KERNEL=bm-deploy.kernel |
|
| 221 |
- BM_DEPLOY_RAMDISK=bm-deploy.initramfs |
|
| 222 |
- if [ ! -e "$TOP_DIR/files/$BM_DEPLOY_KERNEL" -o ! -e "$TOP_DIR/files/$BM_DEPLOY_RAMDISK" ]; then |
|
| 223 |
- ramdisk-image-create $BM_DEPLOY_FLAVOR \ |
|
| 224 |
- -o $TOP_DIR/files/bm-deploy |
|
| 225 |
- fi |
|
| 226 |
- fi |
|
| 227 |
- |
|
| 228 |
- # load them into glance |
|
| 229 |
- BM_DEPLOY_KERNEL_ID=$(openstack \ |
|
| 230 |
- --os-token $token \ |
|
| 231 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 232 |
- image create \ |
|
| 233 |
- $BM_DEPLOY_KERNEL \ |
|
| 234 |
- --public --disk-format=aki \ |
|
| 235 |
- --container-format=aki \ |
|
| 236 |
- < $TOP_DIR/files/$BM_DEPLOY_KERNEL | grep ' id ' | get_field 2) |
|
| 237 |
- BM_DEPLOY_RAMDISK_ID=$(openstack \ |
|
| 238 |
- --os-token $token \ |
|
| 239 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 240 |
- image create \ |
|
| 241 |
- $BM_DEPLOY_RAMDISK \ |
|
| 242 |
- --public --disk-format=ari \ |
|
| 243 |
- --container-format=ari \ |
|
| 244 |
- < $TOP_DIR/files/$BM_DEPLOY_RAMDISK | grep ' id ' | get_field 2) |
|
| 245 |
-} |
|
| 246 |
- |
|
| 247 |
-# create a basic baremetal flavor, associated with deploy kernel & ramdisk |
|
| 248 |
-# |
|
| 249 |
-# Usage: create_baremetal_flavor <aki_uuid> <ari_uuid> |
|
| 250 |
-function create_baremetal_flavor {
|
|
| 251 |
- aki=$1 |
|
| 252 |
- ari=$2 |
|
| 253 |
- nova flavor-create $BM_FLAVOR_NAME $BM_FLAVOR_ID \ |
|
| 254 |
- $BM_FLAVOR_RAM $BM_FLAVOR_ROOT_DISK $BM_FLAVOR_CPU |
|
| 255 |
- nova flavor-key $BM_FLAVOR_NAME set \ |
|
| 256 |
- "cpu_arch"="$BM_FLAVOR_ARCH" \ |
|
| 257 |
- "baremetal:deploy_kernel_id"="$aki" \ |
|
| 258 |
- "baremetal:deploy_ramdisk_id"="$ari" |
|
| 259 |
- |
|
| 260 |
-} |
|
| 261 |
- |
|
| 262 |
-# Pull run-time kernel/ramdisk out of disk image and load into glance. |
|
| 263 |
-# Note that $file is currently expected to be in qcow2 format. |
|
| 264 |
-# Sets KERNEL_ID and RAMDISK_ID |
|
| 265 |
-# |
|
| 266 |
-# Usage: extract_and_upload_k_and_r_from_image $token $file |
|
| 267 |
-function extract_and_upload_k_and_r_from_image {
|
|
| 268 |
- token=$1 |
|
| 269 |
- file=$2 |
|
| 270 |
- image_name=$(basename "$file" ".qcow2") |
|
| 271 |
- |
|
| 272 |
- # this call returns the file names as "$kernel,$ramdisk" |
|
| 273 |
- out=$(disk-image-get-kernel \ |
|
| 274 |
- -x -d $TOP_DIR/files -o bm-deploy -i $file) |
|
| 275 |
- if [ $? -ne 0 ]; then |
|
| 276 |
- die $LINENO "Failed to get kernel and ramdisk from $file" |
|
| 277 |
- fi |
|
| 278 |
- XTRACE=$(set +o | grep xtrace) |
|
| 279 |
- set +o xtrace |
|
| 280 |
- out=$(echo "$out" | tail -1) |
|
| 281 |
- $XTRACE |
|
| 282 |
- OUT_KERNEL=${out%%,*}
|
|
| 283 |
- OUT_RAMDISK=${out##*,}
|
|
| 284 |
- |
|
| 285 |
- # load them into glance |
|
| 286 |
- KERNEL_ID=$(openstack \ |
|
| 287 |
- --os-token $token \ |
|
| 288 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 289 |
- image create \ |
|
| 290 |
- $image_name-kernel \ |
|
| 291 |
- --public --disk-format=aki \ |
|
| 292 |
- --container-format=aki \ |
|
| 293 |
- < $TOP_DIR/files/$OUT_KERNEL | grep ' id ' | get_field 2) |
|
| 294 |
- RAMDISK_ID=$(openstack \ |
|
| 295 |
- --os-token $token \ |
|
| 296 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 297 |
- image create \ |
|
| 298 |
- $image_name-initrd \ |
|
| 299 |
- --public --disk-format=ari \ |
|
| 300 |
- --container-format=ari \ |
|
| 301 |
- < $TOP_DIR/files/$OUT_RAMDISK | grep ' id ' | get_field 2) |
|
| 302 |
-} |
|
| 303 |
- |
|
| 304 |
- |
|
| 305 |
-# Re-implementation of devstack's "upload_image" function |
|
| 306 |
-# |
|
| 307 |
-# Takes the same parameters, but has some peculiarities which made it |
|
| 308 |
-# easier to create a separate method, rather than complicate the logic |
|
| 309 |
-# of the existing function. |
|
| 310 |
-function upload_baremetal_image {
|
|
| 311 |
- local image_url=$1 |
|
| 312 |
- local token=$2 |
|
| 313 |
- |
|
| 314 |
- # Create a directory for the downloaded image tarballs. |
|
| 315 |
- mkdir -p $FILES/images |
|
| 316 |
- |
|
| 317 |
- # Downloads the image (uec ami+aki style), then extracts it. |
|
| 318 |
- IMAGE_FNAME=`basename "$image_url"` |
|
| 319 |
- if [[ ! -f $FILES/$IMAGE_FNAME || \ |
|
| 320 |
- "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then |
|
| 321 |
- wget -c $image_url -O $FILES/$IMAGE_FNAME |
|
| 322 |
- if [[ $? -ne 0 ]]; then |
|
| 323 |
- echo "Not found: $image_url" |
|
| 324 |
- return |
|
| 325 |
- fi |
|
| 326 |
- fi |
|
| 327 |
- |
|
| 328 |
- local KERNEL="" |
|
| 329 |
- local RAMDISK="" |
|
| 330 |
- local DISK_FORMAT="" |
|
| 331 |
- local CONTAINER_FORMAT="" |
|
| 332 |
- case "$IMAGE_FNAME" in |
|
| 333 |
- *.tar.gz|*.tgz) |
|
| 334 |
- # Extract ami and aki files |
|
| 335 |
- [ "${IMAGE_FNAME%.tar.gz}" != "$IMAGE_FNAME" ] &&
|
|
| 336 |
- IMAGE_NAME="${IMAGE_FNAME%.tar.gz}" ||
|
|
| 337 |
- IMAGE_NAME="${IMAGE_FNAME%.tgz}"
|
|
| 338 |
- xdir="$FILES/images/$IMAGE_NAME" |
|
| 339 |
- rm -Rf "$xdir"; |
|
| 340 |
- mkdir "$xdir" |
|
| 341 |
- tar -zxf $FILES/$IMAGE_FNAME -C "$xdir" |
|
| 342 |
- KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do |
|
| 343 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 344 |
- RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do |
|
| 345 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 346 |
- IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do |
|
| 347 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 348 |
- if [[ -z "$IMAGE_NAME" ]]; then |
|
| 349 |
- IMAGE_NAME=$(basename "$IMAGE" ".img") |
|
| 350 |
- fi |
|
| 351 |
- DISK_FORMAT=ami |
|
| 352 |
- CONTAINER_FORMAT=ami |
|
| 353 |
- ;; |
|
| 354 |
- *.qcow2) |
|
| 355 |
- IMAGE="$FILES/${IMAGE_FNAME}"
|
|
| 356 |
- IMAGE_NAME=$(basename "$IMAGE" ".qcow2") |
|
| 357 |
- DISK_FORMAT=qcow2 |
|
| 358 |
- CONTAINER_FORMAT=bare |
|
| 359 |
- ;; |
|
| 360 |
- *) echo "Do not know what to do with $IMAGE_FNAME"; false;; |
|
| 361 |
- esac |
|
| 362 |
- |
|
| 363 |
- if [ "$CONTAINER_FORMAT" = "bare" ]; then |
|
| 364 |
- extract_and_upload_k_and_r_from_image $token $IMAGE |
|
| 365 |
- elif [ "$CONTAINER_FORMAT" = "ami" ]; then |
|
| 366 |
- KERNEL_ID=$(openstack \ |
|
| 367 |
- --os-token $token \ |
|
| 368 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 369 |
- image create \ |
|
| 370 |
- "$IMAGE_NAME-kernel" --public \ |
|
| 371 |
- --container-format aki \ |
|
| 372 |
- --disk-format aki < "$KERNEL" | grep ' id ' | get_field 2) |
|
| 373 |
- RAMDISK_ID=$(openstack \ |
|
| 374 |
- --os-token $token \ |
|
| 375 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 376 |
- image create \ |
|
| 377 |
- "$IMAGE_NAME-ramdisk" --public \ |
|
| 378 |
- --container-format ari \ |
|
| 379 |
- --disk-format ari < "$RAMDISK" | grep ' id ' | get_field 2) |
|
| 380 |
- else |
|
| 381 |
- # TODO(deva): add support for other image types |
|
| 382 |
- return |
|
| 383 |
- fi |
|
| 384 |
- |
|
| 385 |
- openstack \ |
|
| 386 |
- --os-token $token \ |
|
| 387 |
- --os-url http://$GLANCE_HOSTPORT \ |
|
| 388 |
- image create \ |
|
| 389 |
- "${IMAGE_NAME%.img}" --public \
|
|
| 390 |
- --container-format $CONTAINER_FORMAT \ |
|
| 391 |
- --disk-format $DISK_FORMAT \ |
|
| 392 |
- ${KERNEL_ID:+--property kernel_id=$KERNEL_ID} \
|
|
| 393 |
- ${RAMDISK_ID:+--property ramdisk_id=$RAMDISK_ID} < "${IMAGE}"
|
|
| 394 |
- |
|
| 395 |
- # override DEFAULT_IMAGE_NAME so that tempest can find the image |
|
| 396 |
- # that we just uploaded in glance |
|
| 397 |
- DEFAULT_IMAGE_NAME="${IMAGE_NAME%.img}"
|
|
| 398 |
-} |
|
| 399 |
- |
|
| 400 |
-function clear_baremetal_of_all_nodes {
|
|
| 401 |
- list=$(nova baremetal-node-list | awk -F '| ' 'NR>3 {print $2}' )
|
|
| 402 |
- for node in $list; do |
|
| 403 |
- nova baremetal-node-delete $node |
|
| 404 |
- done |
|
| 405 |
-} |
|
| 406 |
- |
|
| 407 |
-# Inform nova-baremetal about nodes, MACs, etc. |
|
| 408 |
-# Defaults to using BM_FIRST_MAC and BM_SECOND_MAC if parameters not specified |
|
| 409 |
-# |
|
| 410 |
-# Usage: add_baremetal_node <first_mac> <second_mac> |
|
| 411 |
-function add_baremetal_node {
|
|
| 412 |
- mac_1=${1:-$BM_FIRST_MAC}
|
|
| 413 |
- mac_2=${2:-$BM_SECOND_MAC}
|
|
| 414 |
- |
|
| 415 |
- id=$(nova baremetal-node-create \ |
|
| 416 |
- --pm_address="$BM_PM_ADDR" \ |
|
| 417 |
- --pm_user="$BM_PM_USER" \ |
|
| 418 |
- --pm_password="$BM_PM_PASS" \ |
|
| 419 |
- "$BM_HOSTNAME" \ |
|
| 420 |
- "$BM_FLAVOR_CPU" \ |
|
| 421 |
- "$BM_FLAVOR_RAM" \ |
|
| 422 |
- "$BM_FLAVOR_ROOT_DISK" \ |
|
| 423 |
- "$mac_1" \ |
|
| 424 |
- | grep ' id ' | get_field 2 ) |
|
| 425 |
- [ $? -eq 0 ] || [ "$id" ] || die $LINENO "Error adding baremetal node" |
|
| 426 |
- if [ -n "$mac_2" ]; then |
|
| 427 |
- id2=$(nova baremetal-interface-add "$id" "$mac_2" ) |
|
| 428 |
- [ $? -eq 0 ] || [ "$id2" ] || die $LINENO "Error adding interface to barmetal node $id" |
|
| 429 |
- fi |
|
| 430 |
-} |
|
| 431 |
- |
|
| 432 |
- |
|
| 433 |
-# Restore xtrace |
|
| 434 |
-$XTRACE |
|
| 435 |
- |
|
| 436 |
-# Tell emacs to use shell-script-mode |
|
| 437 |
-## Local variables: |
|
| 438 |
-## mode: shell-script |
|
| 439 |
-## End: |
| ... | ... |
@@ -529,25 +529,7 @@ function create_neutron_initial_network {
|
| 529 | 529 |
TENANT_ID=$(openstack project list | grep " demo " | get_field 1) |
| 530 | 530 |
die_if_not_set $LINENO TENANT_ID "Failure retrieving TENANT_ID for demo" |
| 531 | 531 |
|
| 532 |
- # Create a small network |
|
| 533 |
- # Since neutron command is executed in admin context at this point, |
|
| 534 |
- # ``--tenant-id`` needs to be specified. |
|
| 535 |
- if is_baremetal; then |
|
| 536 |
- if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then |
|
| 537 |
- die $LINENO "Neutron settings for baremetal not set.. exiting" |
|
| 538 |
- fi |
|
| 539 |
- sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE |
|
| 540 |
- for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
|
|
| 541 |
- sudo ip addr del $IP dev $PUBLIC_INTERFACE |
|
| 542 |
- sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE |
|
| 543 |
- done |
|
| 544 |
- 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) |
|
| 545 |
- die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID" |
|
| 546 |
- 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)
|
|
| 547 |
- die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $TENANT_ID" |
|
| 548 |
- sudo ifconfig $OVS_PHYSICAL_BRIDGE up |
|
| 549 |
- sudo route add default gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE |
|
| 550 |
- elif is_provider_network; then |
|
| 532 |
+ if is_provider_network; then |
|
| 551 | 533 |
die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK" |
| 552 | 534 |
die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE" |
| 553 | 535 |
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)
|
| ... | ... |
@@ -635,12 +635,6 @@ function init_nova {
|
| 635 | 635 |
if is_service_enabled n-cell; then |
| 636 | 636 |
recreate_database $NOVA_CELLS_DB latin1 |
| 637 | 637 |
fi |
| 638 |
- |
|
| 639 |
- # (Re)create nova baremetal database |
|
| 640 |
- if is_baremetal; then |
|
| 641 |
- recreate_database nova_bm latin1 |
|
| 642 |
- $NOVA_BIN_DIR/nova-baremetal-manage db sync |
|
| 643 |
- fi |
|
| 644 | 638 |
fi |
| 645 | 639 |
|
| 646 | 640 |
create_nova_cache_dir |
| 647 | 641 |
deleted file mode 100644 |
| ... | ... |
@@ -1,87 +0,0 @@ |
| 1 |
-# lib/nova_plugins/hypervisor-baremetal |
|
| 2 |
-# Configure the baremetal hypervisor |
|
| 3 |
- |
|
| 4 |
-# Enable with: |
|
| 5 |
-# VIRT_DRIVER=baremetal |
|
| 6 |
- |
|
| 7 |
-# Dependencies: |
|
| 8 |
-# ``functions`` file |
|
| 9 |
-# ``nova`` configuration |
|
| 10 |
- |
|
| 11 |
-# install_nova_hypervisor - install any external requirements |
|
| 12 |
-# configure_nova_hypervisor - make configuration changes, including those to other services |
|
| 13 |
-# start_nova_hypervisor - start any external services |
|
| 14 |
-# stop_nova_hypervisor - stop any external services |
|
| 15 |
-# cleanup_nova_hypervisor - remove transient data and cache |
|
| 16 |
- |
|
| 17 |
-# Save trace setting |
|
| 18 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
| 19 |
-set +o xtrace |
|
| 20 |
- |
|
| 21 |
- |
|
| 22 |
-# Defaults |
|
| 23 |
-# -------- |
|
| 24 |
- |
|
| 25 |
-NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager}
|
|
| 26 |
-PUBLIC_INTERFACE_DEFAULT=eth0 |
|
| 27 |
-FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
|
|
| 28 |
-FLAT_NETWORK_BRIDGE_DEFAULT=br100 |
|
| 29 |
-STUB_NETWORK=${STUB_NETWORK:-False}
|
|
| 30 |
- |
|
| 31 |
- |
|
| 32 |
-# Entry Points |
|
| 33 |
-# ------------ |
|
| 34 |
- |
|
| 35 |
-# clean_nova_hypervisor - Clean up an installation |
|
| 36 |
-function cleanup_nova_hypervisor {
|
|
| 37 |
- # This function intentionally left blank |
|
| 38 |
- : |
|
| 39 |
-} |
|
| 40 |
- |
|
| 41 |
-# configure_nova_hypervisor - Set config files, create data dirs, etc |
|
| 42 |
-function configure_nova_hypervisor {
|
|
| 43 |
- configure_baremetal_nova_dirs |
|
| 44 |
- |
|
| 45 |
- iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm` |
|
| 46 |
- LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
|
|
| 47 |
- iniset $NOVA_CONF DEFAULT compute_driver nova.virt.baremetal.driver.BareMetalDriver |
|
| 48 |
- iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER |
|
| 49 |
- iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.baremetal_host_manager.BaremetalHostManager |
|
| 50 |
- iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0 |
|
| 51 |
- iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0 |
|
| 52 |
- iniset $NOVA_CONF baremetal flavor_extra_specs cpu_arch:$BM_CPU_ARCH |
|
| 53 |
- iniset $NOVA_CONF baremetal driver $BM_DRIVER |
|
| 54 |
- iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER |
|
| 55 |
- iniset $NOVA_CONF baremetal tftp_root /tftpboot |
|
| 56 |
- if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "True" ]]; then |
|
| 57 |
- BM_DNSMASQ_CONF=$NOVA_CONF_DIR/dnsmasq-for-baremetal-from-nova-network.conf |
|
| 58 |
- sudo cp "$FILES/dnsmasq-for-baremetal-from-nova-network.conf" "$BM_DNSMASQ_CONF" |
|
| 59 |
- iniset $NOVA_CONF DEFAULT dnsmasq_config_file "$BM_DNSMASQ_CONF" |
|
| 60 |
- fi |
|
| 61 |
-} |
|
| 62 |
- |
|
| 63 |
-# install_nova_hypervisor() - Install external components |
|
| 64 |
-function install_nova_hypervisor {
|
|
| 65 |
- # This function intentionally left blank |
|
| 66 |
- : |
|
| 67 |
-} |
|
| 68 |
- |
|
| 69 |
-# start_nova_hypervisor - Start any required external services |
|
| 70 |
-function start_nova_hypervisor {
|
|
| 71 |
- # This function intentionally left blank |
|
| 72 |
- : |
|
| 73 |
-} |
|
| 74 |
- |
|
| 75 |
-# stop_nova_hypervisor - Stop any external services |
|
| 76 |
-function stop_nova_hypervisor {
|
|
| 77 |
- # This function intentionally left blank |
|
| 78 |
- : |
|
| 79 |
-} |
|
| 80 |
- |
|
| 81 |
- |
|
| 82 |
-# Restore xtrace |
|
| 83 |
-$MY_XTRACE |
|
| 84 |
- |
|
| 85 |
-# Local variables: |
|
| 86 |
-# mode: shell-script |
|
| 87 |
-# End: |
| ... | ... |
@@ -561,7 +561,6 @@ source $TOP_DIR/lib/swift |
| 561 | 561 |
source $TOP_DIR/lib/ceilometer |
| 562 | 562 |
source $TOP_DIR/lib/heat |
| 563 | 563 |
source $TOP_DIR/lib/neutron |
| 564 |
-source $TOP_DIR/lib/baremetal |
|
| 565 | 564 |
source $TOP_DIR/lib/ldap |
| 566 | 565 |
source $TOP_DIR/lib/dstat |
| 567 | 566 |
|
| ... | ... |
@@ -1136,14 +1135,6 @@ if is_service_enabled nova; then |
| 1136 | 1136 |
init_nova_cells |
| 1137 | 1137 |
fi |
| 1138 | 1138 |
|
| 1139 |
-# Extra things to prepare nova for baremetal, before nova starts |
|
| 1140 |
-if is_service_enabled nova && is_baremetal; then |
|
| 1141 |
- echo_summary "Preparing for nova baremetal" |
|
| 1142 |
- prepare_baremetal_toolchain |
|
| 1143 |
- configure_baremetal_nova_dirs |
|
| 1144 |
-fi |
|
| 1145 |
- |
|
| 1146 |
- |
|
| 1147 | 1139 |
# Extras Configuration |
| 1148 | 1140 |
# ==================== |
| 1149 | 1141 |
|
| ... | ... |
@@ -1197,28 +1188,16 @@ if is_service_enabled g-reg; then |
| 1197 | 1197 |
TOKEN=$(keystone token-get | grep ' id ' | get_field 2) |
| 1198 | 1198 |
die_if_not_set $LINENO TOKEN "Keystone fail to get token" |
| 1199 | 1199 |
|
| 1200 |
- if is_baremetal; then |
|
| 1201 |
- echo_summary "Creating and uploading baremetal images" |
|
| 1202 |
- |
|
| 1203 |
- # build and upload separate deploy kernel & ramdisk |
|
| 1204 |
- upload_baremetal_deploy $TOKEN |
|
| 1205 |
- |
|
| 1206 |
- # upload images, separating out the kernel & ramdisk for PXE boot |
|
| 1207 |
- for image_url in ${IMAGE_URLS//,/ }; do
|
|
| 1208 |
- upload_baremetal_image $image_url $TOKEN |
|
| 1209 |
- done |
|
| 1210 |
- else |
|
| 1211 |
- echo_summary "Uploading images" |
|
| 1212 |
- |
|
| 1213 |
- # Option to upload legacy ami-tty, which works with xenserver |
|
| 1214 |
- if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then |
|
| 1215 |
- IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz"
|
|
| 1216 |
- fi |
|
| 1200 |
+ echo_summary "Uploading images" |
|
| 1217 | 1201 |
|
| 1218 |
- for image_url in ${IMAGE_URLS//,/ }; do
|
|
| 1219 |
- upload_image $image_url $TOKEN |
|
| 1220 |
- done |
|
| 1202 |
+ # Option to upload legacy ami-tty, which works with xenserver |
|
| 1203 |
+ if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then |
|
| 1204 |
+ IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz"
|
|
| 1221 | 1205 |
fi |
| 1206 |
+ |
|
| 1207 |
+ for image_url in ${IMAGE_URLS//,/ }; do
|
|
| 1208 |
+ upload_image $image_url $TOKEN |
|
| 1209 |
+ done |
|
| 1222 | 1210 |
fi |
| 1223 | 1211 |
|
| 1224 | 1212 |
# 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 |
| 1325 | 1325 |
fi |
| 1326 | 1326 |
|
| 1327 | 1327 |
|
| 1328 |
-# If we are running nova with baremetal driver, there are a few |
|
| 1329 |
-# last-mile configuration bits to attend to, which must happen |
|
| 1330 |
-# after n-api and n-sch have started. |
|
| 1331 |
-# Also, creating the baremetal flavor must happen after images |
|
| 1332 |
-# are loaded into glance, though just knowing the IDs is sufficient here |
|
| 1333 |
-if is_service_enabled nova && is_baremetal; then |
|
| 1334 |
- # create special flavor for baremetal if we know what images to associate |
|
| 1335 |
- [[ -n "$BM_DEPLOY_KERNEL_ID" ]] && [[ -n "$BM_DEPLOY_RAMDISK_ID" ]] && \ |
|
| 1336 |
- create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID |
|
| 1337 |
- |
|
| 1338 |
- # otherwise user can manually add it later by calling nova-baremetal-manage |
|
| 1339 |
- [[ -n "$BM_FIRST_MAC" ]] && add_baremetal_node |
|
| 1340 |
- |
|
| 1341 |
- if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "False" ]]; then |
|
| 1342 |
- # NOTE: we do this here to ensure that our copy of dnsmasq is running |
|
| 1343 |
- sudo pkill dnsmasq || true |
|
| 1344 |
- sudo dnsmasq --conf-file= --port=0 --enable-tftp --tftp-root=/tftpboot \ |
|
| 1345 |
- --dhcp-boot=pxelinux.0 --bind-interfaces --pid-file=/var/run/dnsmasq.pid \ |
|
| 1346 |
- --interface=$BM_DNSMASQ_IFACE --dhcp-range=$BM_DNSMASQ_RANGE \ |
|
| 1347 |
- ${BM_DNSMASQ_DNS:+--dhcp-option=option:dns-server,$BM_DNSMASQ_DNS}
|
|
| 1348 |
- fi |
|
| 1349 |
- # ensure callback daemon is running |
|
| 1350 |
- sudo pkill nova-baremetal-deploy-helper || true |
|
| 1351 |
- run_process baremetal "nova-baremetal-deploy-helper" |
|
| 1352 |
-fi |
|
| 1353 |
- |
|
| 1354 | 1328 |
# Save some values we generated for later use |
| 1355 | 1329 |
CURRENT_RUN_TIME=$(date "+$TIMESTAMP_FORMAT") |
| 1356 | 1330 |
echo "# $CURRENT_RUN_TIME" >$TOP_DIR/.stackenv |
| ... | ... |
@@ -551,7 +551,7 @@ esac |
| 551 | 551 |
# Use 64bit fedora image if heat is enabled |
| 552 | 552 |
if [[ "$ENABLED_SERVICES" =~ 'h-api' ]]; then |
| 553 | 553 |
case "$VIRT_DRIVER" in |
| 554 |
- libvirt|baremetal|ironic) |
|
| 554 |
+ libvirt|ironic) |
|
| 555 | 555 |
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"}
|
| 556 | 556 |
IMAGE_URLS+=",$HEAT_CFN_IMAGE_URL" |
| 557 | 557 |
;; |
| ... | ... |
@@ -563,7 +563,7 @@ fi |
| 563 | 563 |
# Trove needs a custom image for its work |
| 564 | 564 |
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then |
| 565 | 565 |
case "$VIRT_DRIVER" in |
| 566 |
- libvirt|baremetal|ironic|xenapi) |
|
| 566 |
+ libvirt|ironic|xenapi) |
|
| 567 | 567 |
TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu/mysql.qcow2"}
|
| 568 | 568 |
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
|
| 569 | 569 |
;; |