1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #1112: mkswap for shared TM

This commit is contained in:
Ruben S. Montero 2012-03-02 01:35:18 +01:00
parent 5810a3fdb4
commit 864daba3ed
3 changed files with 12 additions and 31 deletions

View File

@ -187,6 +187,10 @@ function mkfs_command {
echo ""
return 0
;;
"swap")
echo "$MKSWAP $DST"
return 0
;;
*)
OPTS=""
;;

View File

@ -60,6 +60,6 @@ MKFS_CMD=`mkfs_command $DST_PATH $FSTYPE`
exec_and_log "$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" \
"Could not create image $DST_PATH"
if [ -n $MKFS_CMD ]; then
if [ -n "$MKFS_CMD" ]; then
exec_and_log "$MKFS_CMD" "Unable to create filesystem $FSTYPE in $DST_PATH"
fi

View File

@ -16,36 +16,13 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# mkswap size host:remote_system_ds/disk.i size
# - size in MB of the image
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
SIZE=$1
DST=$2
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
get_vmdir
DST_PATH=`arg_path $DST`
fix_dst_path
DST_DIR=`dirname $DST_PATH`
log_debug "Creating directory $DST_DIR"
exec_and_log "mkdir -p $DST_DIR"
exec_and_log "chmod a+w $DST_DIR"
log_debug "Creating ${SIZE}Mb image in $DST_PATH"
exec_and_log "$DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M" \
"Could not create image file $DST_PATH"
log_debug "Initializing swap space"
exec_and_log "$MKSWAP $DST_PATH" \
"Could not create swap on $DST_PATH"
exec_and_log "chmod a+w $DST_PATH"
CMD="`dirname $0`/mkimage $SIZE swap $DST"
`$CMD`