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

Feature #3782: Simplify all TM/mvds action as now they don't handle

deferred saveas
This commit is contained in:
Jaime Melis 2015-06-12 17:50:28 +02:00
parent b5136a152f
commit 1b531f82ff
5 changed files with 0 additions and 238 deletions

View File

@ -16,10 +16,4 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# mvds host:remote_system_ds/disk.i fe:SOURCE
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
exit 0

View File

@ -22,52 +22,4 @@
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
SRC=$1
DST=$2
VM_ID=$3
DS_ID=$4
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh
fi
DRIVER_PATH=$(dirname $0)
source $TMCOMMON
source ${DRIVER_PATH}/../../datastore/lvm/lvm.conf
#-------------------------------------------------------------------------------
# Set dst path and dir
#-------------------------------------------------------------------------------
SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`
DST_PATH=`arg_path $DST`
DST_HOST=`arg_host $DST`
VG_NAME=$(echo $DST_PATH|cut -d. -f1)
LV_NAME=$(echo $DST_PATH|cut -d. -f2)
TARGET_DEV=/dev/$VG_NAME/$LV_NAME
DUMP_CMD=$(cat <<EOF
DEV=\$(readlink $SRC_PATH)
LV=\$(basename \$DEV)
VM=\$(echo \$LV|cut -d- -f4)
DISK_ID=\$(echo \$LV|cut -d- -f5)
if [ -n "\$VM" -a -n "\$DISK_ID" ]; then
$SUDO $LVRENAME ${VG_NAME} \${LV} ${LV_NAME}
fi
EOF
)
#-------------------------------------------------------------------------------
# Move the image back to the datastore
#-------------------------------------------------------------------------------
log "Dumping $SRC to $DST"
ssh_exec_and_log "$SRC_HOST" "$DUMP_CMD" "Error dumping $SRC to $DST"
exit 0

View File

@ -16,60 +16,4 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# mvds host:remote_system_ds/disk.i fe:SOURCE vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
# - vmid is the id of the VM
# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
VMID=$3
DSID=$4
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh
fi
. $TMCOMMON
#-------------------------------------------------------------------------------
# Set dst path and dir
#-------------------------------------------------------------------------------
SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`
SRC_DIR=`dirname $SRC_PATH`
DST_ARG_PATH=`arg_path $DST`
SRC_DS_PATH="$(dirname $(dirname $(dirname $SRC_PATH)))"
DST_DS_PATH="$(dirname $(dirname $DST_ARG_PATH))"
DST_PATH="${SRC_DS_PATH}${DST_ARG_PATH##$DST_DS_PATH}"
#-------------------------------------------------------------------------------
# Move the image back to the datastore
#-------------------------------------------------------------------------------
MVSCRIPT=$(cat <<EOF
SRC_READLN=\$($READLINK -f $SRC_PATH)
DST_READLN=\$($READLINK -f $DST_PATH)
if [ \( -L $SRC_PATH \) -a \( "\$SRC_READLN" = "\$DST_READLN" \) ] ; then
echo "Not moving files to image repo, they are the same"
else
$QEMU_IMG convert $SRC_PATH -O qcow2 $DST_PATH
rm $SRC_PATH
fi
EOF
)
log "Moving $SRC_PATH to datastore as $DST_PATH"
ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image $DST_PATH"
exit 0

View File

@ -16,60 +16,4 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# mvds host:remote_system_ds/disk.i fe:SOURCE vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
# - vmid is the id of the VM
# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
VMID=$3
DSID=$4
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh
fi
. $TMCOMMON
#-------------------------------------------------------------------------------
# Set dst path and dir
#-------------------------------------------------------------------------------
SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`
SRC_DIR=`dirname $SRC_PATH`
DST_ARG_PATH=`arg_path $DST`
SRC_DS_PATH="$(dirname $(dirname $(dirname $SRC_PATH)))"
DST_DS_PATH="$(dirname $(dirname $DST_ARG_PATH))"
DST_PATH="${SRC_DS_PATH}${DST_ARG_PATH##$DST_DS_PATH}"
#-------------------------------------------------------------------------------
# Move the image back to the datastore
#-------------------------------------------------------------------------------
MVSCRIPT=$(cat <<EOF
SRC_READLN=\$($READLINK -f $SRC_PATH)
DST_READLN=\$($READLINK -f $DST_PATH)
if [ \( -L $SRC_PATH \) -a \( "\$SRC_READLN" = "\$DST_READLN" \) ] ; then
echo "Not moving files to image repo, they are the same"
rm $SRC_PATH
else
mv -f $SRC_PATH $DST_PATH
fi
EOF
)
log "Moving $SRC_PATH to datastore as $DST_PATH"
ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image $DST_PATH"
exit 0

View File

@ -16,76 +16,4 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# cpds host:remote_system_ds/disk.i fe:SOURCE snapid vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
# - snapid is the snapshot id. "-1" for none
SRC=$1
DST=$2
SNAP_ID=$3
VMID=$4
DSID=$5
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
VMWARERC=/etc/one/vmwarerc
else
TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh
VMWARERC=$ONE_LOCATION/etc/vmwarerc
fi
. $TMCOMMON
#-------------------------------------------------------------------------------
# Retrieve needed information, Example (same for SRC)
# SRC : esx1:/vmfs/volumes/105/90/disk.0
# DST : one:/vmfs/volumes/104/84045f4a
# SRC_PATH : /vmfs/volumes/105/90/disk.0
# SRC_DISK : /vmfs/volumes/105/90/disk.0/disk.vmdk
# SRC_HOST : esx1
#-------------------------------------------------------------------------------
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
SRC_DISK="$SRC_PATH/disk.vmdk"
DST_DISK="$DST_PATH/disk.vmdk"
SRC_HOST=`arg_host $SRC`
#-------------------------------------------------------------------------------
# Move the image back to the datastore
#-------------------------------------------------------------------------------
log "Moving $SRC to $DST"
MVSCRIPT=$(cat <<EOF
SRC_DISK_LN=\$($READLINK -f $SRC_DISK)
DST_DISK_LN=\$($READLINK -f $DST_DISK)
if [ \( -L $SRC_DISK \) -a \( "\$SRC_DISK_LN" = "\$DST_DISK_LN" \) ]; then
echo "Not moving files to image repo, they are the same"
elif [ -L "$SRC_PATH.iso" ]; then
echo "Not moving the file it is a CDROM"
else
mkdir -p $DST_PATH
$VMKFSTOOLS -U $DST_DISK
$VMKFSTOOLS -i $SRC_DISK -d thin $DST_DISK
if [ -d $DST_PATH ]; then
chmod 0770 $DST_PATH
else
chmod 0660 $DST_PATH
fi
fi
EOF
)
ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image $SRC to $DST"
exit 0