Basic cells support
Adds support for running a region and child cell within a single devstack environment. README.md has been updated with some info on getting started. Rebased/updated from initial work by Andrew Laski <andrew.laski@rackspace.com>. Change-Id: Ic181da2180ccaa51df7efc9d66f7ccb820aac19b
This commit is contained in:
parent
a20fb6d383
commit
fb2a3ae3ca
20
README.md
20
README.md
@ -153,3 +153,23 @@ You can then run many compute nodes, each of which should have a `stackrc` which
|
||||
MYSQL_HOST=$SERVICE_HOST
|
||||
RABBIT_HOST=$SERVICE_HOST
|
||||
Q_HOST=$SERVICE_HOST
|
||||
|
||||
# Cells
|
||||
|
||||
Cells is a new scaling option with a full spec at http://wiki.openstack.org/blueprint-nova-compute-cells.
|
||||
|
||||
To setup a cells environment add the following to your `localrc`:
|
||||
|
||||
enable_service n-cell
|
||||
enable_service n-api-meta
|
||||
MULTI_HOST=True
|
||||
|
||||
# The following have not been tested with cells, they may or may not work.
|
||||
disable_service n-obj
|
||||
disable_service cinder
|
||||
disable_service c-sch
|
||||
disable_service c-api
|
||||
disable_service c-vol
|
||||
disable_service n-xvnc
|
||||
|
||||
Be aware that there are some features currently missing in cells, one notable one being security groups.
|
||||
|
64
lib/nova
64
lib/nova
@ -37,6 +37,9 @@ NOVA_AUTH_CACHE_DIR=${NOVA_AUTH_CACHE_DIR:-/var/cache/nova}
|
||||
|
||||
NOVA_CONF_DIR=/etc/nova
|
||||
NOVA_CONF=$NOVA_CONF_DIR/nova.conf
|
||||
NOVA_CELLS_CONF=$NOVA_CONF_DIR/nova-cells.conf
|
||||
NOVA_CELLS_DB=${NOVA_CELLS_DB:-nova_cell}
|
||||
|
||||
NOVA_API_PASTE_INI=${NOVA_API_PASTE_INI:-$NOVA_CONF_DIR/api-paste.ini}
|
||||
|
||||
# Public facing bits
|
||||
@ -125,10 +128,6 @@ TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29}
|
||||
# Functions
|
||||
# ---------
|
||||
|
||||
function add_nova_opt {
|
||||
echo "$1" >>$NOVA_CONF
|
||||
}
|
||||
|
||||
# Helper to clean iptables rules
|
||||
function clean_iptables() {
|
||||
# Delete rules
|
||||
@ -415,7 +414,6 @@ function create_nova_conf() {
|
||||
|
||||
# (Re)create ``nova.conf``
|
||||
rm -f $NOVA_CONF
|
||||
add_nova_opt "[DEFAULT]"
|
||||
iniset $NOVA_CONF DEFAULT verbose "True"
|
||||
iniset $NOVA_CONF DEFAULT debug "True"
|
||||
iniset $NOVA_CONF DEFAULT auth_strategy "keystone"
|
||||
@ -539,6 +537,32 @@ function create_nova_conf() {
|
||||
iniset $NOVA_CONF DEFAULT glance_api_servers "$GLANCE_HOSTPORT"
|
||||
}
|
||||
|
||||
function init_nova_cells() {
|
||||
if is_service_enabled n-cell; then
|
||||
cp $NOVA_CONF $NOVA_CELLS_CONF
|
||||
iniset $NOVA_CELLS_CONF DEFAULT sql_connection `database_connection_url $NOVA_CELLS_DB`
|
||||
iniset $NOVA_CELLS_CONF DEFAULT rabbit_virtual_host child_cell
|
||||
iniset $NOVA_CELLS_CONF DEFAULT dhcpbridge_flagfile $NOVA_CELLS_CONF
|
||||
iniset $NOVA_CELLS_CONF cells enable True
|
||||
iniset $NOVA_CELLS_CONF cells name child
|
||||
|
||||
iniset $NOVA_CONF DEFAULT scheduler_topic cells
|
||||
iniset $NOVA_CONF DEFAULT compute_api_class nova.compute.cells_api.ComputeCellsAPI
|
||||
iniset $NOVA_CONF cells enable True
|
||||
iniset $NOVA_CONF cells name region
|
||||
|
||||
if is_service_enabled n-api-meta; then
|
||||
NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/,metadata//")
|
||||
iniset $NOVA_CONF DEFAULT enabled_apis $NOVA_ENABLED_APIS
|
||||
iniset $NOVA_CELLS_CONF DEFAULT enabled_apis metadata
|
||||
fi
|
||||
|
||||
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync
|
||||
$NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF cell create --name=region --cell_type=parent --username=guest --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=/ --woffset=0 --wscale=1
|
||||
$NOVA_BIN_DIR/nova-manage cell create --name=child --cell_type=child --username=guest --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=child_cell --woffset=0 --wscale=1
|
||||
fi
|
||||
}
|
||||
|
||||
# create_nova_cache_dir() - Part of the init_nova() process
|
||||
function create_nova_cache_dir() {
|
||||
# Create cache dir
|
||||
@ -578,6 +602,10 @@ function init_nova() {
|
||||
# Migrate nova database
|
||||
$NOVA_BIN_DIR/nova-manage db sync
|
||||
|
||||
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
|
||||
@ -648,14 +676,26 @@ function start_nova_api() {
|
||||
|
||||
# start_nova() - Start running processes, including screen
|
||||
function start_nova() {
|
||||
# The group **$LIBVIRT_GROUP** is added to the current user in this script.
|
||||
# Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
|
||||
NOVA_CONF_BOTTOM=$NOVA_CONF
|
||||
|
||||
# ``screen_it`` checks ``is_service_enabled``, it is not needed here
|
||||
screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor"
|
||||
screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP $NOVA_BIN_DIR/nova-compute"
|
||||
|
||||
if is_service_enabled n-cell; then
|
||||
NOVA_CONF_BOTTOM=$NOVA_CELLS_CONF
|
||||
screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF"
|
||||
screen_it n-cell "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CONF"
|
||||
screen_it n-cell "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CELLS_CONF"
|
||||
fi
|
||||
|
||||
# The group **$LIBVIRT_GROUP** is added to the current user in this script.
|
||||
# Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
|
||||
screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP \"$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM\""
|
||||
screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
|
||||
screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network"
|
||||
screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler"
|
||||
screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network --config-file $NOVA_CONF_BOTTOM"
|
||||
screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler --config-file $NOVA_CONF_BOTTOM"
|
||||
screen_it n-api-meta "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-api-metadata --config-file $NOVA_CONF_BOTTOM"
|
||||
|
||||
screen_it n-novnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-novncproxy --config-file $NOVA_CONF --web $NOVNC_DIR"
|
||||
screen_it n-xvnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-xvpvncproxy --config-file $NOVA_CONF"
|
||||
screen_it n-spice "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $NOVA_CONF --web $SPICE_DIR"
|
||||
@ -670,7 +710,9 @@ function start_nova() {
|
||||
# stop_nova() - Stop running processes (non-screen)
|
||||
function stop_nova() {
|
||||
# Kill the nova screen windows
|
||||
for serv in n-api n-cpu n-crt n-net n-sch n-novnc n-xvnc n-cauth n-cond n-spice; do
|
||||
# Some services are listed here twice since more than one instance
|
||||
# of a service may be running in certain configs.
|
||||
for serv in n-api n-cpu n-crt n-net n-sch n-novnc n-xvnc n-cauth n-spice n-cond n-cond n-cell n-cell n-api-meta; do
|
||||
screen -S $SCREEN_NAME -p $serv -X kill
|
||||
done
|
||||
}
|
||||
|
@ -138,6 +138,13 @@ function restart_rpc_backend() {
|
||||
fi
|
||||
# change the rabbit password since the default is "guest"
|
||||
sudo rabbitmqctl change_password guest $RABBIT_PASSWORD
|
||||
if is_service_enabled n-cell; then
|
||||
# Add partitioned access for the child cell
|
||||
if [ -z `sudo rabbitmqctl list_vhosts | grep child_cell` ]; then
|
||||
sudo rabbitmqctl add_vhost child_cell
|
||||
sudo rabbitmqctl set_permissions -p child_cell guest ".*" ".*" ".*"
|
||||
fi
|
||||
fi
|
||||
elif is_service_enabled qpid; then
|
||||
echo_summary "Starting qpid"
|
||||
restart_service qpidd
|
||||
|
13
stack.sh
13
stack.sh
@ -1034,6 +1034,8 @@ if is_service_enabled nova; then
|
||||
LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
|
||||
iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER"
|
||||
fi
|
||||
|
||||
init_nova_cells
|
||||
fi
|
||||
|
||||
# Extra things to prepare nova for baremetal, before nova starts
|
||||
@ -1094,14 +1096,19 @@ if is_service_enabled q-svc; then
|
||||
create_quantum_initial_network
|
||||
setup_quantum_debug
|
||||
elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then
|
||||
NM_CONF=${NOVA_CONF}
|
||||
if is_service_enabled n-cell; then
|
||||
NM_CONF=${NOVA_CELLS_CONF}
|
||||
fi
|
||||
|
||||
# Create a small network
|
||||
$NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
|
||||
$NOVA_BIN_DIR/nova-manage --config-file $NM_CONF network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
|
||||
|
||||
# Create some floating ips
|
||||
$NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK_NAME
|
||||
$NOVA_BIN_DIR/nova-manage --config-file $NM_CONF floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK_NAME
|
||||
|
||||
# Create a second pool
|
||||
$NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
|
||||
$NOVA_BIN_DIR/nova-manage --config-file $NM_CONF floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
|
||||
fi
|
||||
|
||||
if is_service_enabled quantum; then
|
||||
|
Loading…
Reference in New Issue
Block a user