Adds nova scripts for training labs compute node
Adds nova scripts for training labs which will install and configure nova on a compute node. Change-Id: Ic5e5a2fee18a8c3f5b016fad75313558e9d28c08 Co-Authored-By: Roger Luethi <rl@patchworkscience.org> Partial-Bug: 1312764 Implements: blueprint openstack-training-labs
This commit is contained in:
parent
bbddea3aa6
commit
4649920e36
@ -1,4 +1,5 @@
|
||||
# Scripts for compute node
|
||||
scripts setup_nova_compute.sh
|
||||
scripts shutdown.sh
|
||||
boot
|
||||
snapshot "pre-installed"
|
||||
|
@ -18,5 +18,6 @@ fi
|
||||
sudo apt-get install -y --download-only cinder-api cinder-scheduler lvm2 \
|
||||
cinder-volume glance openstack-dashboard memcached keystone \
|
||||
neutron-server neutron-plugin-ml2 nova-api nova-cert nova-conductor \
|
||||
nova-consoleauth nova-novncproxy nova-scheduler python-novaclient
|
||||
nova-consoleauth nova-novncproxy nova-scheduler python-novaclient \
|
||||
nova-compute-kvm python-guestfs
|
||||
|
||||
|
85
labs/scripts/setup_nova_compute.sh
Executable file
85
labs/scripts/setup_nova_compute.sh
Executable file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
||||
source "$TOP_DIR/config/paths"
|
||||
source "$CONFIG_DIR/credentials"
|
||||
source "$LIB_DIR/functions.guest"
|
||||
source "$CONFIG_DIR/labs-openstackrc.sh"
|
||||
exec_logfile
|
||||
|
||||
indicate_current_auto
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Set up OpenStack Compute (nova) for compute node.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
echo "Installing nova for compute node."
|
||||
sudo apt-get install -y nova-compute-kvm python-guestfs
|
||||
|
||||
# To make the current kernel readable, run:
|
||||
sudo dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-$(uname -r)
|
||||
|
||||
# Remove SQLite database created by Ubuntu package for nova.
|
||||
sudo rm -v /var/lib/nova/nova.sqlite
|
||||
|
||||
function get_database_url {
|
||||
local db_user=$(service_to_db_user nova)
|
||||
local db_password=$(service_to_db_password nova)
|
||||
local database_host=controller-mgmt
|
||||
|
||||
echo "mysql://$db_user:$db_password@$database_host/nova"
|
||||
}
|
||||
|
||||
database_url=$(get_database_url)
|
||||
|
||||
echo "Configuring nova for compute node."
|
||||
|
||||
echo "Setting database connection: $database_url."
|
||||
iniset_sudo /etc/nova/nova.conf database connection "$database_url"
|
||||
|
||||
nova_admin_user=$(service_to_user_name nova)
|
||||
nova_admin_password=$(service_to_user_password nova)
|
||||
|
||||
conf=/etc/nova/nova.conf
|
||||
echo "Configuring $conf."
|
||||
# Configuring [DEFAULT] section
|
||||
|
||||
# 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"
|
||||
|
||||
# Configure other variables
|
||||
iniset_sudo $conf DEFAULT my_ip controller-mgmt
|
||||
iniset_sudo $conf DEFAULT vncserver_listen controller-mgmt
|
||||
iniset_sudo $conf DEFAULT vncserver_proxyclient_address compute-mgmt
|
||||
iniset_sudo $conf DEFAULT vnc_enabled True
|
||||
iniset_sudo $conf DEFAULT vncserver_proxyclient_address compute-mgmt
|
||||
iniset_sudo $conf DEFAULT glance_host controller-mgmt
|
||||
iniset_sudo $conf DEFAULT auth_strategy keystone
|
||||
|
||||
# Configure [keystone_authtoken] section
|
||||
iniset_sudo $conf keystone_authtoken auth_uri http://controller-mgmt:5000
|
||||
iniset_sudo $conf keystone_authtoken auth_host controller-mgmt
|
||||
iniset_sudo $conf keystone_authtoken auth_port 35357
|
||||
iniset_sudo $conf keystone_authtoken auth_protocol http
|
||||
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"
|
||||
|
||||
# Configure nova-comptue.conf
|
||||
conf=/etc/nova/nova-compute.conf
|
||||
iniset_sudo $conf DEFAULT virt_type qemu
|
||||
|
||||
echo "Restarting nova services."
|
||||
sudo service nova-compute restart
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Verify the Nova installation on Compute Node
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
echo "Verifying nova output."
|
||||
|
||||
echo "Verify nova service status."
|
||||
# This call needs root privileges for read access to /etc/nova/nova.conf.
|
||||
echo "sudo nova-manage service list"
|
||||
sudo nova-manage service list
|
Loading…
x
Reference in New Issue
Block a user