From 73d5afa1581566b00ae116034c958ab85f5b35fd Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 18 Nov 2013 14:28:38 -0500 Subject: nova: generate per-service initscripts Rather than use the catch-all "nova-all" initscript, we switch to one initscript per-service. The old nova-all is still installed, but not linked as an initscript, so it can be used as a fallback. In addition to per-service initscripts, we switch to generating those initscripts from a common template script. Signed-off-by: Bruce Ashfield --- .../python/python-nova/nova-compute | 71 --------------------- .../recipes-devtools/python/python-nova/nova.init | 72 ++++++++++++++++++++++ .../recipes-devtools/python/python-nova_git.bb | 54 ++++++++++++++-- 3 files changed, 121 insertions(+), 76 deletions(-) delete mode 100644 meta-openstack/recipes-devtools/python/python-nova/nova-compute create mode 100644 meta-openstack/recipes-devtools/python/python-nova/nova.init diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-compute b/meta-openstack/recipes-devtools/python/python-nova/nova-compute deleted file mode 100644 index 024b099..0000000 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-compute +++ /dev/null @@ -1,71 +0,0 @@ -#!/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/nova.init b/meta-openstack/recipes-devtools/python/python-nova/nova.init new file mode 100644 index 0000000..3a2bbac --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova/nova.init @@ -0,0 +1,72 @@ +#!/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) - @suffix@ +# Description: OpenStack Compute (Nova) - @suffix@ +### END INIT INFO + +SUFFIX="@suffix@" +DESC="nova-@suffix@" +DAEMON="/usr/bin/nova-$SUFFIX" +PIDFILE="/var/run/nova-$SUFFIX.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_git.bb b/meta-openstack/recipes-devtools/python/python-nova_git.bb index 24e2ed7..6a9c53e 100644 --- a/meta-openstack/recipes-devtools/python/python-nova_git.bb +++ b/meta-openstack/recipes-devtools/python/python-nova_git.bb @@ -16,7 +16,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \ " SRC_URI += "file://nova-all \ - file://nova-compute \ + file://nova.init \ file://nova-consoleauth \ file://nova-novncproxy \ file://nova.conf \ @@ -92,10 +92,16 @@ do_install_append() { if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then install -d ${D}${sysconfdir}/init.d + + # nova-all is installed (and packaged), but not used as an initscript by default install -m 0755 ${WORKDIR}/nova-all ${D}${sysconfdir}/init.d/nova-all - install -m 0755 ${WORKDIR}/nova-compute ${D}${sysconfdir}/init.d/nova-compute install -m 0755 ${WORKDIR}/nova-consoleauth ${D}${sysconfdir}/init.d/nova-consoleauth install -m 0755 ${WORKDIR}/nova-novncproxy ${D}${sysconfdir}/init.d/nova-novncproxy + + for binary in api compute network scheduler cert conductor; do + sed "s:@suffix@:$binary:" < ${WORKDIR}/nova.init >${WORKDIR}/nova-$binary.init.sh + install -m 0755 ${WORKDIR}/nova-$binary.init.sh ${D}${sysconfdir}/init.d/nova-$binary + done fi } @@ -136,7 +142,11 @@ USERADD_PARAM_${PN} = "--system --home /var/lib/nova -g nova \ PACKAGES += " ${SRCNAME}-common ${SRCNAME}-compute ${SRCNAME}-controller" PACKAGES += " ${SRCNAME}-consoleauth" PACKAGES += " ${SRCNAME}-novncproxy" - +PACKAGES += " ${SRCNAME}-network" +PACKAGES += " ${SRCNAME}-scheduler" +PACKAGES += " ${SRCNAME}-cert" +PACKAGES += " ${SRCNAME}-conductor" +PACKAGES += " ${SRCNAME}-api" FILES_${PN} = "${libdir}/*" @@ -157,6 +167,21 @@ FILES_${SRCNAME}-consoleauth = " \ FILES_${SRCNAME}-novncproxy = " \ ${sysconfdir}/init.d/nova-novncproxy \ " +FILES_${SRCNAME}-network = " \ + ${sysconfdir}/init.d/nova-network \ +" +FILES_${SRCNAME}-scheduler = " \ + ${sysconfdir}/init.d/nova-scheduler \ +" +FILES_${SRCNAME}-cert = " \ + ${sysconfdir}/init.d/nova-cert \ +" +FILES_${SRCNAME}-conductor = " \ + ${sysconfdir}/init.d/nova-conductor \ +" +FILES_${SRCNAME}-api = " \ + ${sysconfdir}/init.d/nova-api \ +" RDEPENDS_${PN} = " python-modules \ python-misc \ @@ -202,13 +227,32 @@ RDEPENDS_${SRCNAME}-common = "${PN} openssl openssl-misc libxml2 libxslt \ RDEPENDS_${SRCNAME}-controller = "${PN} ${SRCNAME}-common \ ${SRCNAME}-consoleauth \ ${SRCNAME}-novncproxy \ + ${SRCNAME}-network \ + ${SRCNAME}-scheduler \ + ${SRCNAME}-cert \ + ${SRCNAME}-conductor \ + ${SRCNAME}-api \ postgresql postgresql-client python-psycopg2" RDEPENDS_${SRCNAME}-compute = "${PN} ${SRCNAME}-common \ qemu libvirt libvirt-libvirtd libvirt-python libvirt-virsh" -INITSCRIPT_PACKAGES = "${SRCNAME}-compute ${SRCNAME}-controller ${SRCNAME}-consoleauth ${SRCNAME}-novncproxy" -INITSCRIPT_NAME_${SRCNAME}-controller = "nova-all" +INITSCRIPT_PACKAGES = "${SRCNAME}-compute ${SRCNAME}-consoleauth ${SRCNAME}-novncproxy" +INITSCRIPT_PACKAGES += "${SRCNAME}-network ${SRCNAME}-scheduler ${SRCNAME}-cert ${SRCNAME}-conductor" +INITSCRIPT_PACKAGES += "${SRCNAME}-api" + +# nova-all can replace: network, scheduler, cert, conductor and api. +# by default we go for the more granular initscripts, but this is left +# in case nova-all is desired. +# INITSCRIPT_PACKAGES += "${SRCNAME}-controller" +# INITSCRIPT_NAME_${SRCNAME}-controller = "nova-all" +INITSCRIPT_NAME_${SRCNAME}-network = "nova-network" +INITSCRIPT_NAME_${SRCNAME}-scheduler = "nova-scheduler" +INITSCRIPT_NAME_${SRCNAME}-cert = "nova-cert" +INITSCRIPT_NAME_${SRCNAME}-conductor = "nova-conductor" +INITSCRIPT_NAME_${SRCNAME}-api = "nova-api" + INITSCRIPT_NAME_${SRCNAME}-compute = "nova-compute" INITSCRIPT_NAME_${SRCNAME}-consoleauth = "nova-consoleauth" INITSCRIPT_NAME_${SRCNAME}-novncproxy = "nova-novncproxy" + -- cgit v1.2.3-54-g00ecf