Browse code

Add Quantum support

Brad Hall authored on 2011/10/28 10:18:20
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+openvswitch-switch
1
+openvswitch-datapath-dkms
... ...
@@ -150,6 +150,10 @@ KEYSTONE_DIR=$DEST/keystone
150 150
 NOVACLIENT_DIR=$DEST/python-novaclient
151 151
 OPENSTACKX_DIR=$DEST/openstackx
152 152
 NOVNC_DIR=$DEST/noVNC
153
+QUANTUM_DIR=$DEST/quantum
154
+
155
+# Default Quantum Plugin
156
+Q_PLUGIN=${Q_PLUGIN:-openvswitch}
153 157
 
154 158
 # Specify which services to launch.  These generally correspond to screen tabs
155 159
 ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit}
... ...
@@ -244,6 +248,17 @@ FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
244 244
 
245 245
 ## FIXME(ja): should/can we check that FLAT_INTERFACE is sane?
246 246
 
247
+# Using Quantum networking:
248
+#
249
+# Make sure that q-svc is enabled in ENABLED_SERVICES.  If it is the network
250
+# manager will be set to the QuantumManager.
251
+#
252
+# If you're planning to use the Quantum openvswitch plugin, set Q_PLUGIN to
253
+# "openvswitch" and make sure the q-agt service is enabled in
254
+# ENABLED_SERVICES.
255
+#
256
+# With Quantum networking the NET_MAN variable is ignored.
257
+
247 258
 
248 259
 # MySQL & RabbitMQ
249 260
 # ----------------
... ...
@@ -362,6 +377,8 @@ git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH
362 362
 # openstackx is a collection of extensions to openstack.compute & nova
363 363
 # that is *deprecated*.  The code is being moved into python-novaclient & nova.
364 364
 git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH
365
+# quantum
366
+git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
365 367
 
366 368
 # Initialization
367 369
 # ==============
... ...
@@ -376,6 +393,7 @@ cd $NOVA_DIR; sudo python setup.py develop
376 376
 cd $OPENSTACKX_DIR; sudo python setup.py develop
377 377
 cd $HORIZON_DIR/django-openstack; sudo python setup.py develop
378 378
 cd $HORIZON_DIR/openstack-dashboard; sudo python setup.py develop
379
+cd $QUANTUM_DIR; sudo python setup.py develop
379 380
 
380 381
 # Add a useful screenrc.  This isn't required to run openstack but is we do
381 382
 # it since we are going to run the services in screen for simple
... ...
@@ -616,8 +634,16 @@ add_nova_flag "--nodaemon"
616 616
 add_nova_flag "--allow_admin_api"
617 617
 add_nova_flag "--scheduler_driver=$SCHEDULER"
618 618
 add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
619
-add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
620 619
 add_nova_flag "--fixed_range=$FIXED_RANGE"
620
+if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
621
+    add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager"
622
+    if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
623
+        add_nova_flag "--libvirt_vif_type=ethernet"
624
+        add_nova_flag "--libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"
625
+    fi
626
+else
627
+    add_nova_flag "--network_manager=nova.network.manager.$NET_MAN"
628
+fi
621 629
 add_nova_flag "--my_ip=$HOST_IP"
622 630
 add_nova_flag "--public_interface=$PUBLIC_INTERFACE"
623 631
 add_nova_flag "--vlan_interface=$VLAN_INTERFACE"
... ...
@@ -676,12 +702,6 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
676 676
 
677 677
     # (re)create nova database
678 678
     $NOVA_DIR/bin/nova-manage db sync
679
-
680
-    # create a small network
681
-    $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE
682
-
683
-    # create some floating ips
684
-    $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
685 679
 fi
686 680
 
687 681
 
... ...
@@ -764,6 +784,55 @@ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
764 764
       exit 1
765 765
     fi
766 766
 fi
767
+
768
+# Quantum
769
+if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
770
+    # Create database for the plugin/agent
771
+    if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
772
+        if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
773
+            mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS ovs_quantum;'
774
+        else
775
+	    echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
776
+	    exit 1
777
+        fi
778
+    fi
779
+
780
+    QUANTUM_PLUGIN_INI_FILE=$QUANTUM_DIR/quantum/plugins.ini
781
+    # Make sure we're using the openvswitch plugin
782
+    sed -i -e "s/^provider =.*$/provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin/g" $QUANTUM_PLUGIN_INI_FILE
783
+    screen_it q-svc "cd $QUANTUM_DIR && export PYTHONPATH=.:$PYTHONPATH; python $QUANTUM_DIR/bin/quantum $QUANTUM_DIR/etc/quantum.conf"
784
+fi
785
+
786
+# Quantum agent (for compute nodes)
787
+if [[ "$ENABLED_SERVICES" =~ "q-agt" ]]; then
788
+    if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
789
+        # Set up integration bridge
790
+        OVS_BRIDGE=${OVS_BRIDGE:-br-int}
791
+        sudo ovs-vsctl --no-wait -- --if-exists del-br $OVS_BRIDGE
792
+        sudo ovs-vsctl --no-wait add-br $OVS_BRIDGE
793
+        sudo ovs-vsctl --no-wait br-set-external-id $OVS_BRIDGE bridge-id br-int
794
+    fi
795
+
796
+    # Start up the quantum <-> openvswitch agent
797
+    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"
798
+fi
799
+
800
+# NOTE(bgh): I moved the network creation here because Quantum has to be up
801
+# and running before we can communicate with it if we're using Quantum for
802
+# networking (i.e. q-svc is enabled).
803
+
804
+if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
805
+    # create a small network
806
+    $NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE
807
+
808
+    if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
809
+        echo "Not creating floating IPs (not supported by QuantumManager)"
810
+    else
811
+        # create some floating ips
812
+        $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
813
+    fi
814
+fi
815
+
767 816
 # Launching nova-compute should be as simple as running ``nova-compute`` but
768 817
 # have to do a little more than that in our script.  Since we add the group
769 818
 # ``libvirtd`` to our user in this script, when nova-compute is run it is
... ...
@@ -27,6 +27,10 @@ NOVACLIENT_BRANCH=master
27 27
 OPENSTACKX_REPO=https://github.com/cloudbuilders/openstackx.git
28 28
 OPENSTACKX_BRANCH=diablo
29 29
 
30
+# quantum service
31
+QUANTUM_REPO=https://github.com/openstack/quantum
32
+QUANTUM_BRANCH=diablo
33
+
30 34
 # Specify a comma-separated list of uec images to download and install into glance.
31 35
 IMAGE_URLS=http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz
32 36