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:
parent
5e8f9f050c
commit
c66d605fe8
@ -40,7 +40,7 @@ ID=$2
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
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/PATH \
|
||||||
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
|
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
|
||||||
|
|
||||||
BASE_PATH="${XPATH_ELEMENTS[0]}"
|
BASE_PATH="${XPATH_ELEMENTS[j++]}"
|
||||||
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}"
|
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||||
SAFE_DIRS="${XPATH_ELEMENTS[2]}"
|
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||||
DST_HOST="${XPATH_ELEMENTS[3]:-$HOST}"
|
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
|
||||||
VG_NAME="${XPATH_ELEMENTS[4]:-$VG_NAME}"
|
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||||
BASE_IQN="${XPATH_ELEMENTS[5]:-$BASE_IQN}"
|
BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}"
|
||||||
SRC="${XPATH_ELEMENTS[6]}"
|
SRC="${XPATH_ELEMENTS[j++]}"
|
||||||
SIZE="${XPATH_ELEMENTS[7]}"
|
SIZE="${XPATH_ELEMENTS[j++]}"
|
||||||
|
|
||||||
# Check if 'TGTSETUPLUN' is installed
|
# Check if 'TGTSETUPLUN' is installed
|
||||||
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"
|
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"
|
||||||
|
@ -44,7 +44,7 @@ UTILS_PATH="${DRIVER_PATH}/.."
|
|||||||
|
|
||||||
XPATH="$UTILS_PATH/xpath.rb -b $DRV_ACTION"
|
XPATH="$UTILS_PATH/xpath.rb -b $DRV_ACTION"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
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/NO_DECOMPRESS \
|
||||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/LIMIT_TRANSFER_BW)
|
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/LIMIT_TRANSFER_BW)
|
||||||
|
|
||||||
BASE_PATH="${XPATH_ELEMENTS[0]}"
|
BASE_PATH="${XPATH_ELEMENTS[j++]}"
|
||||||
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}"
|
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||||
SAFE_DIRS="${XPATH_ELEMENTS[2]}"
|
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||||
DST_HOST="${XPATH_ELEMENTS[3]:-$HOST}"
|
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
|
||||||
VG_NAME="${XPATH_ELEMENTS[4]:-$VG_NAME}"
|
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||||
BASE_IQN="${XPATH_ELEMENTS[5]:-$BASE_IQN}"
|
BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}"
|
||||||
SRC="${XPATH_ELEMENTS[6]}"
|
SRC="${XPATH_ELEMENTS[j++]}"
|
||||||
SIZE="${XPATH_ELEMENTS[7]}"
|
SIZE="${XPATH_ELEMENTS[j++]}"
|
||||||
MD5="${XPATH_ELEMENTS[8]}"
|
MD5="${XPATH_ELEMENTS[j++]}"
|
||||||
SHA1="${XPATH_ELEMENTS[9]}"
|
SHA1="${XPATH_ELEMENTS[j++]}"
|
||||||
NO_DECOMPRESS="${XPATH_ELEMENTS[10]}"
|
NO_DECOMPRESS="${XPATH_ELEMENTS[j++]}"
|
||||||
LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[11]}"
|
LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[j++]}"
|
||||||
|
|
||||||
# Check if 'TGTSETUPLUN' is installed
|
# Check if 'TGTSETUPLUN' is installed
|
||||||
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"
|
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"
|
||||||
|
@ -42,7 +42,7 @@ ID=$2
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
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/FSTYPE \
|
||||||
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
|
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
|
||||||
|
|
||||||
BASE_PATH="${XPATH_ELEMENTS[0]}"
|
BASE_PATH="${XPATH_ELEMENTS[j++]}"
|
||||||
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}"
|
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||||
SAFE_DIRS="${XPATH_ELEMENTS[2]}"
|
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||||
DST_HOST="${XPATH_ELEMENTS[3]:-$HOST}"
|
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
|
||||||
VG_NAME="${XPATH_ELEMENTS[4]:-$VG_NAME}"
|
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||||
BASE_IQN="${XPATH_ELEMENTS[5]:-$BASE_IQN}"
|
BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}"
|
||||||
FSTYPE="${XPATH_ELEMENTS[6]}"
|
FSTYPE="${XPATH_ELEMENTS[j++]}"
|
||||||
SIZE="${XPATH_ELEMENTS[7]:-0}"
|
SIZE="${XPATH_ELEMENTS[j++]:-0}"
|
||||||
|
|
||||||
# Check if 'TGTSETUPLUN' is installed
|
# Check if 'TGTSETUPLUN' is installed
|
||||||
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"
|
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH"
|
||||||
|
@ -41,15 +41,15 @@ ID=$2
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
XPATH_ELEMENTS[i++]="$element"
|
||||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST \
|
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST \
|
||||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME)
|
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME)
|
||||||
|
|
||||||
HOST="${XPATH_ELEMENTS[0]:-$HOST}"
|
HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
|
||||||
VG_NAME="${XPATH_ELEMENTS[1]-$VG_NAME}"
|
VG_NAME="${XPATH_ELEMENTS[j++]-$VG_NAME}"
|
||||||
|
|
||||||
# ------------ Compute datastore usage -------------
|
# ------------ Compute datastore usage -------------
|
||||||
|
|
||||||
|
@ -40,15 +40,15 @@ ID=$2
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
XPATH_ELEMENTS[i++]="$element"
|
||||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \
|
done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \
|
||||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST)
|
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST)
|
||||||
|
|
||||||
SRC="${XPATH_ELEMENTS[0]}"
|
SRC="${XPATH_ELEMENTS[j++]}"
|
||||||
DST_HOST="${XPATH_ELEMENTS[1]:-$HOST}"
|
DST_HOST="${XPATH_ELEMENTS[j++]:-$HOST}"
|
||||||
|
|
||||||
BASE_IQN=`echo $SRC|$CUT -d: -f1`
|
BASE_IQN=`echo $SRC|$CUT -d: -f1`
|
||||||
TARGET=`echo $SRC|$CUT -d: -f2`
|
TARGET=`echo $SRC|$CUT -d: -f2`
|
||||||
|
@ -53,7 +53,7 @@ DISK_ID=$(echo $SRC|awk -F. '{print $NF}')
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
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]/SAVE_AS \
|
||||||
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
||||||
|
|
||||||
IQN="${XPATH_ELEMENTS[0]}"
|
IQN="${XPATH_ELEMENTS[j++]}"
|
||||||
SAVE_AS="${XPATH_ELEMENTS[1]}"
|
SAVE_AS="${XPATH_ELEMENTS[j++]}"
|
||||||
PERSISTENT="${XPATH_ELEMENTS[2]}"
|
PERSISTENT="${XPATH_ELEMENTS[j++]}"
|
||||||
|
|
||||||
if [ -z "$PERSISTENT" ]; then
|
if [ -z "$PERSISTENT" ]; then
|
||||||
IQN=$IQN-$VMID
|
IQN=$IQN-$VMID
|
||||||
|
@ -54,7 +54,7 @@ DISK_ID=$(echo "$DST_PATH" | $AWK -F. '{print $NF}')
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
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]/SOURCE \
|
||||||
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
||||||
|
|
||||||
IQN="${XPATH_ELEMENTS[0]}"
|
IQN="${XPATH_ELEMENTS[j++]}"
|
||||||
PERSISTENT="${XPATH_ELEMENTS[1]}"
|
PERSISTENT="${XPATH_ELEMENTS[j++]}"
|
||||||
|
|
||||||
if [ -z "$PERSISTENT" ]; then
|
if [ -z "$PERSISTENT" ]; then
|
||||||
NEW_IQN=$IQN-$VMID
|
NEW_IQN=$IQN-$VMID
|
||||||
|
@ -76,7 +76,7 @@ fi
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
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}')
|
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]/SOURCE \
|
||||||
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
||||||
|
|
||||||
IQN="${XPATH_ELEMENTS[0]}"
|
IQN="${XPATH_ELEMENTS[j++]}"
|
||||||
PERSISTENT="${XPATH_ELEMENTS[1]}"
|
PERSISTENT="${XPATH_ELEMENTS[j++]}"
|
||||||
|
|
||||||
if [ -z "$PERSISTENT" ]; then
|
if [ -z "$PERSISTENT" ]; then
|
||||||
IQN=$IQN-$VMID
|
IQN=$IQN-$VMID
|
||||||
|
@ -53,7 +53,7 @@ DISK_ID=$(echo $SRC|awk -F. '{print $NF}')
|
|||||||
|
|
||||||
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
|
||||||
|
|
||||||
unset i XPATH_ELEMENTS
|
unset i j XPATH_ELEMENTS
|
||||||
|
|
||||||
while IFS= read -r -d '' element; do
|
while IFS= read -r -d '' element; do
|
||||||
XPATH_ELEMENTS[i++]="$element"
|
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]/SAVE_AS \
|
||||||
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT)
|
||||||
|
|
||||||
IQN="${XPATH_ELEMENTS[0]}"
|
IQN="${XPATH_ELEMENTS[j++]}"
|
||||||
SAVE_AS="${XPATH_ELEMENTS[1]}"
|
SAVE_AS="${XPATH_ELEMENTS[j++]}"
|
||||||
PERSISTENT="${XPATH_ELEMENTS[2]}"
|
PERSISTENT="${XPATH_ELEMENTS[j++]}"
|
||||||
|
|
||||||
if [ -z "$PERSISTENT" ]; then
|
if [ -z "$PERSISTENT" ]; then
|
||||||
IQN=$IQN-$VMID
|
IQN=$IQN-$VMID
|
||||||
|
Loading…
x
Reference in New Issue
Block a user