mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix domr's file lock
And add more information for domr's file lock
This commit is contained in:
parent
495e9ad113
commit
f98191be5c
@ -24,7 +24,8 @@ getLockFile() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch $__LOCKFILE
|
psline=`ps u $$`
|
||||||
|
echo $psline > $__LOCKFILE
|
||||||
|
|
||||||
for i in `seq 1 $(($__TIMEOUT * 10))`
|
for i in `seq 1 $(($__TIMEOUT * 10))`
|
||||||
do
|
do
|
||||||
@ -43,8 +44,11 @@ getLockFile() {
|
|||||||
if [ $__locked -ne 1 ]
|
if [ $__locked -ne 1 ]
|
||||||
then
|
then
|
||||||
logger -t cloud "fail to acquire the lock $1 for process $0 pid $$ after $__TIMEOUT seconds time out!"
|
logger -t cloud "fail to acquire the lock $1 for process $0 pid $$ after $__TIMEOUT seconds time out!"
|
||||||
|
cmd=`cat $currlock`
|
||||||
|
logger -t cloud "waiting for command: $cmd"
|
||||||
psline=`ps u $$`
|
psline=`ps u $$`
|
||||||
logger -t cloud "Failed job detail: $psline"
|
logger -t cloud "Failed job detail: $psline"
|
||||||
|
rm $__LOCKFILE
|
||||||
fi
|
fi
|
||||||
echo $__locked
|
echo $__locked
|
||||||
}
|
}
|
||||||
|
|||||||
@ -260,7 +260,7 @@ grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
|
|||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
is_redundant=1
|
is_redundant=1
|
||||||
sudo /root/checkrouter.sh|grep "Status: MASTER" > /dev/null 2>&1
|
sudo /root/checkrouter.sh --no-lock|grep "Status: MASTER" > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
is_master=1
|
is_master=1
|
||||||
|
|||||||
@ -2,12 +2,24 @@
|
|||||||
|
|
||||||
source /root/func.sh
|
source /root/func.sh
|
||||||
|
|
||||||
|
nolock=0
|
||||||
|
if [ $# -eq 1 ]
|
||||||
|
then
|
||||||
|
if [ $1 == "--no-lock" ]
|
||||||
|
then
|
||||||
|
nolock=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $nolock -eq 0 ]
|
||||||
|
then
|
||||||
lock="biglock"
|
lock="biglock"
|
||||||
locked=$(getLockFile $lock)
|
locked=$(getLockFile $lock)
|
||||||
if [ "$locked" != "1" ]
|
if [ "$locked" != "1" ]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
bumped="Bumped: NO"
|
bumped="Bumped: NO"
|
||||||
if [ -e /tmp/rrouter_bumped ]
|
if [ -e /tmp/rrouter_bumped ]
|
||||||
@ -21,4 +33,7 @@ then
|
|||||||
echo "$stat&$bumped"
|
echo "$stat&$bumped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $nolock -eq 0 ]
|
||||||
|
then
|
||||||
unlock_exit $? $lock $locked
|
unlock_exit $? $lock $locked
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user