Files
training-labs/oslabs/osbash/scripts/ubuntu/setup_nova_compute.sh
Pranav Salunke 9aae759289 Refactors the architecture of osbash
Changes to the repository layout to incorporate the following:

  1. Migrate to dedicated repository
  2. Rebranding osbash to openstack-labs
  3. Adding Python specific bits
  4. Allowing a wrapper and switch to osbash meanwhile the
     python scripts (stacktrain) is underprogress

The current repository structure will allow us to carry out the above
mentioned changes while the stable code base is usable and will also
allow us to update the version of OpenStack being deployed on osbash.

This is the rough sketch of the repository ignoring the boilerplate:

    .
    |-- doc
    |-- openstack-labs
    |   |-- img
    |   |-- osbash
    |   |   |-- config
    |   |   |-- lib
    |   |   |-- tools
    |   |   |-- scripts
    |   |   |-- osbash.sh
    |   |   `-- wbatch
    |   |-- stacktrain
    |   |   `-- lib
    |   `-- stacktrain.py
    `-- oslabs.py

Note: Also adds/edits existing boilerplate (README's, Tools etc.)

Co-Authored-By: Roger Luethi <rl@patchworkscience.org>
Co-Authored-By: Sayali Lunkad <sayali.92720@gmail.com>
2015-09-29 11:23:32 +02:00

71 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/credentials"
source "$LIB_DIR/functions.guest"
source "$CONFIG_DIR/admin-openstackrc.sh"
exec_logfile
indicate_current_auto
#------------------------------------------------------------------------------
# Set up OpenStack Compute (nova) for compute node.
# http://docs.openstack.org/juno/install-guide/install/apt/content/ch_nova.html#nova-compute-install
#------------------------------------------------------------------------------
echo "Installing nova for compute node."
# We can't use KVM inside VirtualBox.
sudo apt-get install -y nova-compute-qemu sysfsutils
echo "Configuring nova for compute node."
conf=/etc/nova/nova.conf
echo "Configuring $conf."
# Configure RabbitMQ variables
iniset_sudo $conf DEFAULT rpc_backend rabbit
iniset_sudo $conf DEFAULT rabbit_host controller-mgmt
iniset_sudo $conf DEFAULT rabbit_password "$RABBIT_PASSWORD"
# Configuring [DEFAULT] section
iniset_sudo $conf DEFAULT auth_strategy keystone
nova_admin_user=$(service_to_user_name nova)
nova_admin_password=$(service_to_user_password nova)
# Configure [keystone_authtoken] section
iniset_sudo $conf keystone_authtoken auth_uri http://controller-mgmt:5000/v2.0
iniset_sudo $conf keystone_authtoken identity_uri http://controller-mgmt:35357
iniset_sudo $conf keystone_authtoken admin_tenant_name "$SERVICE_TENANT_NAME"
iniset_sudo $conf keystone_authtoken admin_user "$nova_admin_user"
iniset_sudo $conf keystone_authtoken admin_password "$nova_admin_password"
iniset_sudo $conf DEFAULT my_ip "$(hostname_to_ip compute-mgmt)"
iniset_sudo $conf DEFAULT vnc_enabled True
iniset_sudo $conf DEFAULT vncserver_listen 0.0.0.0
iniset_sudo $conf DEFAULT vncserver_proxyclient_address compute-mgmt
iniset_sudo $conf DEFAULT novncproxy_base_url http://"$(hostname_to_ip controller-api)":6080/vnc_auto.html
iniset_sudo $conf glance host controller-mgmt
iniset_sudo $conf DEFAULT verbose True
# Configure nova-compute.conf
conf=/etc/nova/nova-compute.conf
echo -n "Hardware acceleration for virtualization: "
if sudo egrep -q '(vmx|svm)' /proc/cpuinfo; then
echo "available."
else
echo "not available."
iniset_sudo $conf libvirt virt_type qemu
fi
echo "Config: $(sudo grep virt_type $conf)"
echo "Restarting nova services."
sudo service nova-compute restart
# Remove SQLite database created by Ubuntu package for nova.
sudo rm -v /var/lib/nova/nova.sqlite