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:
parent
1540124721
commit
867c8380c0
@ -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" \
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user