[Ovirt-devel] [PATCH] Changes the start/stop/reload method names for sysvinit scripts.

Darryl L. Pierce dpierce at redhat.com
Thu Mar 11 18:45:13 UTC 2010


To avoid possibly invoking similarly named executables, all start, stop
and reload methods in the sysvinit scripts have been renamed to
start_/stop_/reload_[script name].

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt           |   17 +++++++++++------
 scripts/ovirt-awake     |   20 +++++++++++++++++++-
 scripts/ovirt-early     |   16 ++++++++++------
 scripts/ovirt-firstboot |   28 ++++++++++++++++++----------
 scripts/ovirt-post      |   16 ++++++++++------
 5 files changed, 68 insertions(+), 29 deletions(-)

diff --git a/scripts/ovirt b/scripts/ovirt
index 752564a..ef00f02 100755
--- a/scripts/ovirt
+++ b/scripts/ovirt
@@ -71,7 +71,7 @@ ovirt_start() {
     fi
 }
 
-start() {
+start_ovirt () {
     touch $VAR_SUBSYS_OVIRT
     case $OVIRT_RUNTIME_MODE in
         "ovirt")
@@ -90,18 +90,24 @@ start() {
     return $RC
 }
 
-stop() {
+stop_ovirt () {
     echo -n "Stopping ovirt: "
+    rm -f $VAR_SUBSYS_OVIRT
     success
 }
 
+reload_ovirt () {
+        stop_ovirt
+        start_ovirt
+}
+
 case "$1" in
     start)
         [ -f "$VAR_SUBSYS_OVIRT" ] && exit 0
         echo -n "Starting ovirt: "
         {
             log "Starting ovirt"
-            start
+            start_ovirt
             log "Completed ovirt"
         } >> $OVIRT_LOGFILE 2>&1
         test $? == 0 && success || failure
@@ -110,11 +116,10 @@ case "$1" in
         status $prog
         ;;
     reload)
-        stop
-        start
+        reload_ovirt
         ;;
     stop)
-        rm -f /var/lock/subsys/ovirt
+        stop_ovirt
         ;;
     *)
         echo "Usage: ovirt {start}"
diff --git a/scripts/ovirt-awake b/scripts/ovirt-awake
index bd50ffd..d5865c5 100755
--- a/scripts/ovirt-awake
+++ b/scripts/ovirt-awake
@@ -103,7 +103,7 @@ ovirt_startup () {
 # Override this method to provide support for notifying a management
 # system that the node has started and will be available after
 # system initialization
-start () {
+start_ovirt_awake () {
     local RC=0
 
     touch $VAR_SUBSYS_NODECONFIG
@@ -131,6 +131,16 @@ start () {
     return $RC
 }
 
+stop_ovirt_awake () {
+    echo -n "Stopping ovirt-awake: "
+    success
+}
+
+reload_ovirt_awake () {
+    stop_ovirt_awake
+    start_ovirt_awake
+}
+
 case "$1" in
     start)
         echo -n "Starting ovirt-awake: "
@@ -143,6 +153,14 @@ case "$1" in
         test $RETVAL == 0 && success || failure
         ;;
 
+    stop)
+        stop_ovirt_awake
+        ;;
+
+    reload)
+        reload_ovirt_awake
+        ;;
+
     *)
         echo "Usage: $0 start"
         RETVAL=2
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 1ab0578..88070e3 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -172,7 +172,7 @@ configure_management_interface() {
     esac
 }
 
-start() {
+start_ovirt_early () {
     touch $VAR_SUBSYS_OVIRT_EARLY
     # oVirt boot parameters
     #   BOOTIF=link|eth*|<MAC> (appended by pxelinux)
@@ -511,18 +511,23 @@ EOF
     return 0
 }
 
-stop() {
+stop_ovirt_early () {
     echo -n "Stopping ovirt-early: "
     success
 }
 
+reload_ovirt_early () {
+    stop_ovirt_early
+    start_ovirt_early
+}
+
 case "$1" in
     start)
         [ -f "$VAR_SUBSYS_NODE_CONFIG" ] && exit 0
         echo -n "Starting ovirt-early: "
         {
             log "Starting ovirt-early"
-            start
+            start_ovirt_early
             log "Completed ovirt-early"
             RETVAL=$?
         } >> $OVIRT_LOGFILE 2>&1
@@ -532,11 +537,10 @@ case "$1" in
         status $prog
         ;;
     reload)
-        stop
-        start
+        reload_ovirt_early
         ;;
     stop)
-        stop
+        stop_ovirt_early
         ;;
     *)
         echo "Usage: ovirt-early {start}"
diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot
index 7717a50..89a2c2b 100755
--- a/scripts/ovirt-firstboot
+++ b/scripts/ovirt-firstboot
@@ -28,18 +28,18 @@
 . /usr/libexec/ovirt-functions
 
 prog=ovirt-firstboot
-lockfile=/var/lock/subsys/$prog
+VAR_SUBSYS_OVIRT_FIRSTBOOT=/var/lock/subsys/$prog
 
 trap '__st=$?; stop_log; exit $__st' 0
 trap 'exit $?' 1 2 13 15
 
-start ()
+start_ovirt_firstboot ()
 {
     if ! is_firstboot && ! is_auto_install && ! is_upgrade; then
         return
     fi
-	
-	touch $lockfile
+
+    touch $VAR_SUBSYS_OVIRT_FIRSTBOOT
 
     # by default in standalone, disable collectd until server is configured
     service collectd stop > /dev/null 2>&1
@@ -74,7 +74,17 @@ start ()
 
     ovirt_store_firstboot_config >> $OVIRT_LOGFILE 2>&1
 
-    rm -f $lockfile
+    rm -f $VAR_SUBSYS_OVIRT_FIRSTBOOT
+}
+
+stop_ovirt_firstboot () {
+    echo -n "Stopping ovirt-firstboot: "
+    success
+}
+
+reload_ovirt_firstboot () {
+    stop_ovirt_firstboot
+    start_ovirt_firstboot
 }
 
 case "$1" in
@@ -85,7 +95,7 @@ case "$1" in
 
         printf "Starting ovirt-firstboot: "
 
-        start
+        start_ovirt_firstboot
 
         test $? == 0 && success || failure
         echo
@@ -94,14 +104,12 @@ case "$1" in
         status $prog
         ;;
     reload)
-        stop
-        start
+        reload_ovirt_firstboot
         ;;
     stop)
-         rm -f /var/lock/subsys/ovirt-firstboot
+        stop_ovirt_firstboot
         ;;
     *)
         echo "Usage: ovirt-firstboot {start}"
         exit 2
 esac
-
diff --git a/scripts/ovirt-post b/scripts/ovirt-post
index f53157a..d0d1d20 100755
--- a/scripts/ovirt-post
+++ b/scripts/ovirt-post
@@ -19,7 +19,7 @@ VAR_SUBSYS_OVIRT_POST=/var/lock/subsys/$prog
 # load the configuration file
 [ -f "$NODE_CONFIG" ] && . "$NODE_CONFIG"
 
-start() {
+start_ovirt_post() {
     # wait for libvirt to finish initializing
     local count=0
     while true; do
@@ -80,11 +80,16 @@ start() {
     rm -f $VAR_SUBSYS_OVIRT_POST
 }
 
-stop() {
+stop_ovirt_post () {
     echo -n "Stopping ovirt-post: "
     success
 }
 
+reload_ovirt_post () {
+    stop_ovirt_post
+    start_ovirt_post
+}
+
 case "$1" in
     start)
         [ -f "$VAR_SUBSYS_OVIRT_POST" ] && exit 0
@@ -92,7 +97,7 @@ case "$1" in
 
         {
             log "Starting ovirt-post"
-            start
+            start_ovirt_post
             log "Completed ovirt-post"
         } >> $OVIRT_LOGFILE 2>&1
 
@@ -103,11 +108,10 @@ case "$1" in
         status $prog
         ;;
     reload)
-        stop
-        start
+        reload_ovirt_post
         ;;
     stop)
-        rm -f /var/lock/subsys/ovirt-post
+        stop_ovirt_post
         ;;
     *)
         echo "Usage: ovirt-post {start}"
-- 
1.6.6.1




More information about the ovirt-devel mailing list