Browse code

Add rootwrap daemon mode support for Neutron

Daemon mode is turned on by default.

Implements: blueprint rootwrap-daemon-mode
Change-Id: I632df4149e9d7f78cb5a7091dfe4ea8f8ca3ddfa

Yuriy Taraday authored on 2014/07/16 22:41:53
Showing 1 changed files
... ...
@@ -153,6 +153,7 @@ Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
153 153
 # RHEL's support for namespaces requires using veths with ovs
154 154
 Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False}
155 155
 Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
156
+Q_USE_ROOTWRAP_DAEMON=$(trueorfalse True Q_USE_ROOTWRAP_DAEMON)
156 157
 # Meta data IP
157 158
 Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST}
158 159
 # Allow Overlapping IP among subnets
... ...
@@ -226,6 +227,9 @@ if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
226 226
 else
227 227
     NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
228 228
     Q_RR_COMMAND="sudo $NEUTRON_ROOTWRAP $Q_RR_CONF_FILE"
229
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
230
+        Q_RR_DAEMON_COMMAND="sudo $NEUTRON_ROOTWRAP-daemon $Q_RR_CONF_FILE"
231
+    fi
229 232
 fi
230 233
 
231 234
 
... ...
@@ -896,6 +900,9 @@ function _configure_neutron_debug_command {
896 896
     iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False
897 897
     iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
898 898
     iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND"
899
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
900
+        iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
901
+    fi
899 902
 
900 903
     _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE
901 904
 
... ...
@@ -910,6 +917,9 @@ function _configure_neutron_dhcp_agent {
910 910
     iniset $Q_DHCP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
911 911
     iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
912 912
     iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
913
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
914
+        iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
915
+    fi
913 916
 
914 917
     if ! is_service_enabled q-l3; then
915 918
         if [[ "$ENABLE_ISOLATED_METADATA" = "True" ]]; then
... ...
@@ -943,6 +953,9 @@ function _configure_neutron_l3_agent {
943 943
     iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
944 944
     iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
945 945
     iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
946
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
947
+        iniset $Q_L3_CONF_FILE agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
948
+    fi
946 949
 
947 950
     _neutron_setup_interface_driver $Q_L3_CONF_FILE
948 951
 
... ...
@@ -956,6 +969,9 @@ function _configure_neutron_metadata_agent {
956 956
     iniset $Q_META_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
957 957
     iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
958 958
     iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
959
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
960
+        iniset $Q_META_CONF_FILE agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
961
+    fi
959 962
 
960 963
     # Configures keystone for metadata_agent
961 964
     # The third argument "True" sets auth_url needed to communicate with keystone
... ...
@@ -1008,6 +1024,9 @@ function _configure_neutron_plugin_agent {
1008 1008
     # Specify the default root helper prior to agent configuration to
1009 1009
     # ensure that an agent's configuration can override the default
1010 1010
     iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND"
1011
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
1012
+        iniset /$Q_PLUGIN_CONF_FILE  agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
1013
+    fi
1011 1014
     iniset $NEUTRON_CONF DEFAULT verbose True
1012 1015
     iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
1013 1016
 
... ...
@@ -1106,16 +1125,21 @@ function _neutron_setup_rootwrap {
1106 1106
     sudo chmod 0644 $Q_RR_CONF_FILE
1107 1107
     # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap
1108 1108
     ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *"
1109
+    ROOTWRAP_DAEMON_SUDOER_CMD="$NEUTRON_ROOTWRAP-daemon $Q_RR_CONF_FILE"
1109 1110
 
1110 1111
     # Set up the rootwrap sudoers for neutron
1111 1112
     TEMPFILE=`mktemp`
1112 1113
     echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE
1114
+    echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_DAEMON_SUDOER_CMD" >>$TEMPFILE
1113 1115
     chmod 0440 $TEMPFILE
1114 1116
     sudo chown root:root $TEMPFILE
1115 1117
     sudo mv $TEMPFILE /etc/sudoers.d/neutron-rootwrap
1116 1118
 
1117 1119
     # Update the root_helper
1118 1120
     iniset $NEUTRON_CONF agent root_helper "$Q_RR_COMMAND"
1121
+    if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
1122
+        iniset $NEUTRON_CONF agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
1123
+    fi
1119 1124
 }
1120 1125
 
1121 1126
 # Configures keystone integration for neutron service and agents