From df9fd4a52ebe447a7c2a4b2cfc4f4a4dd7f595af Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 27 Aug 2009 13:31:52 -0700 Subject: [PATCH] xenserver: Improve readability of /etc/init.d scripts. Less redundancy makes code easier to read. --- xenserver/etc_init.d_vswitch | 59 +++++++++++------------- xenserver/etc_init.d_vswitch-xapi-update | 28 +++++------ 2 files changed, 42 insertions(+), 45 deletions(-) diff --git a/xenserver/etc_init.d_vswitch b/xenserver/etc_init.d_vswitch index ee858fda..bb0011e3 100755 --- a/xenserver/etc_init.d_vswitch +++ b/xenserver/etc_init.d_vswitch @@ -24,41 +24,38 @@ test -e /etc/sysconfig/vswitch && . /etc/sysconfig/vswitch # General config variables in /etc/sysconfig/vswitch -VSWITCH_BASE="${VSWITCH_BASE:-/root/vswitch}" -ENABLE_BRCOMPAT="${ENABLE_BRCOMPAT:-y}" -ENABLE_FAKE_PROC_NET="${ENABLE_FAKE_PROC_NET:-y}" -FORCE_COREFILES="${FORCE_COREFILES:-y}" +: ${VSWITCH_BASE:=/root/vswitch} +: ${ENABLE_BRCOMPAT:=y} +: ${ENABLE_FAKE_PROC_NET:=y} +: ${FORCE_COREFILES:=y} # Config variables specific to ovs-vswitchd -VSWITCHD_CONF="${VSWITCHD_CONF:-/etc/ovs-vswitchd.conf}" -VSWITCHD_PIDFILE="${VSWITCHD_PIDFILE:-/var/run/ovs-vswitchd.pid}" -VSWITCHD_RUN_DIR="${VSWITCHD_RUN_DIR:-/var/xen/vswitch}" -VSWITCHD_PRIORITY="${VSWITCHD_PRIORITY:--5}" -VSWITCHD_NETBACK_PRIORITY="${VSWITCHD_NETBACK_PRIORITY:-0}" -VSWITCHD_LOGFILE="${VSWITCHD_LOGFILE:-/var/log/ovs-vswitchd.log}" -VSWITCHD_FILE_LOGLEVEL="${VSWITCHD_FILE_LOGLEVEL:-}" -VSWITCHD_SYSLOG_LOGLEVEL="${VSWITCHD_SYSLOG_LOGLEVEL:-WARN}" -VSWITCHD_MEMLEAK_LOGFILE="${VSWITCHD_MEMLEAK_LOGFILE:-}" -VSWITCHD_STRACE_LOG="${VSWITCHD_STRACE_LOG:-}" -VSWITCHD_STRACE_OPT="${VSWITCHD_STRACE_OPT:-}" -VSWITCHD_VALGRIND_LOG="${VSWITCHD_VALGRIND_LOG:-}" -VSWITCHD_VALGRIND_OPT="${VSWITCHD_VALGRIND_OPT:-}" +: ${VSWITCHD_CONF:=/etc/ovs-vswitchd.conf} +: ${VSWITCHD_PIDFILE:=/var/run/ovs-vswitchd.pid} +: ${VSWITCHD_RUN_DIR:=/var/xen/vswitch} +: ${VSWITCHD_PRIORITY:=-5} +: ${VSWITCHD_NETBACK_PRIORITY:=0} +: ${VSWITCHD_LOGFILE:=/var/log/ovs-vswitchd.log} +: ${VSWITCHD_FILE_LOGLEVEL:=} +: ${VSWITCHD_SYSLOG_LOGLEVEL:=WARN} +: ${VSWITCHD_MEMLEAK_LOGFILE:=} +: ${VSWITCHD_STRACE_LOG:=} +: ${VSWITCHD_STRACE_OPT:=} +: ${VSWITCHD_VALGRIND_LOG:=} +: ${VSWITCHD_VALGRIND_OPT:=} # Config variables specific to ovs-brcompatd -BRCOMPATD_PIDFILE="${BRCOMPATD_PIDFILE:-/var/run/ovs-brcompatd.pid}" -BRCOMPATD_RUN_DIR="${BRCOMPATD_RUN_DIR:-/var/xen/vswitch}" -BRCOMPATD_PRIORITY="${BRCOMPATD_PRIORITY:--5}" -BRCOMPATD_LOGFILE="${BRCOMPATD_LOGFILE:-/var/log/ovs-brcompatd.log}" -BRCOMPATD_FILE_LOGLEVEL="${BRCOMPATD_FILE_LOGLEVEL:-}" -BRCOMPATD_SYSLOG_LOGLEVEL="${BRCOMPATD_SYSLOG_LOGLEVEL:-INFO}" -BRCOMPATD_MEMLEAK_LOGFILE="${BRCOMPATD_MEMLEAK_LOGFILE:-}" -BRCOMPATD_STRACE_LOG="${BRCOMPATD_STRACE_LOG:-}" -BRCOMPATD_STRACE_OPT="${BRCOMPATD_STRACE_OPT:-}" -BRCOMPATD_VALGRIND_LOG="${BRCOMPATD_VALGRIND_LOG:-}" -BRCOMPATD_VALGRIND_OPT="${BRCOMPATD_VALGRIND_OPT:-}" - - - +: ${BRCOMPATD_PIDFILE:=/var/run/ovs-brcompatd.pid} +: ${BRCOMPATD_RUN_DIR:=/var/xen/vswitch} +: ${BRCOMPATD_PRIORITY:=-5} +: ${BRCOMPATD_LOGFILE:=/var/log/ovs-brcompatd.log} +: ${BRCOMPATD_FILE_LOGLEVEL:=} +: ${BRCOMPATD_SYSLOG_LOGLEVEL:=INFO} +: ${BRCOMPATD_MEMLEAK_LOGFILE:=} +: ${BRCOMPATD_STRACE_LOG:=} +: ${BRCOMPATD_STRACE_OPT:=} +: ${BRCOMPATD_VALGRIND_LOG:=} +: ${BRCOMPATD_VALGRIND_OPT:=} # Full paths to executables & modules vswitchd="$VSWITCH_BASE/sbin/ovs-vswitchd" diff --git a/xenserver/etc_init.d_vswitch-xapi-update b/xenserver/etc_init.d_vswitch-xapi-update index 5c9e0993..ef9bb881 100755 --- a/xenserver/etc_init.d_vswitch-xapi-update +++ b/xenserver/etc_init.d_vswitch-xapi-update @@ -22,20 +22,20 @@ . /etc/init.d/functions test -e /etc/sysconfig/vswitch && . /etc/sysconfig/vswitch -VSWITCH_BASE="${VSWITCH_BASE:-/root/vswitch}" -VSWITCHD_CONF="${VSWITCHD_CONF:-/etc/ovs-vswitchd.conf}" -VSWITCHD_PIDFILE="${VSWITCHD_PIDFILE:-/var/run/ovs-vswitchd.pid}" -VSWITCHD_PRIORITY="${VSWITCHD_PRIORITY:--5}" -VSWITCHD_LOGFILE="${VSWITCHD_LOGFILE:-/var/log/ovs-vswitchd.log}" -VSWITCHD_FILE_LOGLEVEL="${VSWITCHD_FILE_LOGLEVEL:-}" -VSWITCHD_SYSLOG_LOGLEVEL="${VSWITCHD_SYSLOG_LOGLEVEL:-WARN}" -VSWITCHD_MEMLEAK_LOGFILE="${VSWITCHD_MEMLEAK_LOGFILE:-}" -BRCOMPATD_PIDFILE="${BRCOMPATD_PIDFILE:-/var/run/ovs-brcompatd.pid}" -BRCOMPATD_PRIORITY="${BRCOMPATD_PRIORITY:--5}" -BRCOMPATD_LOGFILE="${BRCOMPATD_LOGFILE:-/var/log/ovs-brcompatd.log}" -BRCOMPATD_FILE_LOGLEVEL="${BRCOMPATD_FILE_LOGLEVEL:-}" -BRCOMPATD_SYSLOG_LOGLEVEL="${BRCOMPATD_SYSLOG_LOGLEVEL:-WARN}" -BRCOMPATD_MEMLEAK_LOGFILE="${BRCOMPATD_MEMLEAK_LOGFILE:-}" +: ${VSWITCH_BASE:=/root/vswitch} +: ${VSWITCHD_CONF:=/etc/ovs-vswitchd.conf} +: ${VSWITCHD_PIDFILE:=/var/run/ovs-vswitchd.pid} +: ${VSWITCHD_PRIORITY:=-5} +: ${VSWITCHD_LOGFILE:=/var/log/ovs-vswitchd.log} +: ${VSWITCHD_FILE_LOGLEVEL:=} +: ${VSWITCHD_SYSLOG_LOGLEVEL:=WARN} +: ${VSWITCHD_MEMLEAK_LOGFILE:=} +: ${BRCOMPATD_PIDFILE:=/var/run/ovs-brcompatd.pid} +: ${BRCOMPATD_PRIORITY:=-5} +: ${BRCOMPATD_LOGFILE:=/var/log/ovs-brcompatd.log} +: ${BRCOMPATD_FILE_LOGLEVEL:=} +: ${BRCOMPATD_SYSLOG_LOGLEVEL:=WARN} +: ${BRCOMPATD_MEMLEAK_LOGFILE:=} function do_host_call { xe host-call-plugin host-uuid="$INSTALLATION_UUID" plugin="vswitch-cfg-update" fn="update" >/dev/null -- 2.30.2