1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

Feature #1112: Update rm and mkfs scripts to use datastore info

This commit is contained in:
Carlos Martín 2012-02-20 15:41:47 +01:00
parent 1540124721
commit 867c8380c0
2 changed files with 26 additions and 9 deletions

View File

@ -21,7 +21,7 @@
# as (FS)
###############################################################################
# ------------ Set up the environment to source common tools ------------
# -------- Set up the environment to source common tools & conf ------------
if [ -z "${ONE_LOCATION}" ]; then
LIB_LOCATION=/usr/lib/one
@ -30,16 +30,25 @@ else
fi
. $LIB_LOCATION/sh/scripts_common.sh
source $(dirname $0)/fsrc
# ------------ Create the image to the repository ------------
DRIVER_PATH=$(dirname $0)
source ${DRIVER_PATH}/../libfs.sh
FSTYPE=$1
SIZE=$2
ID=$3
# -------- Get mkfs and datastore arguments from OpenNebula core ------------
DRV_ACTION=$1
ID=$2
set_up_datastore $DRV_ACTION
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
eval "FSTYPE=`$XPATH /DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE`"
eval "SIZE=`$XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SIZE`"
DST=`generate_image_path`
# ------------ Create the image to the repository ------------
MKFS_CMD=`mkfs_command $DST $FSTYPE`
exec_and_log "$DD if=/dev/zero of=$DST bs=1 count=1 seek=${SIZE}M" \

View File

@ -29,11 +29,19 @@ else
fi
. $LIB_LOCATION/sh/scripts_common.sh
source $(dirname $0)/fsrc
# ------------ Remove the image to the repository ------------
DRIVER_PATH=$(dirname $0)
source ${DRIVER_PATH}/../libfs.sh
SRC=$1
# -------- Get rm and datastore arguments from OpenNebula core ------------
DRV_ACTION=$1
ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
eval "SRC=`$XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE`"
# ------------ Remove the image from the repository ------------
if [ -e $SRC ] ; then
log "Removing $SRC from the image repository"