mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-12 08:58:17 +03:00
feature #4110: delete block lvm drivers
This commit is contained in:
parent
0687cda320
commit
b2b97b7238
31
install.sh
31
install.sh
@ -264,7 +264,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/tm/fs_lvm \
|
||||
$VAR_LOCATION/remotes/tm/qcow2 \
|
||||
$VAR_LOCATION/remotes/tm/ssh \
|
||||
$VAR_LOCATION/remotes/tm/lvm \
|
||||
$VAR_LOCATION/remotes/tm/ceph \
|
||||
$VAR_LOCATION/remotes/tm/dev \
|
||||
$VAR_LOCATION/remotes/tm/vcenter \
|
||||
@ -274,7 +273,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/datastore \
|
||||
$VAR_LOCATION/remotes/datastore/dummy \
|
||||
$VAR_LOCATION/remotes/datastore/fs \
|
||||
$VAR_LOCATION/remotes/datastore/lvm \
|
||||
$VAR_LOCATION/remotes/datastore/ceph \
|
||||
$VAR_LOCATION/remotes/datastore/dev \
|
||||
$VAR_LOCATION/remotes/datastore/vcenter \
|
||||
@ -391,7 +389,6 @@ INSTALL_FILES=(
|
||||
TM_FS_LVM_FILES:$VAR_LOCATION/remotes/tm/fs_lvm
|
||||
TM_QCOW2_FILES:$VAR_LOCATION/remotes/tm/qcow2
|
||||
TM_SSH_FILES:$VAR_LOCATION/remotes/tm/ssh
|
||||
TM_LVM_FILES:$VAR_LOCATION/remotes/tm/lvm
|
||||
TM_CEPH_FILES:$VAR_LOCATION/remotes/tm/ceph
|
||||
TM_DEV_FILES:$VAR_LOCATION/remotes/tm/dev
|
||||
TM_ISCSI_FILES:$VAR_LOCATION/remotes/tm/iscsi
|
||||
@ -400,7 +397,6 @@ INSTALL_FILES=(
|
||||
DATASTORE_DRIVER_COMMON_SCRIPTS:$VAR_LOCATION/remotes/datastore/
|
||||
DATASTORE_DRIVER_DUMMY_SCRIPTS:$VAR_LOCATION/remotes/datastore/dummy
|
||||
DATASTORE_DRIVER_FS_SCRIPTS:$VAR_LOCATION/remotes/datastore/fs
|
||||
DATASTORE_DRIVER_LVM_SCRIPTS:$VAR_LOCATION/remotes/datastore/lvm
|
||||
DATASTORE_DRIVER_CEPH_SCRIPTS:$VAR_LOCATION/remotes/datastore/ceph
|
||||
DATASTORE_DRIVER_DEV_SCRIPTS:$VAR_LOCATION/remotes/datastore/dev
|
||||
DATASTORE_DRIVER_VCENTER_SCRIPTS:$VAR_LOCATION/remotes/datastore/vcenter
|
||||
@ -842,7 +838,6 @@ NETWORK_OVSWITCH_FILES="src/vnm_mad/remotes/ovswitch/clean \
|
||||
# - QCOW2 TM, $VAR_LOCATION/tm/qcow2
|
||||
# - SSH TM, $VAR_LOCATION/tm/ssh
|
||||
# - DUMMY TM, $VAR_LOCATION/tm/dummy
|
||||
# - LVM TM, $VAR_LOCATION/tm/lvm
|
||||
# - CEPH TM, $VAR_LOCATION/tm/ceph
|
||||
# - DEV TM, $VAR_LOCATION/tm/dev
|
||||
# - ISCSI TM, $VAR_LOCATION/tm/iscsi
|
||||
@ -938,20 +933,6 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \
|
||||
src/tm_mad/dummy/snap_revert \
|
||||
src/tm_mad/dummy/cpds"
|
||||
|
||||
TM_LVM_FILES="src/tm_mad/lvm/clone \
|
||||
src/tm_mad/lvm/ln \
|
||||
src/tm_mad/lvm/mv \
|
||||
src/tm_mad/lvm/mvds \
|
||||
src/tm_mad/lvm/cpds \
|
||||
src/tm_mad/lvm/premigrate \
|
||||
src/tm_mad/lvm/postmigrate \
|
||||
src/tm_mad/lvm/snap_create \
|
||||
src/tm_mad/lvm/snap_create_live \
|
||||
src/tm_mad/lvm/snap_delete \
|
||||
src/tm_mad/lvm/snap_revert \
|
||||
src/tm_mad/lvm/failmigrate \
|
||||
src/tm_mad/lvm/delete"
|
||||
|
||||
TM_CEPH_FILES="src/tm_mad/ceph/clone \
|
||||
src/tm_mad/ceph/ln \
|
||||
src/tm_mad/ceph/mv \
|
||||
@ -1016,7 +997,6 @@ TM_ISCSI_FILES="src/tm_mad/iscsi/clone \
|
||||
# Datastore drivers, to be installed under $REMOTES_LOCATION/datastore
|
||||
# - Dummy Image Repository, $REMOTES_LOCATION/datastore/dummy
|
||||
# - FS based Image Repository, $REMOTES_LOCATION/datastore/fs
|
||||
# - LVM based Image Repository, $REMOTES_LOCATION/datastore/lvm
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
DATASTORE_DRIVER_COMMON_SCRIPTS="src/datastore_mad/remotes/xpath.rb \
|
||||
@ -1048,17 +1028,6 @@ DATASTORE_DRIVER_FS_SCRIPTS="src/datastore_mad/remotes/fs/cp \
|
||||
src/datastore_mad/remotes/fs/rm \
|
||||
src/datastore_mad/remotes/fs/export"
|
||||
|
||||
DATASTORE_DRIVER_LVM_SCRIPTS="src/datastore_mad/remotes/lvm/cp \
|
||||
src/datastore_mad/remotes/lvm/mkfs \
|
||||
src/datastore_mad/remotes/lvm/stat \
|
||||
src/datastore_mad/remotes/lvm/rm \
|
||||
src/datastore_mad/remotes/lvm/monitor \
|
||||
src/datastore_mad/remotes/lvm/clone \
|
||||
src/datastore_mad/remotes/lvm/snap_delete \
|
||||
src/datastore_mad/remotes/lvm/snap_revert \
|
||||
src/datastore_mad/remotes/lvm/snap_flatten \
|
||||
src/datastore_mad/remotes/lvm/lvm.conf"
|
||||
|
||||
DATASTORE_DRIVER_CEPH_SCRIPTS="src/datastore_mad/remotes/ceph/cp \
|
||||
src/datastore_mad/remotes/ceph/mkfs \
|
||||
src/datastore_mad/remotes/ceph/stat \
|
||||
|
@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
###############################################################################
|
||||
# This script is used to copy a VM image (SRC) to the image repository as DST
|
||||
# Several SRC types are supported
|
||||
###############################################################################
|
||||
# -------- Set up the environment to source common tools & conf ------------
|
||||
if [ -z "${ONE_LOCATION}" ]; then
|
||||
LIB_LOCATION=/usr/lib/one
|
||||
else
|
||||
LIB_LOCATION=$ONE_LOCATION/lib
|
||||
fi
|
||||
|
||||
. $LIB_LOCATION/sh/scripts_common.sh
|
||||
|
||||
DRIVER_PATH=$(dirname $0)
|
||||
source ${DRIVER_PATH}/../libfs.sh
|
||||
source ${DRIVER_PATH}/lvm.conf
|
||||
|
||||
# -------- Get cp and datastore arguments from OpenNebula core ------------
|
||||
|
||||
DRV_ACTION=$1
|
||||
ID=$2
|
||||
|
||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||
|
||||
unset i j XPATH_ELEMENTS
|
||||
|
||||
while IFS= read -r -d '' element; do
|
||||
XPATH_ELEMENTS[i++]="$element"
|
||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/PATH \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
|
||||
|
||||
BASE_PATH="${XPATH_ELEMENTS[j++]}"
|
||||
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
|
||||
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||
SRC="${XPATH_ELEMENTS[j++]}"
|
||||
SIZE="${XPATH_ELEMENTS[j++]}"
|
||||
|
||||
DST_HOST=`get_destination_host $ID`
|
||||
|
||||
if [ -z "$DST_HOST" ]; then
|
||||
error_message "Datastore template missing 'BRIDGE_LIST' attribute."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
SAFE_DIRS=""
|
||||
|
||||
SRC_HOST=`echo $SRC|cut -d: -f1`
|
||||
SRC_PATH=`echo $SRC|awk -F. '{print $NF}'`
|
||||
LV_SRC=$(echo $SRC_PATH|cut -d. -f2)
|
||||
DEV_SRC="/dev/$VG_NAME/$LV_SRC"
|
||||
|
||||
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS"
|
||||
|
||||
LV_NAME="lv-one-${ID}"
|
||||
LVM_SOURCE="$DST_HOST:$VG_NAME.$LV_NAME"
|
||||
DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
|
||||
CLONE_CMD=$(cat <<EOF
|
||||
set -e
|
||||
$SUDO $LVCREATE -L${SIZE}M ${VG_NAME} -n ${LV_NAME}
|
||||
$SUDO $DD if=$DEV_SRC of=$DEV bs=64k
|
||||
EOF
|
||||
)
|
||||
|
||||
ssh_exec_and_log "$DST_HOST" "$CLONE_CMD" "Error registering $DST_HOST:$DEV"
|
||||
|
||||
echo "$LVM_SOURCE"
|
@ -1,125 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
###############################################################################
|
||||
# This script is used to copy a VM image (SRC) to the image repository as DST
|
||||
# Several SRC types are supported
|
||||
###############################################################################
|
||||
|
||||
# -------- Set up the environment to source common tools & conf ------------
|
||||
|
||||
if [ -z "${ONE_LOCATION}" ]; then
|
||||
LIB_LOCATION=/usr/lib/one
|
||||
else
|
||||
LIB_LOCATION=$ONE_LOCATION/lib
|
||||
fi
|
||||
|
||||
. $LIB_LOCATION/sh/scripts_common.sh
|
||||
|
||||
DRIVER_PATH=$(dirname $0)
|
||||
source ${DRIVER_PATH}/../libfs.sh
|
||||
source ${DRIVER_PATH}/lvm.conf
|
||||
|
||||
# -------- Get cp and datastore arguments from OpenNebula core ------------
|
||||
|
||||
DRV_ACTION=$1
|
||||
ID=$2
|
||||
|
||||
export DRV_ACTION
|
||||
|
||||
UTILS_PATH="${DRIVER_PATH}/.."
|
||||
|
||||
XPATH="$UTILS_PATH/xpath.rb -b $DRV_ACTION"
|
||||
|
||||
unset i j XPATH_ELEMENTS
|
||||
|
||||
while IFS= read -r -d '' element; do
|
||||
XPATH_ELEMENTS[i++]="$element"
|
||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/PATH \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5 \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1 \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/LIMIT_TRANSFER_BW)
|
||||
|
||||
BASE_PATH="${XPATH_ELEMENTS[j++]}"
|
||||
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
|
||||
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||
SRC="${XPATH_ELEMENTS[j++]}"
|
||||
SIZE="${XPATH_ELEMENTS[j++]}"
|
||||
MD5="${XPATH_ELEMENTS[j++]}"
|
||||
SHA1="${XPATH_ELEMENTS[j++]}"
|
||||
NO_DECOMPRESS="${XPATH_ELEMENTS[j++]}"
|
||||
LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[j++]}"
|
||||
|
||||
DST_HOST=`get_destination_host $ID`
|
||||
|
||||
if [ -z "$DST_HOST" ]; then
|
||||
error_message "Datastore template missing 'BRIDGE_LIST' attribute."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS"
|
||||
|
||||
LV_NAME="lv-one-${ID}"
|
||||
LVM_SOURCE="$DST_HOST:$VG_NAME.$LV_NAME"
|
||||
DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
|
||||
REGISTER_CMD=$(cat <<EOF
|
||||
set -e
|
||||
$SUDO $LVCREATE -L${SIZE}M ${VG_NAME} -n ${LV_NAME}
|
||||
EOF
|
||||
)
|
||||
|
||||
DOWNLOADER_ARGS=`set_downloader_args "$MD5" "$SHA1" "$NO_DECOMPRESS" "$LIMIT_TRANSFER_BW" "$SRC" -`
|
||||
|
||||
COPY_COMMAND="$UTILS_PATH/downloader.sh $DOWNLOADER_ARGS"
|
||||
|
||||
case $SRC in
|
||||
http://*|https://*)
|
||||
log "Downloading $SRC to the image repository"
|
||||
|
||||
DUMP="$COPY_COMMAND"
|
||||
;;
|
||||
|
||||
*)
|
||||
if [ `check_restricted $SRC` -eq 1 ]; then
|
||||
log_error "Not allowed to copy images from $RESTRICTED_DIRS"
|
||||
error_message "Not allowed to copy image file $SRC"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
log "Copying local image $SRC to the image repository"
|
||||
|
||||
DUMP="$COPY_COMMAND"
|
||||
;;
|
||||
esac
|
||||
|
||||
ssh_exec_and_log "$DST_HOST" "$REGISTER_CMD" "Error registering $DST_HOST:$DEV"
|
||||
|
||||
exec_and_log "eval $DUMP | $SSH $DST_HOST $SUDO $DD of=$DEV bs=64k" \
|
||||
"Error dumping $SRC to $DST_HOST:$DEV"
|
||||
|
||||
echo "$LVM_SOURCE"
|
@ -1,21 +0,0 @@
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# Default volume group
|
||||
VG_NAME=vg-one
|
||||
|
||||
# Default LV snapshot SIZE
|
||||
DEFAULT_SIZE=512
|
@ -1,100 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
###############################################################################
|
||||
# This script is used to create a VM image (SRC) of size (SIZE) and formatted
|
||||
# as (FS)
|
||||
###############################################################################
|
||||
|
||||
# -------- Set up the environment to source common tools & conf ------------
|
||||
|
||||
if [ -z "${ONE_LOCATION}" ]; then
|
||||
LIB_LOCATION=/usr/lib/one
|
||||
else
|
||||
LIB_LOCATION=$ONE_LOCATION/lib
|
||||
fi
|
||||
|
||||
. $LIB_LOCATION/sh/scripts_common.sh
|
||||
|
||||
DRIVER_PATH=$(dirname $0)
|
||||
source ${DRIVER_PATH}/../libfs.sh
|
||||
source ${DRIVER_PATH}/lvm.conf
|
||||
|
||||
# -------- Get mkfs and datastore arguments from OpenNebula core ------------
|
||||
|
||||
DRV_ACTION=$1
|
||||
ID=$2
|
||||
|
||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||
|
||||
unset i j XPATH_ELEMENTS
|
||||
|
||||
while IFS= read -r -d '' element; do
|
||||
XPATH_ELEMENTS[i++]="$element"
|
||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \
|
||||
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE)
|
||||
|
||||
BASE_PATH="${XPATH_ELEMENTS[j++]}"
|
||||
RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||
SAFE_DIRS="${XPATH_ELEMENTS[j++]}"
|
||||
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
|
||||
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||
FSTYPE="${XPATH_ELEMENTS[j++]}"
|
||||
SIZE="${XPATH_ELEMENTS[j++]}"
|
||||
|
||||
DST_HOST=`get_destination_host $ID`
|
||||
|
||||
if [ -z "$DST_HOST" ]; then
|
||||
error_message "Datastore template missing 'BRIDGE_LIST' attribute."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS"
|
||||
|
||||
LV_NAME="lv-one-${ID}"
|
||||
LVM_SOURCE="$DST_HOST:$VG_NAME.$LV_NAME"
|
||||
DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
MKFS_COMMAND=$(mkfs_command "$DEV" "$FSTYPE")
|
||||
|
||||
REGISTER_CMD=$(cat <<EOF
|
||||
set -e
|
||||
$SUDO $LVCREATE -L${SIZE}M ${VG_NAME} -n ${LV_NAME}
|
||||
if [ -n "$MKFS_COMMAND" ]; then
|
||||
$SUDO $MKFS_COMMAND
|
||||
fi
|
||||
EOF
|
||||
)
|
||||
|
||||
# ------------ Image to save_as disk, no need to create a FS ------------
|
||||
|
||||
if [ "$FSTYPE" = "save_as" ]; then
|
||||
echo "$LVM_SOURCE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ------------ Create the image to the repository ------------
|
||||
|
||||
ssh_exec_and_log "$DST_HOST" "$REGISTER_CMD" \
|
||||
"Error registering $DST_HOST:$DEV"
|
||||
|
||||
echo "$LVM_SOURCE"
|
@ -1,85 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
###############################################################################
|
||||
# This script is used to monitor the free and used space of a datastore
|
||||
###############################################################################
|
||||
|
||||
# -------- Set up the environment to source common tools & conf ------------
|
||||
|
||||
if [ -z "${ONE_LOCATION}" ]; then
|
||||
LIB_LOCATION=/usr/lib/one
|
||||
else
|
||||
LIB_LOCATION=$ONE_LOCATION/lib
|
||||
fi
|
||||
|
||||
. $LIB_LOCATION/sh/scripts_common.sh
|
||||
|
||||
DRIVER_PATH=$(dirname $0)
|
||||
source ${DRIVER_PATH}/../libfs.sh
|
||||
source ${DRIVER_PATH}/lvm.conf
|
||||
|
||||
# -------- Get datastore arguments from OpenNebula core ------------
|
||||
|
||||
DRV_ACTION=$1
|
||||
ID=$2
|
||||
|
||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||
|
||||
unset i j XPATH_ELEMENTS
|
||||
|
||||
while IFS= read -r -d '' element; do
|
||||
XPATH_ELEMENTS[i++]="$element"
|
||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME)
|
||||
|
||||
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
|
||||
VG_NAME="${XPATH_ELEMENTS[j++]:-$VG_NAME}"
|
||||
|
||||
HOST=`get_destination_host`
|
||||
|
||||
if [ -z "$HOST" ]; then
|
||||
error_message "Datastore template missing 'BRIDGE_LIST' attribute."
|
||||
exit -1
|
||||
fi
|
||||
# ------------ Compute datastore usage -------------
|
||||
|
||||
MONITOR_SCRIPT=$(cat <<EOF
|
||||
set -e
|
||||
|
||||
VG_OPTS="--units m -C --noheadings --nosuffix $VG_NAME"
|
||||
|
||||
TOTAL_MB=\$($SUDO $VGDISPLAY -o vg_size \$VG_OPTS | $TR -d ' ')
|
||||
FREE_MB=\$($SUDO $VGDISPLAY -o vg_free \$VG_OPTS | $TR -d ' ')
|
||||
USED_MB=\$($AWK "BEGIN {print \$TOTAL_MB - \$FREE_MB}")
|
||||
|
||||
echo "USED_MB=\$USED_MB"
|
||||
echo "TOTAL_MB=\$TOTAL_MB"
|
||||
echo "FREE_MB=\$FREE_MB"
|
||||
EOF
|
||||
)
|
||||
|
||||
MONITOR_DATA=$(ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" 2>&1)
|
||||
MONITOR_STATUS=$?
|
||||
|
||||
if [ "$MONITOR_STATUS" = "0" ]; then
|
||||
echo "$MONITOR_DATA" | tr ' ' '\n'
|
||||
else
|
||||
echo "$MONITOR_DATA"
|
||||
exit $MONITOR_STATUS
|
||||
fi
|
@ -1,75 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
###############################################################################
|
||||
# This script is used to remove a VM image (SRC) from the image repository
|
||||
###############################################################################
|
||||
|
||||
# ------------ Set up the environment to source common tools ------------
|
||||
if [ -z "${ONE_LOCATION}" ]; then
|
||||
LIB_LOCATION=/usr/lib/one
|
||||
else
|
||||
LIB_LOCATION=$ONE_LOCATION/lib
|
||||
fi
|
||||
|
||||
. $LIB_LOCATION/sh/scripts_common.sh
|
||||
|
||||
DRIVER_PATH=$(dirname $0)
|
||||
source ${DRIVER_PATH}/../libfs.sh
|
||||
source ${DRIVER_PATH}/lvm.conf
|
||||
|
||||
# -------- Get rm and datastore arguments from OpenNebula core ------------
|
||||
|
||||
DRV_ACTION=$1
|
||||
ID=$2
|
||||
|
||||
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
|
||||
|
||||
unset i j XPATH_ELEMENTS
|
||||
|
||||
while IFS= read -r -d '' element; do
|
||||
XPATH_ELEMENTS[i++]="$element"
|
||||
done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \
|
||||
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST)
|
||||
|
||||
SRC="${XPATH_ELEMENTS[j++]}"
|
||||
BRIDGE_LIST="${XPATH_ELEMENTS[j++]}"
|
||||
|
||||
DST_HOST=`get_destination_host $ID`
|
||||
|
||||
if [ -z "$DST_HOST" ]; then
|
||||
error_message "Datastore template missing 'BRIDGE_LIST' attribute."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
TARGET=`echo $SRC|$CUT -d: -f2`
|
||||
LV_NAME=`echo $TARGET|$AWK -F. '{print $(NF)}'`
|
||||
VG_NAME=`echo $TARGET|$AWK -F. '{print $(NF-1)}'`
|
||||
DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
|
||||
RM_COMMAND=$(cat <<EOF
|
||||
$SUDO $LVREMOVE -f $VG_NAME/$LV_NAME
|
||||
EOF
|
||||
)
|
||||
|
||||
log "Removing $DST_HOST:$DEV from the image repository"
|
||||
|
||||
ssh_exec_and_log "$DST_HOST" "$RM_COMMAND" \
|
||||
"Error removing $DST_HOST:$DEV"
|
||||
|
||||
exit 0
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
@ -1 +0,0 @@
|
||||
../common/stat
|
@ -143,9 +143,6 @@ define(function(require) {
|
||||
case 'fs':
|
||||
_selectFilesystem(dialog);
|
||||
break;
|
||||
case 'block_lvm':
|
||||
_selectBlockLvm(dialog);
|
||||
break;
|
||||
case 'fs_lvm':
|
||||
_selectFsLvm(dialog);
|
||||
break;
|
||||
@ -409,25 +406,6 @@ define(function(require) {
|
||||
$('input#restricted_dirs', dialog).removeAttr('disabled');
|
||||
}
|
||||
|
||||
function _selectBlockLvm(dialog) {
|
||||
$('select#ds_mad', dialog).val('lvm').change();
|
||||
$('select#ds_mad', dialog).attr('disabled', 'disabled');
|
||||
$('select#tm_mad', dialog).val('lvm');
|
||||
$('select#tm_mad', dialog).attr('disabled', 'disabled');
|
||||
$('input#image_ds_type', dialog).click();
|
||||
$('input[name=ds_type]', dialog).attr('disabled', 'disabled');
|
||||
$('label[for="bridge_list"],input#bridge_list', dialog).parent().fadeIn();
|
||||
$('label[for="vg_name"],input#vg_name', dialog).fadeIn();
|
||||
$('label[for="limit_transfer_bw"],input#limit_transfer_bw', dialog).parent().fadeIn();
|
||||
$('label[for="no_decompress"],input#no_decompress', dialog).parent().fadeIn();
|
||||
$('label[for="datastore_capacity_check"],input#datastore_capacity_check', dialog).parent().fadeIn();
|
||||
$('select#disk_type', dialog).val('block');
|
||||
$('select#disk_type', dialog).attr('disabled', 'disabled');
|
||||
$('input#safe_dirs', dialog).removeAttr('disabled');
|
||||
$('input#limit_mb', dialog).removeAttr('disabled');
|
||||
$('input#restricted_dirs', dialog).removeAttr('disabled');
|
||||
}
|
||||
|
||||
function _selectFsLvm(dialog) {
|
||||
$('select#ds_mad', dialog).val('fs').change();
|
||||
$('select#ds_mad', dialog).attr('disabled', 'disabled');
|
||||
|
@ -26,7 +26,6 @@
|
||||
<label for="presets">{{tr "Presets"}}</label>
|
||||
<select id="presets" name="presets">
|
||||
<option value="fs">{{tr "Filesystem"}}</option>
|
||||
<option value="block_lvm">{{tr "Block LVM"}}</option>
|
||||
<option value="fs_lvm">{{tr "FS LVM"}}</option>
|
||||
<option value="ceph">{{tr "Ceph"}}</option>
|
||||
<option value="gluster">{{tr "Gluster"}}</option>
|
||||
@ -64,7 +63,6 @@
|
||||
<label for="ds_mad">{{tr "Datastore"}}</label>
|
||||
<select id="ds_mad" name="ds_mad">
|
||||
<option value="fs">{{tr "Filesystem"}}</option>
|
||||
<option value="lvm">{{tr "LVM"}}</option>
|
||||
<option value="ceph">{{tr "Ceph"}}</option>
|
||||
<option value="dev">{{tr "Devices"}}</option>
|
||||
<option value="iscsi">{{tr "iSCSI"}}</option>
|
||||
@ -82,7 +80,6 @@
|
||||
<option value="shared">{{tr "Shared"}}</option>
|
||||
<option value="ssh">{{tr "SSH"}}</option>
|
||||
<option value="qcow2">{{tr "qcow2"}}</option>
|
||||
<option value="lvm">{{tr "LVM"}}</option>
|
||||
<option value="fs_lvm">{{tr "FS LVM"}}</option>
|
||||
<option value="ceph">{{tr "Ceph"}}</option>
|
||||
<option value="dev">{{tr "Devices"}}</option>
|
||||
|
@ -1,84 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# clone fe:SOURCE host:remote_system_ds/disk.i size
|
||||
# - 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
|
||||
|
||||
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_HOST=`arg_host $SRC`
|
||||
SRC_PATH=`arg_path $SRC`
|
||||
|
||||
DST_PATH=`arg_path $DST`
|
||||
DST_HOST=`arg_host $DST`
|
||||
DST_DIR=`dirname $DST_PATH`
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Get other LVM related fields
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
LV_NAME=`echo $SRC_PATH|cut -d. -f2`
|
||||
VG_NAME=`echo $SRC_PATH|cut -d. -f1`
|
||||
DEV="/dev/${VG_NAME}/${LV_NAME}"
|
||||
|
||||
DISK_ID=$(echo $DST_PATH|awk -F. '{print $NF}')
|
||||
|
||||
TARGET_DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
LV_CLONE="$LV_NAME-$VM_ID-$DISK_ID"
|
||||
LV_CLONE_DEV="/dev/$VG_NAME/$LV_CLONE"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Create the snapshot and link it
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
CLONE_CMD=$(cat <<EOF
|
||||
set -e
|
||||
mkdir -p $DST_DIR
|
||||
SIZE=\$($SUDO $LVS $DEV --noheadings --nosuffix --units m -o lv_size \
|
||||
| tr -d ' ')
|
||||
$SUDO $LVCREATE -L\${SIZE}M -n $LV_CLONE $VG_NAME
|
||||
$SUDO $DD if=$TARGET_DEV of=$LV_CLONE_DEV bs=64k
|
||||
rm -f "$DST_PATH"
|
||||
ln -s "$LV_CLONE_DEV" "$DST_PATH"
|
||||
EOF
|
||||
)
|
||||
|
||||
ssh_exec_and_log "$DST_HOST" "$CLONE_CMD" \
|
||||
"Error cloning $TARGET_DEV to $LV_CLONE_DEV"
|
||||
exit 0
|
@ -1,74 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# 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
|
||||
VM_ID=$4
|
||||
DS_ID=$5
|
||||
|
||||
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
|
||||
set -e
|
||||
|
||||
DEV=\$(readlink $SRC_PATH)
|
||||
SIZE=\$($SUDO $LVS \$DEV --noheadings --nosuffix --units m -o lv_size \
|
||||
| tr -d ' ')
|
||||
$SUDO $LVCREATE -L\${SIZE}M ${VG_NAME} -n ${LV_NAME}
|
||||
$SUDO $DD if="\${DEV}" of="${TARGET_DEV}"
|
||||
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
|
@ -1,74 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# DELETE <host:remote_system_ds/disk.i|host:remote_system_ds/>
|
||||
# - host is the target host to deploy the VM
|
||||
# - remote_system_ds is the path for the system datastore in the host
|
||||
|
||||
DST=$1
|
||||
VM_ID=$2
|
||||
DS_ID=$3
|
||||
|
||||
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
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Return if deleting a disk, we will delete them when removing the
|
||||
# remote_system_ds directory for the VM (remotely)
|
||||
#-------------------------------------------------------------------------------
|
||||
DST_PATH=`arg_path $DST`
|
||||
DST_HOST=`arg_host $DST`
|
||||
|
||||
# Delete the device if it's a clone (LVM snapshot)
|
||||
DELETE_CMD=$(cat <<EOF
|
||||
DEV=\$(readlink $DST_PATH)
|
||||
LV_NAME=\$(basename \$DEV)
|
||||
|
||||
# remove link
|
||||
rm -f $DST_PATH
|
||||
|
||||
# The following attrs will only be there if the image is non-persistent
|
||||
# lv-one-<image> ==> persistent
|
||||
# lv-one-<image>-<vmid>-<diskid> ==> non-persistent (clone)
|
||||
|
||||
VMID=\$(echo \$LV_NAME|cut -d- -f4)
|
||||
DISKID=\$(echo \$LV_NAME|cut -d- -f5)
|
||||
|
||||
if [ -n "\$VMID" -a -n "\$DISKID" ]; then
|
||||
# this is a cloned image
|
||||
$SUDO $LVREMOVE -f \$DEV
|
||||
fi
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ `is_disk $DST_PATH` -eq 1 ]; then
|
||||
# Disk
|
||||
ssh_exec_and_log "$DST_HOST" "$DELETE_CMD" \
|
||||
"Error deleting $DST_PATH"
|
||||
else
|
||||
# Directory
|
||||
log "Deleting $DST_PATH"
|
||||
ssh_exec_and_log "$DST_HOST" "rm -rf $DST_PATH" "Error deleting $DST_PATH"
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1 +0,0 @@
|
||||
../common/failmigrate
|
@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# clone fe:SOURCE host:remote_system_ds/disk.i size
|
||||
# - 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
|
||||
|
||||
SRC=$1
|
||||
DST=$2
|
||||
|
||||
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_HOST=`arg_host $SRC`
|
||||
SRC_PATH=`arg_path $SRC`
|
||||
|
||||
DST_PATH=`arg_path $DST`
|
||||
DST_HOST=`arg_host $DST`
|
||||
DST_DIR=`dirname $DST_PATH`
|
||||
|
||||
LV_NAME=`echo $SRC_PATH|cut -d. -f2`
|
||||
VG_NAME=`echo $SRC_PATH|cut -d. -f1`
|
||||
|
||||
TARGET_DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
|
||||
LINK_CMD=$(cat <<EOF
|
||||
set -e
|
||||
mkdir -p $DST_DIR
|
||||
rm -f "$DST_PATH"
|
||||
ln -s "$TARGET_DEV" "$DST_PATH"
|
||||
EOF
|
||||
)
|
||||
|
||||
ssh_exec_and_log "$DST_HOST" "$LINK_CMD" \
|
||||
"Error linking $TARGET_DEV"
|
||||
exit 0
|
@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
exit 0
|
@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# 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
|
@ -1 +0,0 @@
|
||||
../common/postmigrate
|
@ -1 +0,0 @@
|
||||
../common/premigrate
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
@ -1 +0,0 @@
|
||||
../common/not_supported.sh
|
Loading…
x
Reference in New Issue
Block a user