
florian.haas at linbit
Aug 10, 2009, 8:48 AM
Post #1 of 1
(457 views)
Permalink
|
|
[PATCH 1 of 2] Low: RA: VirtualDomain: stop wasting time unnecessarily
|
|
# HG changeset patch # User Florian Haas <florian.haas [at] linbit> # Date 1249911933 -7200 # Node ID ed7c50f07c92f30484008f6d8a7ccbd24261b06b # Parent 45bb33149bf52c8433eb5e6ce5546651cea18195 Low: RA: VirtualDomain: stop wasting time unnecessarily Remove a few useless unconditional invocations of sleep. diff -r 45bb33149bf5 -r ed7c50f07c92 heartbeat/VirtualDomain --- a/heartbeat/VirtualDomain Wed Aug 05 08:50:14 2009 +0200 +++ b/heartbeat/VirtualDomain Mon Aug 10 15:45:33 2009 +0200 @@ -150,13 +150,13 @@ # whenever virsh can't reliably obtain the domain # state. ocf_log info "Virtual domain $DOMAIN_NAME currently has no state, retrying." + sleep 1 ;; *) # any other output is unexpected. ocf_log error "Virtual domain $DOMAIN_NAME has unknown status \"$status\"!" ;; esac - sleep 1 done return $rc } @@ -173,10 +173,11 @@ ocf_log error "Failed to start virtual domain ${DOMAIN_NAME}." return $OCF_ERR_GENERIC fi - - while sleep 1; do - VirtualDomain_Monitor && return $OCF_SUCCESS + + while ! VirtualDomain_Monitor; do + sleep 1 done + return $OCF_SUCCESS } VirtualDomain_Stop() { @@ -190,12 +191,10 @@ ;; esac virsh $VIRSH_OPTIONS $op ${DOMAIN_NAME} - while sleep 1; do - VirtualDomain_Status - if [ $? -eq $OCF_NOT_RUNNING ]; then - return $OCF_SUCCESS - fi + while VirtualDomain_Status; do + sleep 1 done + return $OCF_SUCCESS else ocf_log info "Domain $DOMAIN_NAME already stopped." return $OCF_SUCCESS @@ -237,8 +236,8 @@ } VirtualDomain_Migrate_From() { - while sleep 1; do - VirtualDomain_Monitor && break + while ! VirtualDomain_Monitor; do + sleep 1 done ocf_log info "$DOMAIN_NAME: live migration from ${OCF_RESKEY_CRM_meta_migrate_source} succeeded." return $OCF_SUCCESS _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev [at] lists http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
|