xenserver: add support for XCP-ng 7/8 to create it's heartbeat LVM properly (#4109)

/opt/cloud/bin/setup_heartbeat_sr.sh line 75 tests for “XenServer release 7.” in /etc/redhat-release which contains “XCP-ng release 8.0.0 (xenenterprise)” in my case so the lvcreate statement doesn’t contain the required options

Fixes: #3281

Co-authored-by: Ian Service <ian@service.to>
This commit is contained in:
ServiceTo 2020-06-11 08:00:16 -04:00 committed by GitHub
parent f4f238e18e
commit e02801bf00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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