From: Sylvain Baubeau Date: Tue, 8 Apr 2014 11:49:09 +0000 (+0200) Subject: Allow selecting log destination for Cinder daemons X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=12748e2193dd860e98e3f973429cb4c1d70dde06;p=openstack-build%2Fcinder-build.git Allow selecting log destination for Cinder daemons --- diff --git a/debian/cinder-api.init b/debian/cinder-api.init index d62979b86..eb3f296ee 100644 --- a/debian/cinder-api.init +++ b/debian/cinder-api.init @@ -19,7 +19,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="OpenStack Cinder Api" NAME=cinder-api DAEMON=/usr/bin/cinder-api -DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-api.log" +DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CINDER_USER=cinder @@ -33,6 +33,12 @@ chown ${CINDER_USER} ${LOCK_DIR} . /lib/lsb/init-functions +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-api.log" + do_start(){ start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ || return 1 diff --git a/debian/cinder-api.upstart.in b/debian/cinder-api.upstart.in index 2d6d07154..0a321da32 100644 --- a/debian/cinder-api.upstart.in +++ b/debian/cinder-api.upstart.in @@ -14,5 +14,13 @@ pre-start script chown cinder:root /var/lock/cinder end script -exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-api \ - -- --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-api.log +script + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log" + + exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-api -- \ + --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS +end script diff --git a/debian/cinder-backup.init b/debian/cinder-backup.init index 1624432e7..0376386d3 100644 --- a/debian/cinder-backup.init +++ b/debian/cinder-backup.init @@ -18,7 +18,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="OpenStack Cinder Backup" NAME=cinder-backup DAEMON=/usr/bin/cinder-backup -DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-backup.log" +DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CINDER_USER=cinder @@ -32,6 +32,12 @@ chown ${CINDER_USER} ${LOCK_DIR} . /lib/lsb/init-functions +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-backup.log" + do_start() { start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ || return 1 diff --git a/debian/cinder-backup.upstart.in b/debian/cinder-backup.upstart.in index a95de6fe8..a154f8898 100644 --- a/debian/cinder-backup.upstart.in +++ b/debian/cinder-backup.upstart.in @@ -14,5 +14,13 @@ pre-start script chown cinder:root /var/lock/cinder end script -exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-backup \ - -- --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-backup.log +script + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log" + + exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-backup -- \ + --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS +end script diff --git a/debian/cinder-scheduler.init b/debian/cinder-scheduler.init index e6a4a66f2..6a80b5f9a 100644 --- a/debian/cinder-scheduler.init +++ b/debian/cinder-scheduler.init @@ -19,7 +19,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="OpenStack Cinder Scheduler" NAME=cinder-scheduler DAEMON=/usr/bin/cinder-scheduler -DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-scheduler.log" +DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CINDER_USER=cinder @@ -33,6 +33,12 @@ chown ${CINDER_USER} ${LOCK_DIR} . /lib/lsb/init-functions +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-scheduler.log" + do_start() { start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ || return 1 diff --git a/debian/cinder-scheduler.upstart.in b/debian/cinder-scheduler.upstart.in index c321041e5..ce22933b2 100644 --- a/debian/cinder-scheduler.upstart.in +++ b/debian/cinder-scheduler.upstart.in @@ -14,5 +14,13 @@ pre-start script chown cinder:root /var/lock/cinder end script -exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-scheduler \ - -- --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-scheduler.log +script + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log" + + exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-scheduler -- \ + --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS +end script diff --git a/debian/cinder-volume.init b/debian/cinder-volume.init index a23f89311..e1a3b7e79 100644 --- a/debian/cinder-volume.init +++ b/debian/cinder-volume.init @@ -19,7 +19,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="OpenStack Cinder Volume" NAME=cinder-volume DAEMON=/usr/bin/cinder-volume -DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-volume.log" +DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CINDER_USER=cinder @@ -33,6 +33,12 @@ chown ${CINDER_USER} ${LOCK_DIR} . /lib/lsb/init-functions +[ -r /etc/default/openstack ] && . /etc/default/openstack +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" +[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-volume.log" + do_start() { start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \ || return 1 diff --git a/debian/cinder-volume.upstart.in b/debian/cinder-volume.upstart.in index dd3295adf..ebb14f0ce 100644 --- a/debian/cinder-volume.upstart.in +++ b/debian/cinder-volume.upstart.in @@ -14,5 +14,13 @@ pre-start script chown cinder:root /var/lock/cinder end script -exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-volume \ - -- --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-volume.log +script + [ -r /etc/default/openstack ] && . /etc/default/openstack + [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB + + [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog" + [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log" + + exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-volume -- \ + --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS +end script