From: Alexander Arzhanov <aarzhanov@mirantis.com>
Date: Tue, 11 Aug 2015 15:16:47 +0000 (+0300)
Subject: Recovery cinder-volume-vmware init files
X-Git-Tag: mos-9.0~10
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F10332%2F1;p=openstack-build%2Fcinder-build.git

Recovery cinder-volume-vmware init files

Restore files that have been added in this review
https://review.fuel-infra.org/#/c/4509/

Change-Id: Ide3e634614bad27476d4362d06231aeb3638a412
Partial-Bug: #1482653
---

diff --git a/rpm/SOURCES/openstack-cinder-volume-vmware.init b/rpm/SOURCES/openstack-cinder-volume-vmware.init
new file mode 100644
index 000000000..063ace5df
--- /dev/null
+++ b/rpm/SOURCES/openstack-cinder-volume-vmware.init
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# openstack-cinder-volume  OpenStack Cinder Volume Services
+#
+# chkconfig:   - 98 02
+# description:  Volume Workers interact with iSCSI storage to manage    \
+#               LVM-based instance volumes. Specific functions include: \
+#               * Create Volumes                                        \
+#               * Establish Compute volumes
+## BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
+# Short-Description: OpenStack cinder Volume Worker
+# Description:  Volume Workers interact with iSCSI storage to manage
+#               LVM-based instance volumes. Specific functions include:
+#               * Create Volumes
+#               * Delete Volumes
+#               * Establish Compute volumes
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+suffix=volume
+cluster=${0##*-} # s/cluster/index/
+prog=openstack-cinder-$suffix-vmware-$cluster
+exec="/usr/bin/cinder-$suffix"
+config="/etc/cinder/cinder.conf"
+pidfile="/var/run/cinder/cinder-$suffix.$cluster.pid"
+logfile="/var/log/cinder/$suffix-$cluster.log"
+
+[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+    [ -x $exec ] || exit 5
+    [ -f $config ] || exit 6
+    echo -n $"Starting $prog: "
+    daemon --user cinder --pidfile $pidfile "$exec --logfile $logfile ${OPTIONS} &>/dev/null & echo \$! > $pidfile"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc -p $pidfile ${prog%%.*}
+    if pgrep -f "cinder-$suffix.*$cluster\.conf" &>/dev/null ; then
+        sleep 2
+        pgrep -f "cinder-$suffix.*$cluster\.conf" &>/dev/null && \
+        pkill -f "$cluster.conf"
+    fi
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    restart
+}
+
+force_reload() {
+    restart
+}
+
+rh_status() {
+    status -p $pidfile $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+exit $?
diff --git a/rpm/SPECS/openstack-cinder.spec b/rpm/SPECS/openstack-cinder.spec
index 8c7968d26..8f726bd67 100644
--- a/rpm/SPECS/openstack-cinder.spec
+++ b/rpm/SPECS/openstack-cinder.spec
@@ -18,6 +18,7 @@ Source11:         openstack-cinder-scheduler.init
 Source12:         openstack-cinder-volume.init
 Source13:         openstack-cinder-backup.init
 Source14:         cinder.conf.sample
+Source15:         openstack-cinder-volume-vmware.init
 
 
 Source20:         cinder-sudoers
@@ -197,6 +198,7 @@ install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder
 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder
 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/cinder/cinder-dist.conf
 install -p -D -m 640 %{SOURCE14}  %{buildroot}%{_sysconfdir}/cinder/cinder.conf
+install -p -D -m 755 %{SOURCE15} %{buildroot}%{_datadir}/cinder/openstack-cinder-volume-vmware
 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder/volumes
 install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt/conf.d/cinder.conf
 install -p -D -m 640 etc/cinder/rootwrap.conf %{buildroot}%{_sysconfdir}/cinder/rootwrap.conf
diff --git a/trusty/debian/cinder-volume-vmware.conf b/trusty/debian/cinder-volume-vmware.conf
new file mode 100644
index 000000000..2e531c61a
--- /dev/null
+++ b/trusty/debian/cinder-volume-vmware.conf
@@ -0,0 +1,21 @@
+# vim: set ft=upstart et ts=2:
+description "Cinder volume service for vmware"
+author "Igor Gajsin igajsin@mirantis.com"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+chdir /var/run
+
+pre-start script
+    mkdir -p /var/run/cinder
+    chown cinder:cinder /var/run/cinder
+
+    mkdir -p /var/lock/cinder
+    chown cinder:root /var/lock/cinder
+end script
+
+script
+  [ -r /etc/default/$UPSTART_JOB ] &&. /etc/default/$UPSTART_JOB
+  start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-volume -- $CINDER_VOLUME_OPTS
+end script
diff --git a/trusty/debian/cinder-volume.dirs b/trusty/debian/cinder-volume.dirs
index 769913906..8ef65c6b2 100644
--- a/trusty/debian/cinder-volume.dirs
+++ b/trusty/debian/cinder-volume.dirs
@@ -1 +1,2 @@
 var/lib/cinder/volumes
+usr/share/cinder
diff --git a/trusty/debian/cinder-volume.install b/trusty/debian/cinder-volume.install
index bbaf426b3..cbe16b457 100644
--- a/trusty/debian/cinder-volume.install
+++ b/trusty/debian/cinder-volume.install
@@ -1,4 +1,5 @@
 debian/cinder_tgt.conf etc/tgt/conf.d
+debian/cinder-volume-vmware.conf usr/share/cinder
 etc/cinder/rootwrap.d/volume.filters /etc/cinder/rootwrap.d
 usr/bin/cinder-volume
 usr/bin/cinder-volume-usage-audit