diff --git a/scripts/vm/hypervisor/xenserver/setup_heartbeat_sr.sh b/scripts/vm/hypervisor/xenserver/setup_heartbeat_sr.sh index 5d70cd30761..e42a33d7ca8 100755 --- a/scripts/vm/hypervisor/xenserver/setup_heartbeat_sr.sh +++ b/scripts/vm/hypervisor/xenserver/setup_heartbeat_sr.sh @@ -6,9 +6,9 @@ # 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 @@ -17,7 +17,7 @@ # under the License. #set -x - + usage() { echo "Usage: $(basename $0) [uuid of this host] [uuid of the sr to place the heartbeat]" @@ -40,7 +40,7 @@ if [ `xe host-list | grep $1 | wc -l` -ne 1 ]; then exit 0 fi -if [ `xe sr-list uuid=$2 | wc -l` -eq 0 ]; then +if [ `xe sr-list uuid=$2 | wc -l` -eq 0 ]; then echo "#4# Unable to find SR with uuid: $2" exit 0 fi @@ -60,7 +60,7 @@ if [ "$srtype" == "nfs" ];then date=`date +%s` echo "$date" > $filename fi -else +else dir=/dev/VG_XenStorage-$2 link=$dir/hb-$1 lv=`lvscan | grep $link` @@ -72,7 +72,7 @@ else fi rm $link -f fi - if [ -f /etc/redhat-release ] && grep -q "XenServer release 7." /etc/redhat-release; then + if [ -f /etc/redhat-release ] && grep -q -E "(XenServer|XCP-ng) release (7|8)." /etc/redhat-release; then lvcreate VG_XenStorage-$2 -n hb-$1 --size 4M --config global{metadata_read_only=0} else lvcreate VG_XenStorage-$2 -n hb-$1 --size 4M