[node-patches] Change in ovirt-node[master]: add ovirt-kdump service wrapper to prevent confusing errors

jboggs at redhat.com jboggs at redhat.com
Thu Jun 20 15:07:30 UTC 2013


Joey Boggs has uploaded a new change for review.

Change subject: add ovirt-kdump service wrapper to prevent confusing errors
......................................................................

add ovirt-kdump service wrapper to prevent confusing errors

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=976446
Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: Ie9e362bb9ee0f96a73ca459987bf8523848ed9e6
---
M ovirt-node.spec.in
M recipe/ovirt17-install.ks
M recipe/ovirt17-post.ks
M scripts/ovirt-init-functions.sh.in
M services/Makefile.am
A services/init.d/ovirt-kdump
A services/ovirt-kdump.service
7 files changed, 91 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/62/15962/1

diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index a9cd42f..576e8e6 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -327,6 +327,7 @@
 /sbin/chkconfig --add ovirt-firstboot
 /sbin/chkconfig --add ovirt
 /sbin/chkconfig --add ovirt-post
+/sbin/chkconfig --add ovirt-kdump
 %else
 if [ $1 -eq 1 ] ; then
     # Initial installation
@@ -531,12 +532,14 @@
 %{_unitdir}/ovirt-firstboot.service
 %{_unitdir}/ovirt-post.service
 %{_unitdir}/ovirt-early.service
+%{_unitdir}/ovirt-kdump.service
 %else
 %{_initrddir}/ovirt-awake
 %{_initrddir}/ovirt-early
 %{_initrddir}/ovirt-firstboot
 %{_initrddir}/ovirt
 %{_initrddir}/ovirt-post
+%{_initrddir}/ovirt-kdump
 %endif
 # Files related to the new TUI
 %{python_sitelib}/ovirt/__init__.py*
diff --git a/recipe/ovirt17-install.ks b/recipe/ovirt17-install.ks
index e73fc88..6b59f35 100644
--- a/recipe/ovirt17-install.ks
+++ b/recipe/ovirt17-install.ks
@@ -1 +1 @@
-services --enabled=auditd,ntpd,ntpdate,iptables,network,rsyslog,multipathd,snmpd,ovirt-early,ovirt,ovirt-post,ovirt-cim,anyterm,collectd,libvirtd,cgconfig
+services --enabled=auditd,ntpd,ntpdate,iptables,network,rsyslog,multipathd,snmpd,ovirt-early,ovirt,ovirt-post,ovirt-cim,ovirt-kdump,anyterm,collectd,libvirtd,cgconfig --disabled=kdump
diff --git a/recipe/ovirt17-post.ks b/recipe/ovirt17-post.ks
index e009ab6..9786e63 100644
--- a/recipe/ovirt17-post.ks
+++ b/recipe/ovirt17-post.ks
@@ -27,6 +27,8 @@
 rm -rf /etc/systemd/system/default.target
 ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
 systemctl enable ovirt-firstboot.service >/dev/null 2>&1
+systemctl enable ovirt-kdump.service >/dev/null 2>&1
+#systemctl disable kdump.service >/dev/null 2>&1
 
 echo "Configuring IPTables"
 # here, we need to punch the appropriate holes in the firewall
diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index cd75d3e..22d25b0 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -32,6 +32,7 @@
 VAR_SUBSYS_NODECONFIG=/var/lock/subsys/node-config
 VAR_SUBSYS_OVIRT_POST=/var/lock/subsys/ovirt-post
 VAR_SUBSYS_OVIRT_CIM=/var/lock/subsys/ovirt-cim
+VAR_SUBSYS_OVIRT_KDUMO=/var/lock/subsys/ovirt-kdump
 VAR_SUBSYS_OVIRT=/var/lock/subsys/ovirt
 
 BONDING_MODCONF_FILE=/etc/modprobe.d/bonding
@@ -1326,7 +1327,37 @@
     return $?
 }
 
+start_ovirt_kdump () {
+    [ -f "$VAR_SUBSYS_OVIRT_cim" ] && exit 0
+    {
+        log "Starting ovirt-kdump service"
 
+        touch $VAR_SUBSYS_OVIRT_KDUMP
+
+        if is_persisted /etc/kdump.conf; then
+            service kdump start
+        fi
+
+        rm -f $VAR_SUBSYS_OVIRT_KDUMP
+
+        log "Completed ovirt-kdump"
+    } >> $OVIRT_LOGFILE 2>&1
+}
+
+stop_ovirt_kdump () {
+    {
+        log "Stopping ovirt-kdump"
+        if service kdump status >/dev/null; then
+            service kdump stop
+        fi
+        log "Stopped ovirt-kdump"
+    } >> $OVIRT_LOGFILE 2>&1
+}
+
+status_ovirt_kdump () {
+    service kdump status > /dev/null 2>&1
+    return $?
+}
 
 #
 # If called with a param from .service file:
diff --git a/services/Makefile.am b/services/Makefile.am
index abb5fe1..1dec6e0 100644
--- a/services/Makefile.am
+++ b/services/Makefile.am
@@ -26,11 +26,13 @@
   ovirt-post.service \
   ovirt-firstboot.service \
   ovirt-cim.service \
+  ovirt-kdump.service \
   ovirt-node-igor-slave.service
 else
 dist_initd_SCRIPTS = \
   init.d/ovirt-awake \
   init.d/ovirt-early \
+  init.d/ovirt-kdump \
   init.d/ovirt \
   init.d/ovirt-post \
   init.d/ovirt-firstboot \
diff --git a/services/init.d/ovirt-kdump b/services/init.d/ovirt-kdump
new file mode 100755
index 0000000..c067b72
--- /dev/null
+++ b/services/init.d/ovirt-kdump
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# ovirt-kdump Start ovirt-kdump services
+#
+### BEGIN INIT INFO
+# Provides: ovirt-kdump
+# Required-Start: ovirt
+# Default-Start: 2 3 4 5
+# Description: Performs managed node configuration functions.
+### END INIT INFO
+
+# Source functions library
+. /usr/libexec/ovirt-init-functions.sh
+
+prog=ovirt-kdump
+
+case "$1" in
+    start)
+        echo -n "Starting ovirt-kdump: "
+        start_ovirt_kdump
+        test $? == 0 && success || failure
+        echo
+        ;;
+    status)
+        status -l $prog
+        ;;
+    reload)
+        reload_ovirt
+        ;;
+    stop)
+        echo -n "Stopping ovirt-kdump: "
+        stop_ovirt_kdump
+        success
+        echo
+        ;;
+    *)
+        echo "Usage: ovirt-kdump {start}"
+        exit 2
+esac
diff --git a/services/ovirt-kdump.service b/services/ovirt-kdump.service
new file mode 100644
index 0000000..68d3142
--- /dev/null
+++ b/services/ovirt-kdump.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=oVirt Node kdump service
+After=network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/libexec/ovirt-init-functions.sh start_ovirt_kdump
+ExecStop=/usr/libexec/ovirt-init-functions.sh stop_ovirt_kdump
+
+[Install]
+WantedBy=multi-user.target
+


-- 
To view, visit http://gerrit.ovirt.org/15962
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9e362bb9ee0f96a73ca459987bf8523848ed9e6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list