diff --git a/stack.sh b/stack.sh index 17972c9d07..18d1695c5d 100755 --- a/stack.sh +++ b/stack.sh @@ -184,6 +184,8 @@ SWIFT_DIR=$DEST/swift SWIFT_KEYSTONE_DIR=$DEST/swift-keystone2 QUANTUM_DIR=$DEST/quantum QUANTUM_CLIENT_DIR=$DEST/python-quantumclient +MELANGE_DIR=$DEST/melange +MELANGECLIENT_DIR=$DEST/python-melangeclient # Default Quantum Plugin Q_PLUGIN=${Q_PLUGIN:-openvswitch} @@ -192,6 +194,13 @@ Q_PORT=${Q_PORT:-9696} # Default Quantum Host Q_HOST=${Q_HOST:-localhost} +# Default Melange Port +M_PORT=${M_PORT:-9898} +# Default Melange Host +M_HOST=${M_HOST:-localhost} +# Melange MAC Address Range +M_MAC_RANGE=${M_MAC_RANGE:-404040/24} + # Specify which services to launch. These generally correspond to screen tabs ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit} @@ -330,6 +339,13 @@ FLAT_INTERFACE=${FLAT_INTERFACE:-eth0} # # With Quantum networking the NET_MAN variable is ignored. +# Using Melange IPAM: +# +# Make sure that quantum and melange are enabled in ENABLED_SERVICES. +# If they are then the melange IPAM lib will be set in the QuantumManager. +# Adding m-svc to ENABLED_SERVICES will start the melange service on this +# host. + # MySQL & RabbitMQ # ---------------- @@ -622,6 +638,15 @@ if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then git_clone $QUANTUM_CLIENT_REPO $QUANTUM_CLIENT_DIR $QUANTUM_CLIENT_BRANCH fi +if [[ "$ENABLED_SERVICES" =~ "m-svc" ]]; then + # melange + git_clone $MELANGE_REPO $MELANGE_DIR $MELANGE_BRANCH +fi + +if [[ "$ENABLED_SERVICES" =~ "melange" ]]; then + git_clone $MELANGECLIENT_REPO $MELANGECLIENT_DIR $MELANGECLIENT_BRANCH +fi + # Initialization # ============== @@ -652,6 +677,12 @@ fi if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then cd $QUANTUM_DIR; sudo python setup.py develop fi +if [[ "$ENABLED_SERVICES" =~ "m-svc" ]]; then + cd $MELANGE_DIR; sudo python setup.py develop +fi +if [[ "$ENABLED_SERVICES" =~ "melange" ]]; then + cd $MELANGECLIENT_DIR; sudo python setup.py develop +fi # Syslog # --------- @@ -1153,6 +1184,13 @@ if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager" add_nova_flag "--quantum_connection_host=$Q_HOST" add_nova_flag "--quantum_connection_port=$Q_PORT" + + if [[ "$ENABLED_SERVICES" =~ "melange" ]]; then + add_nova_flag "--quantum_ipam_lib=nova.network.quantum.melange_ipam_lib" + add_nova_flag "--use_melange_mac_generation" + add_nova_flag "--melange_host=$M_HOST" + add_nova_flag "--melange_port=$M_PORT" + fi if [[ "$ENABLED_SERVICES" =~ "q-svc" && "$Q_PLUGIN" = "openvswitch" ]]; then add_nova_flag "--libvirt_vif_type=ethernet" add_nova_flag "--libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver" @@ -1408,6 +1446,28 @@ if [[ "$ENABLED_SERVICES" =~ "q-agt" ]]; then fi +# Melange service +if [[ "$ENABLED_SERVICES" =~ "m-svc" ]]; then + if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then + mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS melange;' + mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE melange;' + else + echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin." + exit 1 + fi + MELANGE_CONFIG_FILE=$MELANGE_DIR/etc/melange/melange.conf + cp $MELANGE_CONFIG_FILE.sample $MELANGE_CONFIG_FILE + sed -i -e "s/^sql_connection =.*$/sql_connection = mysql:\/\/$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST\/melange/g" $MELANGE_CONFIG_FILE + cd $MELANGE_DIR && PYTHONPATH=.:$PYTHONPATH python $MELANGE_DIR/bin/melange-manage --config-file=$MELANGE_CONFIG_FILE db_sync + screen_it m-svc "cd $MELANGE_DIR && PYTHONPATH=.:$PYTHONPATH python $MELANGE_DIR/bin/melange-server --config-file=$MELANGE_CONFIG_FILE" + echo "Waiting for melange to start..." + if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:9898; do sleep 1; done"; then + echo "melange-server did not start" + exit 1 + fi + melange mac_address_range create cidr=$M_MAC_RANGE +fi + # If we're using Quantum (i.e. q-svc is enabled), network creation has to # happen after we've started the Quantum service. if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then @@ -1425,6 +1485,7 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then fi fi + # Launching nova-compute should be as simple as running ``nova-compute`` but # have to do a little more than that in our script. Since we add the group # ``libvirtd`` to our user in this script, when nova-compute is run it is diff --git a/stackrc b/stackrc index acc5ac0617..e87b3cde8f 100644 --- a/stackrc +++ b/stackrc @@ -46,6 +46,14 @@ QUANTUM_CLIENT_BRANCH=master TEMPEST_REPO=https://github.com/openstack/tempest.git TEMPEST_BRANCH=master +# melange service +MELANGE_REPO=https://github.com/openstack/melange.git +MELANGE_BRANCH=master + +# python melange client library +MELANGECLIENT_REPO=https://github.com/openstack/python-melangeclient.git +MELANGECLIENT_BRANCH=master + # Specify a comma-separated list of uec images to download and install into glance. # supported urls here are: # * "uec-style" images: @@ -56,7 +64,7 @@ TEMPEST_BRANCH=master # * disk image (*.img,*.img.gz) # if file ends in .img, then it will be uploaded and registered as a to # glance as a disk image. If it ends in .gz, it is uncompressed first. -# example: +# example: # http://cloud-images.ubuntu.com/releases/oneiric/release/ubuntu-11.10-server-cloudimg-armel-disk1.img # http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz #IMAGE_URLS="http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz" # old ttylinux-uec image