]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Allow selecting log destination for Cinder daemons
authorSylvain Baubeau <sylvain.baubeau@enovance.com>
Tue, 8 Apr 2014 11:49:09 +0000 (13:49 +0200)
committerThomas Goirand <thomas@goirand.fr>
Thu, 10 Apr 2014 09:26:12 +0000 (17:26 +0800)
debian/cinder-api.init
debian/cinder-api.upstart.in
debian/cinder-backup.init
debian/cinder-backup.upstart.in
debian/cinder-scheduler.init
debian/cinder-scheduler.upstart.in
debian/cinder-volume.init
debian/cinder-volume.upstart.in

index d62979b86e5eb2edc34a7742edf05c8181dd6e3f..eb3f296eeb30e67a030bd1f0c3e74e6996022873 100644 (file)
@@ -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
index 2d6d07154d254f02f8401cf8187c80cf307307bc..0a321da32a0ab80ef77bbdf63f865ea60a8ccaac 100644 (file)
@@ -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
index 1624432e7d1c995affe4c3f09f251b3b27569dee..0376386d3437a1d042a5e68095ea2b3c2b998e77 100644 (file)
@@ -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
index a95de6fe883b911b9cfddbe68b899d29d1090e3d..a154f8898fe0b886eaa8a5bf6299f8e2077561a5 100644 (file)
@@ -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
index e6a4a66f2f4a3404efed8ac71304470877ecbbc9..6a80b5f9a3a80fba68b22a8155c1748b7bcdca40 100644 (file)
@@ -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
index c321041e58e4e65ae4d7e50b22c60181acf8dfbb..ce22933b2267d880f154fabf2127578119c6d72a 100644 (file)
@@ -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
index a23f893117b7973ef08dd61ef228f3fb70c71f40..e1a3b7e798df0f2ee664438b8fd3cb639b7e2160 100644 (file)
@@ -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
index dd3295adf590ad915a3e14b0b9a93fc9783e30b6..ebb14f0ceaaf08e16c12e0df4475bd843bc7d41a 100644 (file)
@@ -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