From 4b541beb2503394557c504c04ca6bef5d4f75bfd Mon Sep 17 00:00:00 2001 From: Mihai Prica Date: Tue, 11 Jun 2013 14:20:36 +0300 Subject: python-nova: Added initscripts Signed-off-by: Mihai Prica --- .../recipes-devtools/python/python-nova/nova-all | 73 ++++++++++++++++++++++ .../python/python-nova/nova-compute | 71 +++++++++++++++++++++ .../recipes-devtools/python/python-nova_2013.1.bb | 20 +++++- 3 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 meta-openstack/recipes-devtools/python/python-nova/nova-all create mode 100644 meta-openstack/recipes-devtools/python/python-nova/nova-compute diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-all b/meta-openstack/recipes-devtools/python/python-nova/nova-all new file mode 100644 index 0000000..5891759 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-all @@ -0,0 +1,73 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: nova-all +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: postgresql rabbitmq-server +# Should-Stop: postgresql rabbitmq-server +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: OpenStack Compute (Nova) +# Description: OpenStack Compute (Nova) +### END INIT INFO + +DESC="all nova services" +DAEMON="/usr/bin/nova-all" +PIDFILE="/var/run/nova-all.pid" + +start () +{ + if [ -e $PIDFILE ]; then + PIDDIR=/proc/$(cat $PIDFILE) + if [ -d ${PIDDIR} ]; then + echo "$DESC already running." + exit 1 + else + echo "Removing stale PID file $PIDFILE" + rm -f $PIDFILE + fi + fi + + echo -n "Starting $DESC..." + + start-stop-daemon --start --quiet --background \ + --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} + + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi +} + +stop () +{ + echo -n "Stopping $DESC..." + start-stop-daemon --stop --quiet --pidfile $PIDFILE + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi + rm -f $PIDFILE +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|force-reload|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-compute b/meta-openstack/recipes-devtools/python/python-nova/nova-compute new file mode 100644 index 0000000..024b099 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-compute @@ -0,0 +1,71 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: nova-compute +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: OpenStack Compute (Nova) - compute +# Description: OpenStack Compute (Nova) - compute +### END INIT INFO + +DESC="nova-compute" +DAEMON="/usr/bin/nova-compute" +PIDFILE="/var/run/nova-compute.pid" + +start () +{ + if [ -e $PIDFILE ]; then + PIDDIR=/proc/$(cat $PIDFILE) + if [ -d ${PIDDIR} ]; then + echo "$DESC already running." + exit 1 + else + echo "Removing stale PID file $PIDFILE" + rm -f $PIDFILE + fi + fi + + echo -n "Starting $DESC..." + + start-stop-daemon --start --quiet --background \ + --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} + + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi +} + +stop () +{ + echo -n "Stopping $DESC..." + start-stop-daemon --stop --quiet --pidfile $PIDFILE + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi + rm -f $PIDFILE +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|force-reload|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb b/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb index d6b9ca1..364c1e3 100644 --- a/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb +++ b/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb @@ -11,6 +11,8 @@ SRCNAME = "nova" SRC_URI = "https://launchpad.net/${SRCNAME}/grizzly/${PV}/+download/${SRCNAME}-${PV}.tar.gz \ file://nova.conf \ + file://nova-compute \ + file://nova-all \ file://api-paste.ini" @@ -19,7 +21,7 @@ SRC_URI[sha256sum] = "db7f5259d848358bf14105d5833869ec145f643312e6bc0adef0050120 S = "${WORKDIR}/${SRCNAME}-${PV}" -inherit setuptools useradd +inherit setuptools useradd update-rc.d do_install_append() { @@ -53,9 +55,16 @@ do_install_append() { # Create the sqlite database #touch ${NOVA_CONF_DIR}/nova.db install -d ${NOVA_CONF_DIR}/instances + + if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/nova-compute ${D}${sysconfdir}/init.d/nova-compute + install -m 0755 ${WORKDIR}/nova-all ${D}${sysconfdir}/init.d/nova-all + fi + } -inherit useradd +inherit useradd update-rc.d USERADD_PACKAGES = "${PN}" GROUPADD_PARAM_${PN} = "--system nova" @@ -66,7 +75,8 @@ pkg_postinst_${SRCNAME}-controller () { if [ "x$D" != "x" ]; then exit 1 fi - + #quick fix + #exit 1 # Needed when using a MySQL backend # mysql -u root -e "CREATE DATABASE nova CHARACTER SET latin1;" sudo -u postgres createdb nova @@ -132,3 +142,7 @@ RDEPENDS_${SRCNAME}-compute = "${PN} nova-common \ RDEPENDS_${SRCNAME}-controller = "${PN} nova-common \ postgresql postgresql-client python-psycopg2" + +INITSCRIPT_PACKAGES = "${SRCNAME}-compute ${SRCNAME}-controller" +INITSCRIPT_NAME_${SRCNAME}-compute = "nova-compute" +INITSCRIPT_NAME_${SRCNAME}-controller = "nova-all" -- cgit v1.2.3-54-g00ecf