File nova-compute-init-like.patch of Package openstack-resource-agents

From be8fd820cee394fc9e682823fe30322a60ec4fd6 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@suse.com>
Date: Tue, 2 Feb 2016 23:11:43 +0100
Subject: [PATCH 1/3] NovaCompute: Use startproc/killproc/checkproc

Without this, it seems to just not work at all for me.

Change-Id: I92a6c3a3db45ca1207d3257f5be87df7a9dcc4fd
---
 ocf/NovaCompute | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

Index: openstack-resource-agents-1.0+git.1462794381.3d724a2/ocf/NovaCompute
===================================================================
--- openstack-resource-agents-1.0+git.1462794381.3d724a2.orig/ocf/NovaCompute
+++ openstack-resource-agents-1.0+git.1462794381.3d724a2/ocf/NovaCompute
@@ -197,8 +197,15 @@ nova_start() {
         attrd_updater -p -n evacuate -N ${NOVA_HOST} -D
     fi
 
+    # do not keep pacemaker 0026 umask; this breaks things as nova-compute
+    # needs to be able to read files from qemu/kvm that it will create
+    umask 0022
+    # $RUNDIR can be tmpfs, thus we have to create/own it here
+    mkdir -m 0700 -p /var/run/nova && chown nova. /var/run/nova
+
     export LIBGUESTFS_ATTACH_METHOD=appliance
-    su nova -s /bin/sh -c /usr/bin/nova-compute &
+#    su nova -s /bin/sh -c /usr/bin/nova-compute &
+    /sbin/startproc -q -s -u nova /usr/bin/nova-compute --config-file=/etc/nova/nova.conf
 
     rc=$OCF_NOT_RUNNING
     ocf_log info "Waiting for nova to start"
@@ -211,22 +218,25 @@ nova_start() {
 }
 
 nova_stop() {
-    pid=$(nova_pid)
-    if [ "x$pid" != x ]; then
-        su nova -c "kill -TERM $pid" -s /bin/bash
-    fi
+#    pid=$(nova_pid)
+#    if [ "x$pid" != x ]; then
+#        su nova -c "kill -TERM $pid" -s /bin/bash
+#    fi
+    /sbin/killproc /usr/bin/nova-compute
 
-    while [ "x$pid" != x ]; do
+#    while [ "x$pid" != x ]; do
+    while /sbin/checkproc /usr/bin/nova-compute; do
         sleep 1
-        pid=$(nova_pid)
+#        pid=$(nova_pid)
     done
 
     return $OCF_SUCCESS
 }
 
 nova_monitor() {
-    pid=$(nova_pid)
-    if [ "x$pid" != x ]; then
+#    pid=$(nova_pid)
+#    if [ "x$pid" != x ]; then
+    if /sbin/checkproc /usr/bin/nova-compute; then
         ## TEMPORARY disable call to fence_compute to avoid noise on first
         ## first startup due to nova-compute not being fast enough to populate
         ## the db and fence_compute checking if node exists and it's enabled
openSUSE Build Service is sponsored by