1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-12 08:58:17 +03:00

feature #2097: Re-add disk_type function

This commit is contained in:
Tino Vazquez 2013-06-19 17:06:09 +02:00 committed by Ruben S. Montero
parent 33534d08f8
commit 5a65047227

View File

@ -76,3 +76,22 @@ function make_relative {
echo $dots${src#$common/}
}
#Return DISK_TYPE
function disk_type
{
# Let's check if it is a CDROM
DISK_ID=$(echo "$DST_PATH" | $AWK -F. '{print $NF}')
XPATH="${ONE_LOCAL_VAR}/remotes/datastore/xpath.rb --stdin"
unset i XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <(onevm show -x $VMID| $XPATH \
/VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/TYPE )
DISK_TYPE="${XPATH_ELEMENTS[0]}"
echo $DISK_TYPE
}