Browse code

Merge remote-tracking branch 'origin/master' into new-swift-support

Conflicts:
stack.sh

Chmouel Boudjnah authored on 2011/11/03 17:08:14
Showing 2 changed files
... ...
@@ -152,6 +152,10 @@ OPENSTACKX_DIR=$DEST/openstackx
152 152
 NOVNC_DIR=$DEST/noVNC
153 153
 SWIFT_DIR=$DEST/swift
154 154
 SWIFT_KEYSTONE_DIR=$DEST/swift-keystone2
155
+QUANTUM_DIR=$DEST/quantum
156
+
157
+# Default Quantum Plugin
158
+Q_PLUGIN=${Q_PLUGIN:-openvswitch}
155 159
 
156 160
 # Specify which services to launch.  These generally correspond to screen tabs
157 161
 ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit}
... ...
@@ -246,6 +250,17 @@ FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
246 246
 
247 247
 ## FIXME(ja): should/can we check that FLAT_INTERFACE is sane?
248 248
 
249
+# Using Quantum networking:
250
+#
251
+# Make sure that q-svc is enabled in ENABLED_SERVICES.  If it is the network
252
+# manager will be set to the QuantumManager.
253
+#
254
+# If you're planning to use the Quantum openvswitch plugin, set Q_PLUGIN to
255
+# "openvswitch" and make sure the q-agt service is enabled in
256
+# ENABLED_SERVICES.
257
+#
258
+# With Quantum networking the NET_MAN variable is ignored.
259
+
249 260
 
250 261
 # MySQL & RabbitMQ
251 262
 # ----------------
... ...
@@ -396,6 +411,8 @@ git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
396 396
 # openstackx is a collection of extensions to openstack.compute & nova
397 397
 # that is *deprecated*.  The code is being moved into python-novaclient & nova.
398 398
 git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH
399
+# quantum
400
+git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
399 401
 
400 402
 # Initialization
401 403
 # ==============
... ...
@@ -412,6 +429,7 @@ cd $NOVA_DIR; sudo python setup.py develop
412 412
 cd $OPENSTACKX_DIR; sudo python setup.py develop
413 413
 cd $HORIZON_DIR/django-openstack; sudo python setup.py develop
414 414
 cd $HORIZON_DIR/openstack-dashboard; sudo python setup.py develop
415
+cd $QUANTUM_DIR; sudo python setup.py develop
415 416
 
416 417
 # Add a useful screenrc.  This isn't required to run openstack but is we do
417 418
 # it since we are going to run the services in screen for simple
... ...
@@ -768,8 +786,16 @@ add_nova_flag "--nodaemon"
768 768
 add_nova_flag "--allow_admin_api"
769 769
 add_nova_flag "--scheduler_driver=$SCHEDULER"
770 770
 add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
771
-add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
772 771
 add_nova_flag "--fixed_range=$FIXED_RANGE"
772
+if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
773
+    add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager"
774
+    if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
775
+        add_nova_flag "--libvirt_vif_type=ethernet"
776
+        add_nova_flag "--libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"
777
+    fi
778
+else
779
+    add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
780
+fi
773 781
 add_nova_flag "--my_ip=$HOST_IP"
774 782
 add_nova_flag "--public_interface=$PUBLIC_INTERFACE"
775 783
 add_nova_flag "--vlan_interface=$VLAN_INTERFACE"
... ...
@@ -828,12 +854,6 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
828 828
 
829 829
     # (re)create nova database
830 830
     $NOVA_DIR/bin/nova-manage db sync
831
-
832
-    # create a small network
833
-    $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE
834
-
835
-    # create some floating ips
836
-    $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
837 831
 fi
838 832
 
839 833
 
... ...
@@ -916,6 +936,57 @@ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
916 916
       exit 1
917 917
     fi
918 918
 fi
919
+
920
+# Quantum
921
+if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
922
+    # Install deps
923
+    # FIXME add to files/apts/quantum, but don't install if not needed!
924
+    apt_get install openvswitch-switch openvswitch-datapath-dkms
925
+
926
+    # Create database for the plugin/agent
927
+    if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
928
+        if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
929
+            mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS ovs_quantum;'
930
+        else
931
+            echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
932
+            exit 1
933
+        fi
934
+    fi
935
+
936
+    QUANTUM_PLUGIN_INI_FILE=$QUANTUM_DIR/quantum/plugins.ini
937
+    # Make sure we're using the openvswitch plugin
938
+    sed -i -e "s/^provider =.*$/provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin/g" $QUANTUM_PLUGIN_INI_FILE
939
+    screen_it q-svc "cd $QUANTUM_DIR && export PYTHONPATH=.:$PYTHONPATH; python $QUANTUM_DIR/bin/quantum $QUANTUM_DIR/etc/quantum.conf"
940
+fi
941
+
942
+# Quantum agent (for compute nodes)
943
+if [[ "$ENABLED_SERVICES" =~ "q-agt" ]]; then
944
+    if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
945
+        # Set up integration bridge
946
+        OVS_BRIDGE=${OVS_BRIDGE:-br-int}
947
+        sudo ovs-vsctl --no-wait -- --if-exists del-br $OVS_BRIDGE
948
+        sudo ovs-vsctl --no-wait add-br $OVS_BRIDGE
949
+        sudo ovs-vsctl --no-wait br-set-external-id $OVS_BRIDGE bridge-id br-int
950
+    fi
951
+
952
+    # Start up the quantum <-> openvswitch agent
953
+    screen_it q-agt "sleep 4; sudo python $QUANTUM_DIR/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py $QUANTUM_DIR/quantum/plugins/openvswitch/ovs_quantum_plugin.ini -v"
954
+fi
955
+
956
+# If we're using Quantum (i.e. q-svc is enabled), network creation has to
957
+# happen after we've started the Quantum service.
958
+if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
959
+    # create a small network
960
+    $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE
961
+
962
+    if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
963
+        echo "Not creating floating IPs (not supported by QuantumManager)"
964
+    else
965
+        # create some floating ips
966
+        $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
967
+    fi
968
+fi
969
+
919 970
 # Launching nova-compute should be as simple as running ``nova-compute`` but
920 971
 # have to do a little more than that in our script.  Since we add the group
921 972
 # ``libvirtd`` to our user in this script, when nova-compute is run it is
... ...
@@ -35,6 +35,10 @@ NOVACLIENT_BRANCH=master
35 35
 OPENSTACKX_REPO=https://github.com/cloudbuilders/openstackx.git
36 36
 OPENSTACKX_BRANCH=diablo
37 37
 
38
+# quantum service
39
+QUANTUM_REPO=https://github.com/openstack/quantum
40
+QUANTUM_BRANCH=stable/diablo
41
+
38 42
 # Specify a comma-separated list of uec images to download and install into glance.
39 43
 IMAGE_URLS=http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz
40 44