diff --git a/install.sh b/install.sh index b07d10f9c1..147f41b81c 100755 --- a/install.sh +++ b/install.sh @@ -224,7 +224,6 @@ else fi SHARE_DIRS="$SHARE_LOCATION/examples \ - $SHARE_LOCATION/tgt \ $SHARE_LOCATION/websockify" ETC_DIRS="$ETC_LOCATION/vmm_exec \ @@ -288,7 +287,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/tm/qcow2 \ $VAR_LOCATION/remotes/tm/ssh \ $VAR_LOCATION/remotes/tm/vmfs \ - $VAR_LOCATION/remotes/tm/iscsi \ $VAR_LOCATION/remotes/tm/lvm \ $VAR_LOCATION/remotes/tm/ceph \ $VAR_LOCATION/remotes/hooks \ @@ -297,7 +295,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/datastore/dummy \ $VAR_LOCATION/remotes/datastore/fs \ $VAR_LOCATION/remotes/datastore/vmfs \ - $VAR_LOCATION/remotes/datastore/iscsi \ $VAR_LOCATION/remotes/datastore/lvm \ $VAR_LOCATION/remotes/datastore/ceph \ $VAR_LOCATION/remotes/auth \ @@ -474,7 +471,6 @@ INSTALL_FILES=( TM_QCOW2_FILES:$VAR_LOCATION/remotes/tm/qcow2 TM_SSH_FILES:$VAR_LOCATION/remotes/tm/ssh TM_VMFS_FILES:$VAR_LOCATION/remotes/tm/vmfs - TM_ISCSI_FILES:$VAR_LOCATION/remotes/tm/iscsi TM_LVM_FILES:$VAR_LOCATION/remotes/tm/lvm TM_CEPH_FILES:$VAR_LOCATION/remotes/tm/ceph TM_DUMMY_FILES:$VAR_LOCATION/remotes/tm/dummy @@ -482,7 +478,6 @@ INSTALL_FILES=( DATASTORE_DRIVER_DUMMY_SCRIPTS:$VAR_LOCATION/remotes/datastore/dummy DATASTORE_DRIVER_FS_SCRIPTS:$VAR_LOCATION/remotes/datastore/fs DATASTORE_DRIVER_VMFS_SCRIPTS:$VAR_LOCATION/remotes/datastore/vmfs - DATASTORE_DRIVER_ISCSI_SCRIPTS:$VAR_LOCATION/remotes/datastore/iscsi DATASTORE_DRIVER_LVM_SCRIPTS:$VAR_LOCATION/remotes/datastore/lvm DATASTORE_DRIVER_CEPH_SCRIPTS:$VAR_LOCATION/remotes/datastore/ceph NETWORK_FILES:$VAR_LOCATION/remotes/vnm @@ -494,7 +489,6 @@ INSTALL_FILES=( NETWORK_OVSWITCH_BRCOMPAT_FILES:$VAR_LOCATION/remotes/vnm/ovswitch_brcompat NETWORK_VMWARE_FILES:$VAR_LOCATION/remotes/vnm/vmware EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples - TGT_SHARE_FILES:$SHARE_LOCATION/tgt WEBSOCKIFY_SHARE_FILES:$SHARE_LOCATION/websockify INSTALL_GEMS_SHARE_FILE:$SHARE_LOCATION HOOK_FT_FILES:$VAR_LOCATION/remotes/hooks/ft @@ -984,7 +978,6 @@ NETWORK_VMWARE_FILES="src/vnm_mad/remotes/vmware/clean \ # - SSH TM, $VAR_LOCATION/tm/ssh # - DUMMY TM, $VAR_LOCATION/tm/dummy # - VMWARE TM, $VAR_LOCATION/tm/vmware -# - ISCSI TM, $VAR_LOCATION/tm/iscsi # - LVM TM, $VAR_LOCATION/tm/lvm # - CEPH TM, $VAR_LOCATION/tm/ceph #------------------------------------------------------------------------------- @@ -1060,15 +1053,6 @@ TM_VMFS_FILES="src/tm_mad/vmfs/clone \ src/tm_mad/vmfs/postmigrate \ src/tm_mad/vmfs/premigrate" -TM_ISCSI_FILES="src/tm_mad/iscsi/clone \ - src/tm_mad/iscsi/ln \ - src/tm_mad/iscsi/mv \ - src/tm_mad/iscsi/mvds \ - src/tm_mad/iscsi/cpds \ - src/tm_mad/iscsi/premigrate \ - src/tm_mad/iscsi/postmigrate \ - src/tm_mad/iscsi/delete" - TM_LVM_FILES="src/tm_mad/lvm/clone \ src/tm_mad/lvm/ln \ src/tm_mad/lvm/mv \ @@ -1092,7 +1076,6 @@ TM_CEPH_FILES="src/tm_mad/ceph/clone \ # - Dummy Image Repository, $REMOTES_LOCATION/datastore/dummy # - FS based Image Repository, $REMOTES_LOCATION/datastore/fs # - VMFS based Image Repository, $REMOTES_LOCATION/datastore/vmfs -# - iSCSI based Image Repository, $REMOTES_LOCATION/datastore/iscsi # - LVM based Image Repository, $REMOTES_LOCATION/datastore/lvm #------------------------------------------------------------------------------- @@ -1122,14 +1105,6 @@ DATASTORE_DRIVER_VMFS_SCRIPTS="src/datastore_mad/remotes/vmfs/cp \ src/datastore_mad/remotes/vmfs/rm \ src/datastore_mad/remotes/vmfs/vmfs.conf" -DATASTORE_DRIVER_ISCSI_SCRIPTS="src/datastore_mad/remotes/iscsi/cp \ - src/datastore_mad/remotes/iscsi/mkfs \ - src/datastore_mad/remotes/iscsi/stat \ - src/datastore_mad/remotes/iscsi/rm \ - src/datastore_mad/remotes/iscsi/clone \ - src/datastore_mad/remotes/iscsi/monitor \ - src/datastore_mad/remotes/iscsi/iscsi.conf" - DATASTORE_DRIVER_LVM_SCRIPTS="src/datastore_mad/remotes/lvm/cp \ src/datastore_mad/remotes/lvm/mkfs \ src/datastore_mad/remotes/lvm/stat \ @@ -1229,12 +1204,6 @@ EXAMPLE_SHARE_FILES="share/examples/vm.template \ share/examples/private.net \ share/examples/public.net" -#------------------------------------------------------------------------------- -# File required to interact with a tgtd server -#------------------------------------------------------------------------------- - -TGT_SHARE_FILES="share/scripts/tgt/tgt-setup-lun-one" - #------------------------------------------------------------------------------- # Files required to interact with the websockify server #------------------------------------------------------------------------------- diff --git a/share/doc/xsd/oned.conf b/share/doc/xsd/oned.conf index 0b76bc14a9..db09c45fc8 100644 --- a/share/doc/xsd/oned.conf +++ b/share/doc/xsd/oned.conf @@ -369,7 +369,7 @@ VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ] TM_MAD = [ executable = "one_tm", - arguments = "-t 15 -d dummy,lvm,shared,shared_lvm,qcow2,ssh,vmfs,iscsi,ceph" + arguments = "-t 15 -d dummy,lvm,shared,shared_lvm,qcow2,ssh,vmfs,ceph" ] TM_MAD_CONF = [ @@ -421,13 +421,6 @@ TM_MAD_CONF = [ shared = "yes" ] -TM_MAD_CONF = [ - name = "iscsi", - ln_target = "NONE", - clone_target= "SELF", - shared = "yes" -] - TM_MAD_CONF = [ name = "ceph", ln_target = "NONE", @@ -450,7 +443,7 @@ TM_MAD_CONF = [ DATASTORE_MAD = [ executable = "one_datastore", - arguments = "-t 15 -d dummy,fs,vmfs,iscsi,lvm,ceph" + arguments = "-t 15 -d dummy,fs,vmfs,lvm,ceph" ] #******************************************************************************* diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 39d87509c0..4e0ca3983f 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -390,7 +390,7 @@ VM_MAD = [ TM_MAD = [ executable = "one_tm", - arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,iscsi,ceph" + arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph" ] TM_MAD_CONF = [ @@ -442,13 +442,6 @@ TM_MAD_CONF = [ shared = "yes" ] -TM_MAD_CONF = [ - name = "iscsi", - ln_target = "NONE", - clone_target= "SELF", - shared = "yes" -] - TM_MAD_CONF = [ name = "ceph", ln_target = "NONE", @@ -471,7 +464,7 @@ TM_MAD_CONF = [ DATASTORE_MAD = [ executable = "one_datastore", - arguments = "-t 15 -d dummy,fs,vmfs,iscsi,lvm,ceph" + arguments = "-t 15 -d dummy,fs,vmfs,lvm,ceph" ] #******************************************************************************* diff --git a/share/scripts/tgt/tgt-setup-lun-one b/share/scripts/tgt/tgt-setup-lun-one deleted file mode 100755 index faf08949b5..0000000000 --- a/share/scripts/tgt/tgt-setup-lun-one +++ /dev/null @@ -1,279 +0,0 @@ -#!/bin/bash - -# LUN assignment script -# -# Copyright (C) 2007 Erez Zilber -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, version 2 of the -# License. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA - -usage() -{ - name=$(basename $0); - echo "usage:"; - echo -e "\t$name -n tgt_name -d dev -b bs_name -t transport [initiator_IP1 initiator_IP2 ...]"; - echo "defaults:"; - echo -e "\tbacking store: rdwr"; - echo -e "\ttransport: iscsi"; - echo -e "\tinitiator: ALL"; - echo "examples:"; - echo -e "\t$name -n tgt-1 -d /dev/sdb1 192.168.1.2"; - echo -e "\t$name -n tgt-2 -d /tmp/null -b null -t iser"; - echo -e "\t$name -n tgt-3 -d ~/disk3.bin -b rdwr 192.168.1.2 192.168.1.3"; -} - -verify_params() -{ - if ! [ "$dev" -o "$bs_type" == "null" ]; then - echo "Error: a device is mandatory"; - exit 1; - else - return; - fi - - # Make sure that the device exists - if ! [ -b $dev -o -f $dev -o -c $dev ]; then - echo "Error: $dev is not a device"; - exit 1; - fi - - if ! [ "$tgt_name" ]; then - echo "Error: target name is mandatory"; - exit 1; - fi - - if ! [ "$lld_name" ]; then - echo "Error: lld name empty"; - exit 1; - fi -} - -find_vacant_tgt_id() -{ - tmp_file=`mktemp` - tgtadm --lld $lld_name --op show --mode target | strings > $tmp_file - id_list=$(cat $tmp_file | grep Target | cut -d" " -f2 | sed s/://) - next_vacant_id=1 - for id in $id_list; do - if (($id > $next_vacant_id)); then - break; - else - next_vacant_id=$((next_vacant_id+1)) - fi - done - rm -f $tmp_file - echo $next_vacant_id -} - -find_vacant_lun() -{ - tid=$1 - tgt_found=0 - next_vacant_lun=0 - tmp_file=`mktemp` - - tgtadm --lld $lld_name --op show --mode target | strings | tgt-admin -s | grep 'LUN\|Target' > $tmp_file - retcode=$? - while read line; do - # Check if we finished going over this target - if ((tgt_found == 1 && $(echo $line | grep -c "^Target") == 1)); then - break - fi - - # Check if we found the requested target - if (($(echo $line | grep -c "Target $tid:") == 1)); then - tgt_found=1 - continue - fi - - if ((tgt_found == 1 && $(echo $line | grep -c "LUN:") == 1)); then - curr_lun=$(echo $line | cut -d" " -f2) - if (($curr_lun > $next_vacant_lun)); then - break - else - next_vacant_lun=$((next_vacant_lun+1)) - fi - fi - done < $tmp_file - - rm -f $tmp_file - - if ((tgt_found == 0)); then - echo "Error: could not find a LUN for target $tid, guessing 1 as next vacant LUN" - return 1 - fi - if ((next_vacant_lun == 0)); then - echo "Error: could not find a LUN for target $tid, guessing 1 as next vacant LUN" - return 1 - fi - - return $next_vacant_lun -} - -err_exit() -{ - if ((new_tgt == 0)); then - exit 1 - fi - - echo "Deleting new target, tid=$tid" - tgtadm --lld $lld_name --op delete --mode target --tid $tid - res=$? - - if [ $res -ne 0 ]; then - echo "Error: failed to delete target, tid=$tid" - fi - - exit 1 -} - -check_if_tgt_exists() -{ - tgt_list=$(tgtadm --lld $lld_name --op show --mode target | strings | grep Target | cut -d" " -f3) - - for curr_tgt in $tgt_list; do - if [ $tgt_name = $curr_tgt ]; then - return 1 - fi - done - - return 0 -} - -if [ $# -eq 0 ]; then - usage - exit 1 -fi - -lld_name="iscsi" - -while getopts "d:n:b:t:h:" opt -do - case ${opt} in - d) - dev=$OPTARG;; - n) - tgt_name=$OPTARG;; - b) - bs_type=$OPTARG;; - t) - lld_name=$OPTARG;; - h*) - usage - exit 1 - esac -done - -shift $(($OPTIND - 1)) - -initiators=$* - -verify_params - -# Check if tgtd is running (we should have 2 daemons) -tgtd_count=`pidof tgtd | wc -w` -if [ $tgtd_count -lt 1 ]; then - echo "tgtd is not running" - echo "Exiting..." - exit 1 -fi - -echo "Using transport: $lld_name" - -if ! [[ $tgt_name =~ ^iqn ]]; then - tgt_name="iqn.2001-04.com.$(hostname -s)-$tgt_name" -fi - -# Make sure that a target with the same name doesn't exist -check_if_tgt_exists -if [ $? -eq 1 ]; then - echo "Error: target named $tgt_name already exists" - read -p "Add a new lun to the existing target? (yes/NO): " add_lun - if [ $add_lun != "yes" ]; then - exit 1 - fi - tid=$(tgtadm --lld $lld_name --op show --mode target | strings | grep $tgt_name | cut -d" " -f2) - tid=${tid%:} - new_tgt=0 -else - - i=0 - while [ true ] - do - let i=i+1 - tid=`find_vacant_tgt_id` - #tid=$? - # Create the new target - echo -n "Creating new target (name=$tgt_name, tid=$tid)..." - tgtoutput=`tgtadm --lld $lld_name --op new --mode target --tid $tid -T $tgt_name 2>&1` - res=$? - if [ "$tgtoutput" == "tgtadm: this target already exists" ]; then - echo "Target already exists (this should not happen)... Attempt $i" - elif [ $res -eq 0 ]; then # output is not about duplication and return value is zero, this is the normal condition - break - fi - if [ $i -eq 100 ]; then - echo "Too many attempts, giving up" - break - fi - done - if [ $res -ne 0 ]; then - echo "Error: failed to create target (name=$tgt_name, tid=$tid)" - exit 1 - fi - new_tgt=1 -fi -echo "OK" -find_vacant_lun $tid -lun=$? -echo "LUN ok, $lun" - -# Add a logical unit to the target -echo "Adding a logical unit ($dev) to target, tid=$tid" -if [ $bs_type ]; then - echo "Setting backing store type: $bs_type" - bs_opt="-E $bs_type" -fi -tgtadm --lld $lld_name --op new --mode logicalunit --tid $tid --lun $lun -b $dev $bs_opt -res=$? - -if [ $res -ne 0 ]; then - echo "Error: failed to add a logical unit ($dev) to target, tid=$tid" - err_exit -fi - -# Define which initiators can use this target -if test "$initiators" ; then - # Allow access only for specific initiators - echo "Accepting connections only from $initiators" - for initiator in $initiators; do - tgtadm --lld $lld_name --op bind --mode target --tid $tid -I $initiator - res=$? - - if [ $res -ne 0 ]; then - echo "Error: could not assign initiator $initiator to the target" - fi - done -else - # Allow access for everyone - echo "Accepting connections from all initiators" - tgtadm --lld $lld_name --op bind --mode target --tid $tid -I ALL - res=$? - - if [ $res -ne 0 ]; then - echo "Error: failed to set access for all initiators" - err_exit - fi -fi diff --git a/src/datastore_mad/remotes/iscsi/clone b/src/datastore_mad/remotes/iscsi/clone deleted file mode 100755 index f0bbabf70b..0000000000 --- a/src/datastore_mad/remotes/iscsi/clone +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # -# # -# 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}/iscsi.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/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/DATASTORE/TEMPLATE/BASE_IQN \ - /DS_DRIVER_ACTION_DATA/IMAGE/PATH \ - /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}" -BASE_IQN="${XPATH_ELEMENTS[j++]:-$BASE_IQN}" -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 - -# Check if 'TGTSETUPLUN' is installed -tgt_setup_lun_install "$DST_HOST" "$BASE_PATH" - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" - -LV_NAME="lv-one-${ID}" -IQN="$BASE_IQN:$DST_HOST.$VG_NAME.$LV_NAME" -DEV="/dev/$VG_NAME/$LV_NAME" - -LV_SRC=$(echo $SRC|awk -F. '{print $NF}') -DEV_SRC="/dev/$VG_NAME/$LV_SRC" - -CLONE_CMD=$(cat <&1) -MONITOR_STATUS=$? - -if [ "$MONITOR_STATUS" = "0" ]; then - echo "$MONITOR_DATA" | tr ' ' '\n' -else - echo "$MONITOR_DATA" - exit $MONITOR_STATUS -fi diff --git a/src/datastore_mad/remotes/iscsi/rm b/src/datastore_mad/remotes/iscsi/rm deleted file mode 100755 index ff244fa94c..0000000000 --- a/src/datastore_mad/remotes/iscsi/rm +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # -# # -# 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}/iscsi.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 - -BASE_IQN=`echo $SRC|$CUT -d: -f1` -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" - -IQN="$BASE_IQN:$DST_HOST.$VG_NAME.$LV_NAME" - -RM_COMMAND=$(cat < Use a dynamically loaded scripts directory. Not removing this due +#  to iSCSI addon: https://github.com/OpenNebula/addon-iscsi + # ------------------------------------------------------------------------------ # iSCSI functions diff --git a/src/oca/java/test/oned.conf b/src/oca/java/test/oned.conf index d430843dda..7f201c4f7b 100644 --- a/src/oca/java/test/oned.conf +++ b/src/oca/java/test/oned.conf @@ -390,7 +390,7 @@ VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ] TM_MAD = [ executable = "one_tm", - arguments = "-t 15 -d dummy,lvm,shared,shared_lvm,qcow2,ssh,vmfs,iscsi,ceph" + arguments = "-t 15 -d dummy,lvm,shared,shared_lvm,qcow2,ssh,vmfs,ceph" ] TM_MAD_CONF = [ @@ -442,13 +442,6 @@ TM_MAD_CONF = [ shared = "yes" ] -TM_MAD_CONF = [ - name = "iscsi", - ln_target = "NONE", - clone_target= "SELF", - shared = "yes" -] - TM_MAD_CONF = [ name = "ceph", ln_target = "NONE", @@ -471,7 +464,7 @@ TM_MAD_CONF = [ DATASTORE_MAD = [ executable = "one_datastore", - arguments = "-t 15 -d dummy,fs,vmfs,iscsi,lvm,ceph" + arguments = "-t 15 -d dummy,fs,vmfs,lvm,ceph" ] #******************************************************************************* diff --git a/src/tm_mad/iscsi/clone b/src/tm_mad/iscsi/clone deleted file mode 100755 index 9d82307a43..0000000000 --- a/src/tm_mad/iscsi/clone +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # -# # -# 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 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 - -DRIVER_PATH=$(dirname $0) - - . $TMCOMMON - -source ${DRIVER_PATH}/../../datastore/iscsi/iscsi.conf - -#------------------------------------------------------------------------------- -# Set src, dst path and dir -#------------------------------------------------------------------------------- - -TARGET=`arg_path $SRC` - -DST_PATH=`arg_path $DST` -DST_HOST=`arg_host $DST` -DST_DIR=`dirname $DST_PATH` - -#------------------------------------------------------------------------------- -# IQN and TARGETs -#------------------------------------------------------------------------------- - -IQN=$SRC -NEW_IQN=$IQN-$VMID - -VG_NAME=`echo $TARGET|$AWK -F. '{print $(NF-1)}'` -LV_NAME=`echo $TARGET|$AWK -F. '{print $(NF)}'` -SOURCE_DEV="/dev/$VG_NAME/$LV_NAME" - -TARGET_LV_NAME=`echo $LV_NAME-$VMID` -TARGET_DEV="/dev/${VG_NAME}/${TARGET_LV_NAME}" -TARGET_HOST="${TARGET%.$VG_NAME.$LV_NAME}" - -#------------------------------------------------------------------------------- -# Clone script -#------------------------------------------------------------------------------- - -CLONE_CMD=$(cat < vmid dsid -# - 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) - -DST=$1 - -VMID=$2 -DSID=$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 - -DRIVER_PATH=$(dirname $0) - -source ${DRIVER_PATH}/../../datastore/iscsi/iscsi.conf - -#------------------------------------------------------------------------------- -# 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` - -#------------------------------------------------------------------------------- -# Get IQN information -#------------------------------------------------------------------------------- - -DISK_ID=$(echo "$DST_PATH" | $AWK -F. '{print $NF}') - -XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin" - -unset i j XPATH_ELEMENTS - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <(onevm show -x $VMID| $XPATH \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SOURCE \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT) - -IQN="${XPATH_ELEMENTS[j++]}" -PERSISTENT="${XPATH_ELEMENTS[j++]}" - -if [ -z "$PERSISTENT" ]; then - NEW_IQN=$IQN-$VMID -else - NEW_IQN=$IQN -fi - -TARGET=`arg_path $IQN` -VG_NAME=`echo $TARGET|$AWK -F. '{print $(NF-1)}'` -LV_NAME=`echo $TARGET|$AWK -F. '{print $(NF)}'` -DEV="/dev/$VG_NAME/$LV_NAME" -TARGET_HOST="${TARGET%.$VG_NAME.$LV_NAME}" - -TARGET_LV_NAME=`echo $NEW_IQN|$AWK -F. '{print $(NF)}'` - -#------------------------------------------------------------------------------- -# Remove directory if dst_path is a directory -#------------------------------------------------------------------------------- - -if [ `is_disk $DST_PATH` -eq 0 ]; then - # Directory - log "Deleting $DST_PATH" - ssh_exec_and_log "$DST_HOST" "rm -rf $DST_PATH" "Error deleting $DST_PATH" - exit 0 -fi - -#------------------------------------------------------------------------------- -# Logout from the iSCSI target in the hypervisor -#------------------------------------------------------------------------------- - -LOGOUT_CMD=$(cat < vmid dsid -# -# - hostX is the target host to deploy the VM -# - 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 - -DRIVER_PATH=$(dirname $0) - -source ${DRIVER_PATH}/../../datastore/iscsi/iscsi.conf - -#------------------------------------------------------------------------------- -# Return if moving a disk, we will move them when moving the whole system_ds -# directory for the VM -#------------------------------------------------------------------------------- -SRC_PATH=`arg_path $SRC` -DST_PATH=`arg_path $DST` - -SRC_HOST=`arg_host $SRC` -DST_HOST=`arg_host $DST` - -DST_DIR=`dirname $DST_PATH` - -if [ `is_disk $SRC_PATH` -eq 0 ]; then - ssh_make_path $DST_HOST $DST_DIR - - log "Moving $SRC to $DST" - - exec_and_log "$SCP -r $SRC $DST" "Could not copy $SRC to $DST" - - ssh_exec_and_log "$SRC_HOST" "rm -rf $SRC_PATH" \ - "Could not remove $SRC_HOST:$SRC_PATH" - - exit 0 -fi - -if [ "$SRC" == "$DST" ]; then - log "Not moving $SRC to $DST, they are the same path" - exit 0 -fi -#------------------------------------------------------------------------------- -# Get image information -#------------------------------------------------------------------------------- - -XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin" - -unset i j XPATH_ELEMENTS - -DISK_ID=$(echo "$SRC_PATH" | $AWK -F. '{print $NF}') - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <(onevm show -x $VMID| $XPATH \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SOURCE \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/PERSISTENT) - -IQN="${XPATH_ELEMENTS[j++]}" -PERSISTENT="${XPATH_ELEMENTS[j++]}" - -if [ -z "$PERSISTENT" ]; then - IQN=$IQN-$VMID -fi - -#------------------------------------------------------------------------------- -# Start actions -#------------------------------------------------------------------------------- - -if is_iscsi "$SRC_HOST"; then - log "Logging out of $IQN in $SRC_HOST" - - LOGOUT_CMD=$(cat <