Refactor error logging
It is hard to grep errors in current log. so in this patch,
I'm updating die function which also writes log for
screen_log_dir/error.log.
In future, we may categolize negative fault by using
this error.log.
Change-Id: I70a8cfe67ed408284f5c88c762c6bb8acb8ecdb2
diff --git a/lib/quantum_plugins/nicira b/lib/quantum_plugins/nicira
index bc9a36f..8c150b1 100644
--- a/lib/quantum_plugins/nicira
+++ b/lib/quantum_plugins/nicira
@@ -19,8 +19,7 @@
conn=(${NVP_CONTROLLER_CONNECTION//\:/ })
OVS_MGR_IP=${conn[0]}
else
- echo "Error - No controller specified. Unable to set a manager for OVS"
- exit 1
+ die $LINENO "Error - No controller specified. Unable to set a manager for OVS"
fi
sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
}
@@ -63,14 +62,12 @@
function quantum_plugin_configure_l3_agent() {
# Nicira plugin does not run L3 agent
- echo "ERROR - q-l3 should must not be executed with Nicira plugin!"
- exit 1
+ die $LINENO "q-l3 should must not be executed with Nicira plugin!"
}
function quantum_plugin_configure_plugin_agent() {
# Nicira plugin does not run L2 agent
- echo "ERROR - q-agt must not be executed with Nicira plugin!"
- exit 1
+ die $LINENO "q-agt must not be executed with Nicira plugin!"
}
function quantum_plugin_configure_service() {
@@ -93,8 +90,7 @@
if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" default_tz_uuid $DEFAULT_TZ_UUID
else
- echo "ERROR - The nicira plugin won't work without a default transport zone."
- exit 1
+ die $LINENO "The nicira plugin won't work without a default transport zone."
fi
if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
@@ -114,8 +110,7 @@
# Only 1 controller can be specified in this case
iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" nvp_controller_connection $NVP_CONTROLLER_CONNECTION
else
- echo "ERROR - The nicira plugin needs at least an NVP controller."
- exit 1
+ die $LINENO "The nicira plugin needs at least an NVP controller."
fi
if [[ "$NVP_USER" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE "CLUSTER:$DC" nvp_user $NVP_USER
diff --git a/lib/quantum_plugins/openvswitch b/lib/quantum_plugins/openvswitch
index 726c6c3..288fa69 100644
--- a/lib/quantum_plugins/openvswitch
+++ b/lib/quantum_plugins/openvswitch
@@ -49,9 +49,7 @@
# REVISIT - also check kernel module support for GRE and patch ports
OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then
- echo "You are running OVS version $OVS_VERSION."
- echo "OVS 1.4+ is required for tunneling between multiple hosts."
- exit 1
+ die $LINENO "You are running OVS version $OVS_VERSION. OVS 1.4+ is required for tunneling between multiple hosts."
fi
iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP