diff options
author | Amy Fong <amy.fong@windriver.com> | 2014-03-21 17:07:29 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-03-24 16:53:27 -0400 |
commit | ec4dd1f12eff5aab513845cafa87fbec8166adff (patch) | |
tree | 2bf84a9d4fe46723ea8c08168e09a87d455c9447 /meta-openstack/recipes-devtools/python/python-nova | |
parent | 6423ced4885488dbe8cc05249d7d16cbcfe750c2 (diff) | |
download | meta-cloud-services-ec4dd1f12eff5aab513845cafa87fbec8166adff.tar.gz |
OpenStack: nova-novncproxy:can't stop this service
nova-novncproxy and nova-spicehtml5proxy both do not check to see if the process
specified in PIDFILE exists before firing off a new one. Both initrd files can
actually use nova.init (used for the many other nova-* daemons)
nova-consoleauth also has this issue, we add a check in start to see if the process
in PIDFILE exists and exits if it does.
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-nova')
4 files changed, 139 insertions, 186 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-console.init b/meta-openstack/recipes-devtools/python/python-nova/nova-console.init new file mode 100644 index 0000000..bb5e94c --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-console.init | |||
@@ -0,0 +1,119 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: nova-compute | ||
5 | # Required-Start: $remote_fs $syslog | ||
6 | # Required-Stop: $remote_fs $syslog | ||
7 | # Default-Start: 3 5 | ||
8 | # Default-Stop: 0 1 2 6 | ||
9 | # Short-Description: OpenStack Compute (Nova) - @suffix@ | ||
10 | # Description: OpenStack Compute (Nova) - @suffix@ | ||
11 | ### END INIT INFO | ||
12 | |||
13 | SUFFIX="@suffix@" | ||
14 | DESC="nova-@suffix@" | ||
15 | DAEMON="/usr/bin/nova-$SUFFIX" | ||
16 | PIDFILE="/var/run/nova/nova-$SUFFIX.pid" | ||
17 | |||
18 | if test -f /etc/default/nova-consoleproxy; then | ||
19 | . /etc/default/nova-consoleproxy | ||
20 | fi | ||
21 | |||
22 | |||
23 | # default to spicehtml5 | ||
24 | if [ -z "${NOVA_CONSOLE_PROXY_TYPE}" ] ; then | ||
25 | NOVA_CONSOLE_PROXY_TYPE="spicehtml5" | ||
26 | fi | ||
27 | |||
28 | if ! [ "${NOVA_CONSOLE_PROXY_TYPE}" = "@proxy_type@" ] ; then | ||
29 | exit 0 | ||
30 | fi | ||
31 | |||
32 | mkdir -p /var/run/nova | ||
33 | chown nova:root /var/run/nova/ | ||
34 | |||
35 | mkdir -p /var/lock/nova | ||
36 | chown nova:root /var/lock/nova/ | ||
37 | |||
38 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | ||
39 | export TMPDIR=/var/lib/nova/tmp | ||
40 | |||
41 | if ! [ -x ${DAEMON} ] ; then | ||
42 | exit 0 | ||
43 | fi | ||
44 | |||
45 | start () | ||
46 | { | ||
47 | if [ -e $PIDFILE ]; then | ||
48 | PIDDIR=/proc/$(cat $PIDFILE) | ||
49 | if [ -d ${PIDDIR} ]; then | ||
50 | echo "$DESC already running." | ||
51 | exit 1 | ||
52 | else | ||
53 | echo "Removing stale PID file $PIDFILE" | ||
54 | rm -f $PIDFILE | ||
55 | fi | ||
56 | fi | ||
57 | PIDDIR=`dirname $PIDFILE` | ||
58 | if [ ! -d $PIDDIR ]; then | ||
59 | mkdir -p $PIDDIR | ||
60 | chown nova $PIDDIR | ||
61 | fi | ||
62 | echo -n "Starting $DESC..." | ||
63 | |||
64 | sudo -u nova \ | ||
65 | start-stop-daemon --start --quiet --background \ | ||
66 | --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} | ||
67 | |||
68 | if [ $? -eq 0 ]; then | ||
69 | echo "done." | ||
70 | else | ||
71 | echo "failed." | ||
72 | fi | ||
73 | } | ||
74 | |||
75 | stop () | ||
76 | { | ||
77 | echo -n "Stopping $DESC..." | ||
78 | start-stop-daemon --stop --quiet --pidfile $PIDFILE | ||
79 | if [ $? -eq 0 ]; then | ||
80 | echo "done." | ||
81 | else | ||
82 | echo "failed." | ||
83 | fi | ||
84 | rm -f $PIDFILE | ||
85 | } | ||
86 | |||
87 | status() | ||
88 | { | ||
89 | pid=`cat $PIDFILE 2>/dev/null` | ||
90 | if [ -n "$pid" ]; then | ||
91 | if ps -p $pid >&- ; then | ||
92 | echo "$DESC is running" | ||
93 | return | ||
94 | fi | ||
95 | fi | ||
96 | echo "$DESC is not running" | ||
97 | } | ||
98 | |||
99 | case "$1" in | ||
100 | start) | ||
101 | start | ||
102 | ;; | ||
103 | stop) | ||
104 | stop | ||
105 | ;; | ||
106 | restart|force-reload|reload) | ||
107 | stop | ||
108 | start | ||
109 | ;; | ||
110 | status) | ||
111 | status | ||
112 | ;; | ||
113 | *) | ||
114 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | ||
115 | exit 1 | ||
116 | ;; | ||
117 | esac | ||
118 | |||
119 | exit 0 | ||
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth b/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth index 56561db..d2c1f29 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth +++ b/meta-openstack/recipes-devtools/python/python-nova/nova-consoleauth | |||
@@ -59,8 +59,27 @@ status() | |||
59 | case "$1" in | 59 | case "$1" in |
60 | start) | 60 | start) |
61 | test "$ENABLED" = "true" || exit 0 | 61 | test "$ENABLED" = "true" || exit 0 |
62 | |||
63 | if [ -e $PIDFILE ]; then | ||
64 | PIDDIR=/proc/$(cat $PIDFILE) | ||
65 | if [ -d ${PIDDIR} ]; then | ||
66 | echo "$DESC already running." | ||
67 | exit 1 | ||
68 | else | ||
69 | echo "Removing stale PID file $PIDFILE" | ||
70 | rm -f $PIDFILE | ||
71 | fi | ||
72 | fi | ||
73 | PIDDIR=`dirname $PIDFILE` | ||
74 | if [ ! -d $PIDDIR ]; then | ||
75 | mkdir -p $PIDDIR | ||
76 | chown nova $PIDDIR | ||
77 | fi | ||
78 | |||
62 | echo "Starting nova console" "nova-consoleauth" | 79 | echo "Starting nova console" "nova-consoleauth" |
63 | start-stop-daemon --start -b -m --pidfile $PIDFILE --exec ${DAEMON} -- ${DAEMON_ARGS} | 80 | sudo -u nova \ |
81 | start-stop-daemon --start -b -m --pidfile $PIDFILE \ | ||
82 | --exec ${DAEMON} -- ${DAEMON_ARGS} | ||
64 | log_end_msg $? | 83 | log_end_msg $? |
65 | ;; | 84 | ;; |
66 | stop) | 85 | stop) |
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy b/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy deleted file mode 100644 index f2b2f22..0000000 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-novncproxy +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: nova-novncproxy | ||
4 | # Required-Start: $remote_fs $syslog | ||
5 | # Required-Stop: $remote_fs $syslog | ||
6 | # Should-Start: libvirt-bin | ||
7 | # Should-Stop: libvirt-bin | ||
8 | # Default-Start: 2 3 4 5 | ||
9 | # Default-Stop: 0 1 6 | ||
10 | # Short-Description: nova-novncproxy service | ||
11 | # Description: Provides vnc proxy services for the openstack | ||
12 | # cloud computing system | ||
13 | ### END INIT INFO | ||
14 | |||
15 | |||
16 | set -e | ||
17 | |||
18 | DAEMON=/usr/bin/nova-novncproxy | ||
19 | DAEMON_ARGS="" | ||
20 | PIDFILE=/var/run/nova/nova-novncproxy.pid | ||
21 | |||
22 | ENABLED=true | ||
23 | |||
24 | if test -f /etc/default/nova-consoleproxy; then | ||
25 | . /etc/default/nova-consoleproxy | ||
26 | fi | ||
27 | |||
28 | # default to novnc | ||
29 | if [ -z "${NOVA_CONSOLE_PROXY_TYPE}" ] ; then | ||
30 | NOVA_CONSOLE_PROXY_TYPE="novnc" | ||
31 | fi | ||
32 | |||
33 | if ! [ "${NOVA_CONSOLE_PROXY_TYPE}" = "novnc" ] ; then | ||
34 | exit 0 | ||
35 | fi | ||
36 | |||
37 | mkdir -p /var/run/nova | ||
38 | chown nova:root /var/run/nova/ | ||
39 | |||
40 | mkdir -p /var/lock/nova | ||
41 | chown nova:root /var/lock/nova/ | ||
42 | |||
43 | . /lib/lsb/init-functions | ||
44 | |||
45 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | ||
46 | export TMPDIR=/var/lib/nova/tmp | ||
47 | |||
48 | if ! [ -x ${DAEMON} ] ; then | ||
49 | exit 0 | ||
50 | fi | ||
51 | |||
52 | DESC="nova vnc proxy" | ||
53 | status() | ||
54 | { | ||
55 | pid=`cat $PIDFILE 2>/dev/null` | ||
56 | if [ -n "$pid" ]; then | ||
57 | if ps -p $pid >&- ; then | ||
58 | echo "$DESC is running" | ||
59 | return | ||
60 | fi | ||
61 | fi | ||
62 | echo "$DESC is not running" | ||
63 | } | ||
64 | |||
65 | case "$1" in | ||
66 | start) | ||
67 | test "$ENABLED" = "true" || exit 0 | ||
68 | echo "Starting nova vnc proxy" "nova-novncproxy" | ||
69 | start-stop-daemon --start -b -m --pidfile $PIDFILE --exec ${DAEMON} -- ${DAEMON_ARGS} | ||
70 | log_end_msg $? | ||
71 | ;; | ||
72 | stop) | ||
73 | test "$ENABLED" = "true" || exit 0 | ||
74 | echo "Stopping nova vnc proxy" "nova-novncproxy" | ||
75 | start-stop-daemon --stop --oknodo --pidfile ${PIDFILE} | ||
76 | log_end_msg $? | ||
77 | ;; | ||
78 | restart|force-reload|reload) | ||
79 | test "$ENABLED" = "true" || exit 1 | ||
80 | $0 stop | ||
81 | sleep 1 | ||
82 | $0 start | ||
83 | ;; | ||
84 | status) | ||
85 | test "$ENABLED" = "true" || exit 0 | ||
86 | status | ||
87 | ;; | ||
88 | *) | ||
89 | echo "Usage: /etc/init.d/nova-novncproxy {start|stop|restart|force-reload|status|reload|status}" | ||
90 | exit 1 | ||
91 | ;; | ||
92 | esac | ||
93 | |||
94 | exit 0 | ||
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-spicehtml5proxy b/meta-openstack/recipes-devtools/python/python-nova/nova-spicehtml5proxy deleted file mode 100644 index d58f71e..0000000 --- a/meta-openstack/recipes-devtools/python/python-nova/nova-spicehtml5proxy +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: nova-spicehtml5proxy | ||
4 | # Required-Start: $remote_fs $syslog | ||
5 | # Required-Stop: $remote_fs $syslog | ||
6 | # Should-Start: libvirt-bin | ||
7 | # Should-Stop: libvirt-bin | ||
8 | # Default-Start: 2 3 4 5 | ||
9 | # Default-Stop: 0 1 6 | ||
10 | # Short-Description: nova-spicehtml5proxy service | ||
11 | # Description: Provides spice html5 proxy services for the openstack | ||
12 | # cloud computing system | ||
13 | ### END INIT INFO | ||
14 | |||
15 | |||
16 | set -e | ||
17 | |||
18 | NAME=nova-spicehtml5proxy | ||
19 | DESC="OpenStack Compute Spice HTML5 Proxy" | ||
20 | SCRIPTNAME=/etc/init.d/$NAME | ||
21 | DAEMON=/usr/bin/nova-spicehtml5proxy | ||
22 | DAEMON_ARGS="" | ||
23 | PIDFILE=/var/run/nova/$NAME.pid | ||
24 | |||
25 | ENABLED=true | ||
26 | |||
27 | if test -f /etc/default/nova-consoleproxy; then | ||
28 | . /etc/default/nova-consoleproxy | ||
29 | fi | ||
30 | |||
31 | if ! [ "${NOVA_CONSOLE_PROXY_TYPE}" = "spicehtml5" ] ; then | ||
32 | exit 0 | ||
33 | fi | ||
34 | |||
35 | mkdir -p /var/run/nova | ||
36 | chown nova:root /var/run/nova/ | ||
37 | |||
38 | mkdir -p /var/lock/nova | ||
39 | chown nova:root /var/lock/nova/ | ||
40 | |||
41 | . /lib/lsb/init-functions | ||
42 | |||
43 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | ||
44 | export TMPDIR=/var/lib/nova/tmp | ||
45 | |||
46 | if ! [ -x ${DAEMON} ] ; then | ||
47 | exit 0 | ||
48 | fi | ||
49 | |||
50 | status() | ||
51 | { | ||
52 | pid=`cat $PIDFILE 2>/dev/null` | ||
53 | if [ -n "$pid" ]; then | ||
54 | if ps -p $pid >&- ; then | ||
55 | echo "$DESC is running" | ||
56 | return | ||
57 | fi | ||
58 | fi | ||
59 | echo "$DESC is not running" | ||
60 | } | ||
61 | |||
62 | case "$1" in | ||
63 | start) | ||
64 | test "$ENABLED" = "true" || exit 0 | ||
65 | echo "Starting $DESC" "$NAME" | ||
66 | start-stop-daemon --start -b -m --pidfile $PIDFILE --exec ${DAEMON} -- ${DAEMON_ARGS} | ||
67 | log_end_msg $? | ||
68 | ;; | ||
69 | stop) | ||
70 | test "$ENABLED" = "true" || exit 0 | ||
71 | echo "Stopping $DESC" "$NAME" | ||
72 | start-stop-daemon --stop --oknodo --pidfile ${PIDFILE} | ||
73 | log_end_msg $? | ||
74 | ;; | ||
75 | restart|force-reload|reload) | ||
76 | test "$ENABLED" = "true" || exit 1 | ||
77 | $0 stop | ||
78 | sleep 1 | ||
79 | $0 start | ||
80 | ;; | ||
81 | status) | ||
82 | test "$ENABLED" = "true" || exit 0 | ||
83 | status | ||
84 | ;; | ||
85 | *) | ||
86 | echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status|reload|status}" | ||
87 | exit 1 | ||
88 | ;; | ||
89 | esac | ||
90 | |||
91 | exit 0 | ||