From ec21d9371acfbbb51c7bc7e1b09c55cc11610b1a Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Fri, 16 Sep 2011 16:05:55 -0700 Subject: [PATCH 1/9] Configure keystone catalog for multihost use --- files/keystone_data.sh | 10 +++++----- stack.sh | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/files/keystone_data.sh b/files/keystone_data.sh index dfcafb2..b028557 100755 --- a/files/keystone_data.sh +++ b/files/keystone_data.sh @@ -14,11 +14,11 @@ $BIN_DIR/keystone-manage $* role add Member $BIN_DIR/keystone-manage $* role grant Admin admin #endpointTemplates -# $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://localhost:8080/v1/AUTH_%tenant_id% http://localhost:8080/ http://localhost:8080/v1/AUTH_%tenant_id% 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova_compat http://localhost:8774/v1.0/ http://localhost:8774/v1.0 http://localhost:8774/v1.0 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://localhost:8774/v1.1/%tenant_id% http://localhost:8774/v1.1/%tenant_id% http://localhost:8774/v1.1/%tenant_id% 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://localhost:9292/v1.1/%tenant_id% http://localhost:9292/v1.1/%tenant_id% http://localhost:9292/v1.1/%tenant_id% 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne identity http://localhost:5000/v2.0 http://localhost:5001/v2.0 http://localhost:5000/v2.0 1 1 +# $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%HOST_IP%:8080/v1/AUTH_%tenant_id% http://%HOST_IP%:8080/ http://%HOST_IP%:8080/v1/AUTH_%tenant_id% 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova_compat http://%HOST_IP%:8774/v1.0/ http://%HOST_IP%:8774/v1.0 http://%HOST_IP%:8774/v1.0 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id% 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne identity http://%HOST_IP%:5000/v2.0 http://%HOST_IP%:5001/v2.0 http://%HOST_IP%:5000/v2.0 1 1 # Tokens $BIN_DIR/keystone-manage $* token add 999888777666 admin admin 2015-02-05T00:00 diff --git a/stack.sh b/stack.sh index a093b24..6dbc885 100755 --- a/stack.sh +++ b/stack.sh @@ -379,8 +379,11 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then cp $FILES/keystone.conf $KEYSTONE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF + KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh + cp $FILES/keystone_data.sh $KEYSTONE_DATA + sudo sed -e "s,%HOST_IP%,$HOST_IP,g" -i $KEYSTONE_DATA # initialize keystone with default users/endpoints - BIN_DIR=$KEYSTONE_DIR/bin bash $FILES/keystone_data.sh + BIN_DIR=$KEYSTONE_DIR/bin bash $KEYSTONE_DATA fi From 32dbf11a4650dec802598435e949fe2fee57017a Mon Sep 17 00:00:00 2001 From: Jake Dahn Date: Fri, 16 Sep 2011 16:06:46 -0700 Subject: [PATCH 2/9] updating readme a bit --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index c30f61c..4585601 100644 --- a/README +++ b/README @@ -1,15 +1,13 @@ -Tool to build (nfs export) openstack dev environments +Tool to quickly deploy and dev environments # Todo * Add python-novaclient cli support * move keystone/glance/dash to mysql * syslog -* munin * check openstack-puppet recipes to see if anything else is missing * allow rabbit connection to be specified via environment variables with sensible defaults * Add volume support -* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?) * allow changing of git locations (specify different tag/branch or repos) * change method of invoking stack.sh to ./stack.sh all _or_ ./stack.sh nova-compute,nova-network,nova-api,nova-volume * Add quantum support @@ -19,6 +17,8 @@ Tool to build (nfs export) openstack dev environments * sqlconn can be set via env * move back to using sudo * move nova to mysql +* munin +* extract image upload to a seperate script that supports generating images via debootstrap (ubuntu-vm-builder?) # Future From 8bf18c6ccd95498d6b1567159ac3aff49b9c51a4 Mon Sep 17 00:00:00 2001 From: Jake Dahn Date: Fri, 16 Sep 2011 16:09:46 -0700 Subject: [PATCH 3/9] fixing typo --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 4585601..1e86af1 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Tool to quickly deploy and dev environments +Tool to quickly deploy and openstack dev environments # Todo From b8b5ddd31ae953b8a3f78cf3b85e40dcf19aaf2b Mon Sep 17 00:00:00 2001 From: Jake Dahn Date: Fri, 16 Sep 2011 16:12:08 -0700 Subject: [PATCH 4/9] fixing another typo, i suck at english on fridays --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 1e86af1..cc20d5c 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Tool to quickly deploy and openstack dev environments +Tool to quickly deploy openstack dev environments # Todo From d1879c5cfbadfe3cd07242b8be6f510c5faa841e Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 16 Sep 2011 16:28:13 -0700 Subject: [PATCH 5/9] default to kvm, but revert to qemu --- stack.sh | 84 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/stack.sh b/stack.sh index a0ff193..f2c13a1 100755 --- a/stack.sh +++ b/stack.sh @@ -87,8 +87,9 @@ EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP} # ip or you risk breaking things. # FLAT_INTERFACE=eth0 -# Nova hypervisor configuration -LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu} +# Nova hypervisor configuration. We default to **kvm** but will drop back to +# **qemu** if we are unable to load the kvm module. +LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm} # Mysql connection info MYSQL_USER=${MYSQL_USER:-root} @@ -156,6 +157,11 @@ git_clone https://github.com/cloudbuilders/openstack-munin.git $MUNIN_DIR # Initialization # ============== + +# create a new named screen to store things in +screen -d -m -S nova -t nova +sleep 1 + # setup our checkouts so they are installed into python path # allowing ``import nova`` or ``import glance.client`` cd $NOVA_DIR; sudo python setup.py develop @@ -282,53 +288,21 @@ fi # Nova # ---- -function add_nova_flag { - echo "$1" >> $NOVA_DIR/bin/nova.conf -} - -# (re)create nova.conf -rm -f $NOVA_DIR/bin/nova.conf -add_nova_flag "--verbose" -add_nova_flag "--nodaemon" -add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf" -add_nova_flag "--network_manager=nova.network.manager.$NET_MAN" -add_nova_flag "--my_ip=$HOST_IP" -add_nova_flag "--public_interface=$INTERFACE" -add_nova_flag "--vlan_interface=$INTERFACE" -add_nova_flag "--sql_connection=$BASE_SQL_CONN/nova" -add_nova_flag "--libvirt_type=$LIBVIRT_TYPE" -add_nova_flag "--osapi_extensions_path=$API_DIR/extensions" -add_nova_flag "--vncproxy_url=http://$HOST_IP:6080" -add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/" -add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini" -add_nova_flag "--image_service=nova.image.glance.GlanceImageService" -add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST" -add_nova_flag "--rabbit_host=$RABBIT_HOST" -add_nova_flag "--glance_api_servers=$GLANCE_HOSTPORT" -if [ -n "$FLAT_INTERFACE" ]; then - add_nova_flag "--flat_interface=$FLAT_INTERFACE" -fi -if [ -n "$MULTI_HOST" ]; then - add_nova_flag "--multi_host=$MULTI_HOST" -fi - -# create a new named screen to store things in -screen -d -m -S nova -t nova -sleep 1 if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then - # attempt to load modules: kvm (hardware virt) and nbd (network block - # device - used to manage qcow images) + # attempt to load modules: nbd (network block device - used to manage + # qcow images) and kvm (hardware based virtualization). If unable to + # load kvm, set the libvirt type to qemu. sudo modprobe nbd || true - sudo modprobe kvm || true + if ! sudo modprobe kvm; then + LIBVIRT_TYPE=qemu + fi # User needs to be member of libvirtd group for nova-compute to use libvirt. sudo usermod -a -G libvirtd `whoami` # if kvm wasn't running before we need to restart libvirt to enable it sudo /etc/init.d/libvirt-bin restart - ## FIXME(ja): should LIBVIRT_TYPE be kvm if kvm module is loaded? - # setup nova instance directory mkdir -p $NOVA_DIR/instances @@ -364,6 +338,36 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE fi +function add_nova_flag { + echo "$1" >> $NOVA_DIR/bin/nova.conf +} + +# (re)create nova.conf +rm -f $NOVA_DIR/bin/nova.conf +add_nova_flag "--verbose" +add_nova_flag "--nodaemon" +add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf" +add_nova_flag "--network_manager=nova.network.manager.$NET_MAN" +add_nova_flag "--my_ip=$HOST_IP" +add_nova_flag "--public_interface=$INTERFACE" +add_nova_flag "--vlan_interface=$INTERFACE" +add_nova_flag "--sql_connection=$BASE_SQL_CONN/nova" +add_nova_flag "--libvirt_type=$LIBVIRT_TYPE" +add_nova_flag "--osapi_extensions_path=$API_DIR/extensions" +add_nova_flag "--vncproxy_url=http://$HOST_IP:6080" +add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/" +add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini" +add_nova_flag "--image_service=nova.image.glance.GlanceImageService" +add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST" +add_nova_flag "--rabbit_host=$RABBIT_HOST" +add_nova_flag "--glance_api_servers=$GLANCE_HOSTPORT" +if [ -n "$FLAT_INTERFACE" ]; then + add_nova_flag "--flat_interface=$FLAT_INTERFACE" +fi +if [ -n "$MULTI_HOST" ]; then + add_nova_flag "--multi_host=$MULTI_HOST" +fi + # Keystone # -------- From a16e5e9c4db083d071a2bcee831a577e4a53fb14 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 16 Sep 2011 16:30:55 -0700 Subject: [PATCH 6/9] move screen creation closer to where used --- stack.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stack.sh b/stack.sh index f2c13a1..d5d6d1c 100755 --- a/stack.sh +++ b/stack.sh @@ -158,10 +158,6 @@ git_clone https://github.com/cloudbuilders/openstack-munin.git $MUNIN_DIR # ============== -# create a new named screen to store things in -screen -d -m -S nova -t nova -sleep 1 - # setup our checkouts so they are installed into python path # allowing ``import nova`` or ``import glance.client`` cd $NOVA_DIR; sudo python setup.py develop @@ -405,6 +401,10 @@ function screen_it { fi } +# create a new named screen to run processes in +screen -d -m -S nova -t nova +sleep 1 + screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf" screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf" screen_it key "$KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF" From 356812547dfbc133ecc37bef7dbb0c923acd8425 Mon Sep 17 00:00:00 2001 From: Jake Dahn Date: Fri, 16 Sep 2011 16:53:22 -0700 Subject: [PATCH 7/9] Fixing munin --- stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index e9218b8..f34e491 100755 --- a/stack.sh +++ b/stack.sh @@ -237,7 +237,7 @@ fi if [[ "$ENABLED_SERVICES" =~ "munin" ]]; then # allow connections from other hosts - sudo sed -i -e '/Allow from localhost/s/localhost.*$/all/' /etc/munin/apache.conf + sudo sed -i -e 's/Allow from localhost/Allow from all/g' /etc/munin/apache.conf cat >/tmp/nova < Date: Fri, 16 Sep 2011 21:37:36 -0700 Subject: [PATCH 8/9] move nova-manage commands below the conf generation --- stack.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/stack.sh b/stack.sh index ca1f7fa..0ddf4db 100755 --- a/stack.sh +++ b/stack.sh @@ -321,19 +321,6 @@ if [[ "$ENABLED_SERVICES" =~ "n-net" ]]; then mkdir -p $NOVA_DIR/networks fi -if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then - # (re)create nova database - mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'DROP DATABASE nova;' || true - mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'CREATE DATABASE nova;' - $NOVA_DIR/bin/nova-manage db sync - - # create a small network - $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 32 - - # create some floating ips - $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE -fi - function add_nova_flag { echo "$1" >> $NOVA_DIR/bin/nova.conf } @@ -364,6 +351,20 @@ if [ -n "$MULTI_HOST" ]; then add_nova_flag "--multi_host=$MULTI_HOST" fi +if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then + # (re)create nova database + mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'DROP DATABASE nova;' || true + mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'CREATE DATABASE nova;' + $NOVA_DIR/bin/nova-manage db sync + + # create a small network + $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 32 + + # create some floating ips + $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE +fi + + # Keystone # -------- From 5e2fc41cec041e880cf9b811648a7348802cfe88 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Sun, 18 Sep 2011 21:16:42 -0700 Subject: [PATCH 9/9] tweak intro --- stack.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index 0ddf4db..418f37b 100755 --- a/stack.sh +++ b/stack.sh @@ -1,12 +1,14 @@ #!/usr/bin/env bash -# **stack.sh** is rackspace cloudbuilder's opinionated openstack dev installation. +# **stack.sh** is an opinionated openstack dev installation. # To keep this script simple we assume you are running on an **Ubuntu 11.04 # Natty** machine. It should work in a VM or physical server. Additionally we # put the list of *apt* and *pip* dependencies and other configuration files in # this repo. So start by grabbing this script and the dependencies. +# You can grab the most recent version of this script and files from Rackspace +# Cloud Builders at https://github.com/cloudbuilders/devstack # Sanity Check # ============