Browse code

Update stack.sh to track quantum rootwrap

Resubmit of https://review.openstack.org/12822
Fix bugs 1044084 and 1048483

Copy new conf files into /etc at stack time.
iniset the agents' init files to include new rootwrap conf
Launch agents as regular user, not root
Fix service launch of ovs
Correctly handle qemu.conf permissions

Change-Id: Ib6b8a97698df1b816eecc18d1df11267cb027a3d

John Dunning authored on 2012/09/12 05:13:37
Showing 1 changed files
... ...
@@ -769,6 +769,8 @@ if is_service_enabled q-agt; then
769 769
         else
770 770
             ### FIXME(dtroyer): Find RPMs for OpenVSwitch
771 771
             echo "OpenVSwitch packages need to be located"
772
+            # Fedora does not started OVS by default
773
+            restart_service openvswitch
772 774
         fi
773 775
     elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
774 776
        install_package bridge-utils
... ...
@@ -1230,6 +1232,13 @@ if is_service_enabled quantum; then
1230 1230
 
1231 1231
     Q_CONF_FILE=/etc/quantum/quantum.conf
1232 1232
     cp $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
1233
+    Q_RR_CONF_FILE=/etc/quantum/rootwrap.conf
1234
+    cp -p $QUANTUM_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE
1235
+
1236
+    # Copy over the config and filter bits
1237
+    Q_CONF_ROOTWRAP_D=/etc/quantum/rootwrap.d
1238
+    mkdir -p $Q_CONF_ROOTWRAP_D
1239
+    cp -pr $QUANTUM_DIR/etc/quantum/rootwrap.d/* $Q_CONF_ROOTWRAP_D/
1233 1240
 fi
1234 1241
 
1235 1242
 # Quantum service (for controller node)
... ...
@@ -1336,6 +1345,8 @@ if is_service_enabled q-agt; then
1336 1336
         if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
1337 1337
             iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS
1338 1338
         fi
1339
+        # Update config w/rootwrap
1340
+        iniset /$Q_PLUGIN_CONF_FILE OVS root_helper #Q_RR_CONF_FILE
1339 1341
         AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent"
1340 1342
     elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1341 1343
         # Setup physical network interface mappings.  Override
... ...
@@ -1347,6 +1358,8 @@ if is_service_enabled q-agt; then
1347 1347
         if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
1348 1348
             iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS
1349 1349
         fi
1350
+        # Update config w/rootwrap
1351
+        iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE root_helper #Q_RR_CONF_FILE
1350 1352
         AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent"
1351 1353
     fi
1352 1354
 fi
... ...
@@ -1367,6 +1380,9 @@ if is_service_enabled q-dhcp; then
1367 1367
 
1368 1368
     quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url
1369 1369
 
1370
+    # Update config w/rootwrap
1371
+    iniset /$Q_DHCP_CONF_FILE DEFAULT root_helper #Q_RR_CONF_FILE
1372
+
1370 1373
     if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
1371 1374
         iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
1372 1375
     elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
... ...
@@ -1548,8 +1564,7 @@ if is_service_enabled n-cpu; then
1548 1548
     QEMU_CONF=/etc/libvirt/qemu.conf
1549 1549
     if is_service_enabled quantum && [[ $Q_PLUGIN = "openvswitch" ]] && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF ; then
1550 1550
         # Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces
1551
-        sudo chmod 666 $QEMU_CONF
1552
-        sudo cat <<EOF >> /etc/libvirt/qemu.conf
1551
+        cat <<EOF | sudo tee -a $QEMU_CONF
1553 1552
 cgroup_device_acl = [
1554 1553
     "/dev/null", "/dev/full", "/dev/zero",
1555 1554
     "/dev/random", "/dev/urandom",
... ...
@@ -1557,7 +1572,6 @@ cgroup_device_acl = [
1557 1557
     "/dev/rtc", "/dev/hpet","/dev/net/tun",
1558 1558
 ]
1559 1559
 EOF
1560
-        sudo chmod 644 $QEMU_CONF
1561 1560
     fi
1562 1561
 
1563 1562
     if [[ "$os_PACKAGE" = "deb" ]]; then
... ...
@@ -2184,9 +2198,9 @@ elif is_service_enabled mysql && is_service_enabled nova; then
2184 2184
 fi
2185 2185
 
2186 2186
 # Start up the quantum agents if enabled
2187
-screen_it q-agt "sudo python $AGENT_BINARY --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
2188
-screen_it q-dhcp "sudo python $AGENT_DHCP_BINARY --config-file $Q_CONF_FILE --config-file=$Q_DHCP_CONF_FILE"
2189
-screen_it q-l3 "sudo python $AGENT_L3_BINARY --config-file $Q_CONF_FILE --config-file=$Q_L3_CONF_FILE"
2187
+screen_it q-agt "python $AGENT_BINARY --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
2188
+screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $Q_CONF_FILE --config-file=$Q_DHCP_CONF_FILE"
2189
+screen_it q-l3 "python $AGENT_L3_BINARY --config-file $Q_CONF_FILE --config-file=$Q_L3_CONF_FILE"
2190 2190
 
2191 2191
 echo_summary "Starting Nova"
2192 2192
 # The group **libvirtd** is added to the current user in this script.