mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Extending the current functionality of KVM Host HA for the StorPool storage plugin and the option for easy integration for the rest of the storage plugins to support Host HA This extension works like the current NFS storage implementation. It allows it to be used simultaneously with NFS and StorPool storage or only with StorPool primary storage. If it is used with different primary storages like NFS and StorPool, and one of the health checks fails for storage, there is an option to report the failure to the management with the global config kvm.ha.fence.on.storage.heartbeat.failure. By default this option is disabled when enabled the Host HA service will continue with the checks on the host and eventually will fence the host
67 lines
1.5 KiB
Bash
Executable File
67 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
help() {
|
|
printf "Usage: $0
|
|
-c cleanup"
|
|
exit 1
|
|
}
|
|
#set -x
|
|
cflag=0
|
|
|
|
while getopts 'c' OPTION
|
|
do
|
|
case $OPTION in
|
|
c)
|
|
cflag=1
|
|
;;
|
|
*)
|
|
help
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
#delete VMs on this mountpoint
|
|
deleteVMs() {
|
|
vmPids=$(ps aux| grep qemu | grep 'storpool-byid' | awk '{print $2}' 2> /dev/null)
|
|
if [ $? -gt 0 ]
|
|
then
|
|
return
|
|
fi
|
|
|
|
if [ -z "$vmPids" ]
|
|
then
|
|
return
|
|
fi
|
|
|
|
for pid in $vmPids
|
|
do
|
|
kill -9 $pid &> /dev/null
|
|
done
|
|
}
|
|
|
|
if [ "$cflag" == "1" ]
|
|
then
|
|
/usr/bin/logger -t heartbeat "kvmspheartbeat.sh will reboot system because it was unable to write the heartbeat to the storage."
|
|
sync &
|
|
sleep 5
|
|
echo b > /proc/sysrq-trigger
|
|
exit $?
|
|
fi
|