diff --git a/src/datastore_mad/remotes/fs/mkfs b/src/datastore_mad/remotes/fs/mkfs index 5f49c6e8f2..a1dc19fb81 100755 --- a/src/datastore_mad/remotes/fs/mkfs +++ b/src/datastore_mad/remotes/fs/mkfs @@ -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" \ diff --git a/src/datastore_mad/remotes/fs/rm b/src/datastore_mad/remotes/fs/rm index 4517caeecf..d915786ea4 100755 --- a/src/datastore_mad/remotes/fs/rm +++ b/src/datastore_mad/remotes/fs/rm @@ -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"