1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-14 19:24:10 +03:00

feature-2262: Make iscsi drivers use incremental xpath structure

This commit is contained in:
Jaime Melis 2013-08-09 12:00:48 -04:00
parent 5e8f9f050c
commit c66d605fe8
9 changed files with 51 additions and 51 deletions

View File

@ -40,7 +40,7 @@ ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
@ -53,14 +53,14 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
/DS_DRIVER_ACTION_DATA/IMAGE/PATH \
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
BASE_PATH="${XPATH_ELEMENTS[0]}"
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}"
SAFE_DIRS="${XPATH_ELEMENTS[2]}"
DST_HOST="${XPATH_ELEMENTS[3]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[4]:-$VG_NAME}"
BASE_IQN="${XPATH_ELEMENTS[5]:-$BASE_IQN}"
SRC="${XPATH_ELEMENTS[6]}"
SIZE="${XPATH_ELEMENTS[7]}"
BASE_PATH="${XPATH_ELEMENTS[j++]}"
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}"
SRC="${XPATH_ELEMENTS[j++]}"
SIZE="${XPATH_ELEMENTS[j++]}"
# Check if 'TGTSETUPLUN' is installed
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"

View File

@ -44,7 +44,7 @@ UTILS_PATH="${DRIVER_PATH}/.."
XPATH="$UTILS_PATH/xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
@ -61,18 +61,18 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/LIMIT_TRANSFER_BW)
BASE_PATH="${XPATH_ELEMENTS[0]}"
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}"
SAFE_DIRS="${XPATH_ELEMENTS[2]}"
DST_HOST="${XPATH_ELEMENTS[3]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[4]:-$VG_NAME}"
BASE_IQN="${XPATH_ELEMENTS[5]:-$BASE_IQN}"
SRC="${XPATH_ELEMENTS[6]}"
SIZE="${XPATH_ELEMENTS[7]}"
MD5="${XPATH_ELEMENTS[8]}"
SHA1="${XPATH_ELEMENTS[9]}"
NO_DECOMPRESS="${XPATH_ELEMENTS[10]}"
LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[11]}"
BASE_PATH="${XPATH_ELEMENTS[j++]}"
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}"
SRC="${XPATH_ELEMENTS[j++]}"
SIZE="${XPATH_ELEMENTS[j++]}"
MD5="${XPATH_ELEMENTS[j++]}"
SHA1="${XPATH_ELEMENTS[j++]}"
NO_DECOMPRESS="${XPATH_ELEMENTS[j++]}"
LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[j++]}"
# Check if 'TGTSETUPLUN' is installed
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"

View File

@ -42,7 +42,7 @@ ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
@ -55,14 +55,14 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
BASE_PATH="${XPATH_ELEMENTS[0]}"
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}"
SAFE_DIRS="${XPATH_ELEMENTS[2]}"
DST_HOST="${XPATH_ELEMENTS[3]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[4]:-$VG_NAME}"
BASE_IQN="${XPATH_ELEMENTS[5]:-$BASE_IQN}"
FSTYPE="${XPATH_ELEMENTS[6]}"
SIZE="${XPATH_ELEMENTS[7]:-0}"
BASE_PATH="${XPATH_ELEMENTS[j++]}"
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}"
FSTYPE="${XPATH_ELEMENTS[j++]}"
SIZE="${XPATH_ELEMENTS[j++]:-0}"
# Check if 'TGTSETUPLUN' is installed
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"

View File

@ -41,15 +41,15 @@ ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME)
HOST="${XPATH_ELEMENTS[0]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[1]-$VG_NAME}"
HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
VG_NAME="${XPATH_ELEMENTS[j++]-$VG_NAME}"
# ------------ Compute datastore usage -------------

View File

@ -40,15 +40,15 @@ ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST)
SRC="${XPATH_ELEMENTS[0]}"
DST_HOST="${XPATH_ELEMENTS[1]:-$HOST}"
SRC="${XPATH_ELEMENTS[j++]}"
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
BASE_IQN=`echo $SRC|$CUT -d: -f1`
TARGET=`echo $SRC|$CUT -d: -f2`

View File

@ -53,7 +53,7 @@ DISK_ID=$(echo $SRC|awk -F. '{print $NF}')
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
@ -62,9 +62,9 @@ done < <(onevm show -x $VMID| $XPATH \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SAVE_AS \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
IQN="${XPATH_ELEMENTS[0]}"
SAVE_AS="${XPATH_ELEMENTS[1]}"
PERSISTENT="${XPATH_ELEMENTS[2]}"
IQN="${XPATH_ELEMENTS[j++]}"
SAVE_AS="${XPATH_ELEMENTS[j++]}"
PERSISTENT="${XPATH_ELEMENTS[j++]}"
if [ -z "$PERSISTENT" ]; then
IQN=$IQN-$VMID

View File

@ -54,7 +54,7 @@ DISK_ID=$(echo "$DST_PATH" | $AWK -F. '{print $NF}')
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
@ -62,8 +62,8 @@ done < <(onevm show -x $VMID| $XPATH \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SOURCE \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
IQN="${XPATH_ELEMENTS[0]}"
PERSISTENT="${XPATH_ELEMENTS[1]}"
IQN="${XPATH_ELEMENTS[j++]}"
PERSISTENT="${XPATH_ELEMENTS[j++]}"
if [ -z "$PERSISTENT" ]; then
NEW_IQN=$IQN-$VMID

View File

@ -76,7 +76,7 @@ fi
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
DISK_ID=$(echo "$SRC_PATH" | $AWK -F. '{print $NF}')
@ -86,8 +86,8 @@ done < <(onevm show -x $VMID| $XPATH \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SOURCE \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
IQN="${XPATH_ELEMENTS[0]}"
PERSISTENT="${XPATH_ELEMENTS[1]}"
IQN="${XPATH_ELEMENTS[j++]}"
PERSISTENT="${XPATH_ELEMENTS[j++]}"
if [ -z "$PERSISTENT" ]; then
IQN=$IQN-$VMID

View File

@ -53,7 +53,7 @@ DISK_ID=$(echo $SRC|awk -F. '{print $NF}')
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
unset i XPATH_ELEMENTS
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
@ -62,9 +62,9 @@ done < <(onevm show -x $VMID| $XPATH \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SAVE_AS \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
IQN="${XPATH_ELEMENTS[0]}"
SAVE_AS="${XPATH_ELEMENTS[1]}"
PERSISTENT="${XPATH_ELEMENTS[2]}"
IQN="${XPATH_ELEMENTS[j++]}"
SAVE_AS="${XPATH_ELEMENTS[j++]}"
PERSISTENT="${XPATH_ELEMENTS[j++]}"
if [ -z "$PERSISTENT" ]; then
IQN=$IQN-$VMID