File tree Expand file tree Collapse file tree
agent/src/com/cloud/agent/resource/computing
scripts/vm/hypervisor/kvm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,13 @@ public void run() {
7575 cmd .add ("-h" , _hostIP );
7676 String result = cmd .execute ();
7777 if (result != null ) {
78- s_logger .debug ("write heartbeat failed: " + result );
78+ s_logger .debug ("write heartbeat failed: " + result + "; destroy all the vms on this host" );
79+ cmd = new Script (_heartBeatPath , _heartBeatUpdateTimeout , s_logger );
80+ cmd .add ("-i" , primaryStoragePool ._poolIp );
81+ cmd .add ("-p" , primaryStoragePool ._poolMountSourcePath );
82+ cmd .add ("-m" , primaryStoragePool ._mountDestPath );
83+ cmd .add ("-c" );
84+ result = cmd .execute ();
7985 }
8086 }
8187 }
Original file line number Diff line number Diff line change 6464 <adapters key =" com.cloud.ha.Investigator" >
6565 <adapter name =" SimpleInvestigator" class =" com.cloud.ha.CheckOnAgentInvestigator" />
6666 <adapter name =" PingInvestigator" class =" com.cloud.ha.InvestigatorImpl" />
67+ <adapter name =" XenServerInvestigator" class =" com.cloud.ha.XenServerInvestigator" />
6768 </adapters >
6869 <adapters key =" com.cloud.ha.FenceBuilder" >
6970 <adapter name =" XenServerFenceBuilder" class =" com.cloud.ha.XenServerFencer" />
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ help() {
2424 -m mount point
2525 -h host
2626 -r write/read hb log
27+ -c cleanup
2728 -t interval between read hb log\n"
2829 exit 1
2930}
@@ -34,8 +35,9 @@ MountPoint=
3435HostIP=
3536interval=
3637rflag=0
38+ cflag=0
3739
38- while getopts ' i:p:m:h:t:r ' OPTION
40+ while getopts ' i:p:m:h:t:rc ' OPTION
3941do
4042 case $OPTION in
4143 i)
5658 t)
5759 interval=" $OPTARG "
5860 ;;
61+ c)
62+ cflag=1
63+ ;;
5964 * )
6065 help
6166 ;;
7176# delete VMs on this mountpoint
7277deleteVMs () {
7378 local mountPoint=$1
74- vmPids=$( ps aux| grep qemu | grep $mountPoint * | awk ' {print $2}' & > /dev/null)
79+ vmPids=$( ps aux| grep qemu | grep " $mountPoint " | awk ' {print $2}' 2 > /dev/null)
7580 if [ $? -gt 0 ]
7681 then
7782 return
@@ -82,7 +87,7 @@ deleteVMs() {
8287 return
8388 fi
8489
85- for pid in vmPids
90+ for pid in $ vmPids
8691 do
8792 kill -9 $pid & > /dev/null
8893 done
@@ -149,6 +154,10 @@ then
149154 echo " =====> DEAD <======"
150155 fi
151156 exit 0
157+ elif [ " $cflag " == " 1" ]
158+ then
159+ reboot
160+ exit $?
152161else
153162 write_hbLog
154163 exit $?
You can’t perform that action at this time.
0 commit comments