cluster_name="@@CLUSTER@@"
mountpoint="@@CLUSTERFS_DEFAULT_MOUNTPOINT@@"
nodes_storage_gpfs="@@NODES_STORAGE_GPFS@@"
+shared_disk_ids="@@SHARED_DISK_IDS@@"
dir=$(dirname "$0")
echo
echo "Setting up NSDs"
- _idfile="${dir}/shared_disk_ids.${cluster_name}"
- if [ ! -r "$_idfile" ] ; then
- echo "ERROR: missing disk ID file \"${_idfile}\""
- exit 1
- fi
-
# Create an extended regexp that matches any of the IDs
- pat=$(tr '\n' '|' <"$_idfile" | sed -e 's@|$@@')
+ pat=$(echo "$shared_disk_ids" | sed -e 's@ *@|@g')
# Now get devices and names from multipath
multipath -dl |
for SHARED_DISK_NUM in $(seq 1 $SHAREDDISK_COUNT) ; do
local DISK="${VIRTBASE}/${CLUSTER}/shared${SHARED_DISK_NUM}"
run_hooks hack_disk_hooks "shared"
- local serial=$(sed -n "${SHARED_DISK_NUM}p" "$shared_disk_ids")
+ local serial=$(awk "{ print \$${SHARED_DISK_NUM} }" <<<"$SHARED_DISK_IDS")
for p in $(seq 1 $paths) ; do
local dev="${devices[$n]}"
[ -n "$dev" ] || die "Too many shared disks! The function shared_disk_template needs to be hacked to allow more shared disks..."
shared_disk_setup ()
{
- shared_disk_ids="tmp/shared_disk_ids.${CLUSTER}"
- rm -f "$shared_disk_ids"
+ SHARED_DISK_IDS=""
# Early exit if no shared disks
have_shared_disks || return 0
# setup a nice ID at the start of the disk
"$SHARED_DISK_ID_GEN" "$SHARED_DISK_NUM" > tmp/diskid
dd if=tmp/diskid of="$di" conv=notrunc bs=1 > /dev/null 2>&1
- head -n 1 tmp/diskid >>"$shared_disk_ids"
+ local this_id=$(head -n 1 tmp/diskid)
+ SHARED_DISK_IDS="${SHARED_DISK_IDS}${SHARED_DISK_IDS:+ }${this_id}"
done
echo
echo "${t:0:13}"
}
-install_shared_disk_ids ()
-{
- if [ -r "$shared_disk_ids" ] ; then
- local t="/root/scripts/${shared_disk_ids##*/}"
- echo "Installing shared disk ID file \"${t}\""
- diskimage mkdir_p "/root/scripts"
- diskimage put "$shared_disk_ids" "$t"
- fi
-}
-
shared_disk_setup_base ()
{
_SHARED_DISK_TEMPLATE=""
node_has_shared_disks "$type" || return 0
- install_shared_disk_ids
-
if [ "$SHARED_DISK_TYPE" = "iscsi" ] ; then
shared_disk_iscsi_setup_base
else