From 82eb4db59360b15aa0db7c3fb8701a5432b37812 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 4 Sep 2012 19:15:50 +0200 Subject: [PATCH 01/58] Add a pure VMFS TM VMware, with ssh or remote API mode --- install.sh | 3 ++- src/tm_mad/vmware/clone | 29 ++++++++++++++++++++++++++--- src/tm_mad/vmware/tm_vmwarerc | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 src/tm_mad/vmware/tm_vmwarerc diff --git a/install.sh b/install.sh index 1f11ba740f..db3f962ef7 100755 --- a/install.sh +++ b/install.sh @@ -876,7 +876,8 @@ TM_VMWARE_FILES="src/tm_mad/vmware/clone \ src/tm_mad/vmware/mkimage \ src/tm_mad/vmware/mv \ src/tm_mad/vmware/context \ - src/tm_mad/vmware/mvds" + src/tm_mad/vmware/mvds \ + src/tm_mad/vmware/tm_vmwarerc" TM_ISCSI_FILES="src/tm_mad/iscsi/clone \ src/tm_mad/iscsi/ln \ diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 39360e3324..c5a33e933e 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -32,12 +32,16 @@ DSID=$4 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 +source $(dirname $0)/tm_vmwarerc + #------------------------------------------------------------------------------- # Set dst path and dir #------------------------------------------------------------------------------- @@ -49,13 +53,30 @@ DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` -ssh_make_path $DST_HOST $DST_PATH +IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` +SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` +USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` +PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + + +DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" + + +if [ "$SSH" == "yes" ]; then + ssh_make_path $DST_HOST $DST_PATH +else + # Two calls needed since vifs cannot do a mkdir -p + vifs --server $DST_HOST --username $USERNAME --password $PASSWORD --mkdir "[$SYSTEM_DS_NAME] $VMID" + vifs --server $DST_HOST --username $USERNAME --password $PASSWORD --mkdir "$DST_DIR_WITHOUT_DS_PATH" +fi #------------------------------------------------------------------------------- # Clone (cp) SRC into DST #------------------------------------------------------------------------------- log "Cloning $SRC_PATH in $DST" +if [ "$SSH" == "yes" ]; then + CLONESCRIPT=$(cat < Date: Thu, 6 Sep 2012 18:40:52 +0200 Subject: [PATCH 02/58] Add all actions to TM VMware --- src/tm_mad/vmware/clone | 23 +++++---- src/tm_mad/vmware/context | 98 ++++++++++++++++++++++++++++++++++++++- src/tm_mad/vmware/delete | 64 ++++++++++++++++++++++++- src/tm_mad/vmware/ln | 80 +++++++++++++++++++++++++++++++- src/tm_mad/vmware/mkimage | 89 ++++++++++++++++++++++++++++++++++- src/tm_mad/vmware/mvds | 20 +++++++- 6 files changed, 356 insertions(+), 18 deletions(-) mode change 120000 => 100755 src/tm_mad/vmware/context mode change 120000 => 100755 src/tm_mad/vmware/delete mode change 120000 => 100755 src/tm_mad/vmware/ln mode change 120000 => 100755 src/tm_mad/vmware/mkimage diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index c5a33e933e..e232fe245d 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -52,22 +52,21 @@ DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` - -IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` -SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` -USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` -PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` - - -DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" - +if [ "$SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` + SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` + DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" +fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_PATH else # Two calls needed since vifs cannot do a mkdir -p - vifs --server $DST_HOST --username $USERNAME --password $PASSWORD --mkdir "[$SYSTEM_DS_NAME] $VMID" - vifs --server $DST_HOST --username $USERNAME --password $PASSWORD --mkdir "$DST_DIR_WITHOUT_DS_PATH" + exec_and_log 'vifs $VI_PARAMS --mkdir "[$SYSTEM_DS_NAME] $VMID"' "Cannot create [$SYSTEM_DS_NAME] $VMID in $DST_HOST" + exec_and_log 'vifs $VI_PARAMS --mkdir "$DST_DIR_WITHOUT_DS_PATH"' "Cannot create $DST_DIR_WITHOUT_DS_PATH in $DST_HOST" fi #------------------------------------------------------------------------------- @@ -92,7 +91,7 @@ EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else - $VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -i "$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk" -d thin "$DST_DIR_WITHOUT_DS_PATH/disk.vmdk" + exec_and_log '$VMKFSTOOLS $VI_PARAMS -i "$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk" -d thin "$DST_DIR_WITHOUT_DS_PATH/disk.vmdk"' "Error cloning $SRC to $DST" fi exit 0 diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmware/context deleted file mode 120000 index 921312e950..0000000000 --- a/src/tm_mad/vmware/context +++ /dev/null @@ -1 +0,0 @@ -../common/context \ No newline at end of file diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmware/context new file mode 100755 index 0000000000..9ccfb58224 --- /dev/null +++ b/src/tm_mad/vmware/context @@ -0,0 +1,97 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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. # +#--------------------------------------------------------------------------- # + +# context context.sh file1 file2 ... fileN host:remote_system_ds/disk.i vmid 0 +# - context.sh file are the contents of the context ISO +# - 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 +# - 0 is the target datastore (system) + +ARGV=("$@") + +DS_ID="${ARGV[$(($#-1))]}" +VM_ID="${ARGV[$(($#-2))]}" +DST="${ARGV[$(($#-3))]}" +SRC="${ARGV[@]:0:$(($#-3))}" + +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 + +source $(dirname $0)/tm_vmwarerc + +#------------------------------------------------------------------------------- +# Set dst path and dirs +#------------------------------------------------------------------------------- +DST_PATH=`arg_path $DST` +DST_HOST=`arg_host $DST` +DST_DIR=`dirname $DST_PATH` + +if [ "$SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" +fi + +if [ "$SSH" == "yes" ]; then + ssh_make_path $DST_HOST $DST_DIR +else + exec_and_log 'vifs $VI_PARAMS --mkdir "$DST_DIR"' "Cannot create $DST_DIR on %DST_HOST" +fi + +#------------------------------------------------------------------------------- +# Build the Context Block device (locally) and copy it remotely +#------------------------------------------------------------------------------- +log "Generating context block device at $DST" + +VM_ID=`basename $DST_DIR` +ISO_DIR="$DS_DIR/.isofiles/$VM_ID" +ISO_FILE="$ISO_DIR/$VM_ID.iso" + +exec_and_log "mkdir -p $ISO_DIR" "Could not create tmp dir to make context dev" + +for f in $SRC; do + case $f in + http://*) + exec_and_log "$WGET -P $ISO_DIR $f" "Error downloading $f" + ;; + *) + exec_and_log "cp -R $f $ISO_DIR" "Error copying $f to $ISO_DIR" + ;; + esac +done + +exec_and_log "$MKISOFS -o $ISO_FILE -J -R $ISO_DIR" "Error creating iso fs" + +if [ "$SSH" == "yes" ]; then + exec_and_log "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST" +else + # Copies the iso file with .iso suffix, needed for VMware CDROMs + exec_and_log 'vifs $VI_PARAMS -p $ISO_FILE $DST_PATH.iso' "Error copying context ISO to $DST" +fi + +rm -rf $ISO_DIR > /dev/null 2>&1 + +exit 0 diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete deleted file mode 120000 index 230e56774f..0000000000 --- a/src/tm_mad/vmware/delete +++ /dev/null @@ -1 +0,0 @@ -../common/delete \ No newline at end of file diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete new file mode 100755 index 0000000000..29043ae8c0 --- /dev/null +++ b/src/tm_mad/vmware/delete @@ -0,0 +1,63 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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 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 + VMWARERC=/etc/one/vmwarerc +else + TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh + VMWARERC=$ONE_LOCATION/etc/vmwarerc +fi + +. $TMCOMMON + +source $(dirname $0)/tm_vmwarerc + +#------------------------------------------------------------------------------- +# 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` + +if [ `is_disk $DST_PATH` -eq 1 ]; then + exit 0 +fi + +log "Deleting $DST_PATH" + +if [ "$SSH" == "yes" ]; then + ssh_exec_and_log $DST_HOST "rm -rf $DST_PATH" "Error deleting $DST_PATH" +else + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + exec_and_log '$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH' "Cannot delelete $DST" +fi + +exit 0 diff --git a/src/tm_mad/vmware/ln b/src/tm_mad/vmware/ln deleted file mode 120000 index 2926cd697b..0000000000 --- a/src/tm_mad/vmware/ln +++ /dev/null @@ -1 +0,0 @@ -../shared/ln \ No newline at end of file diff --git a/src/tm_mad/vmware/ln b/src/tm_mad/vmware/ln new file mode 100755 index 0000000000..ff534b58b9 --- /dev/null +++ b/src/tm_mad/vmware/ln @@ -0,0 +1,79 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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. # +#--------------------------------------------------------------------------- # + +# ln fe:SOURCE host:remote_system_ds/disk.i 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_PATH="../../${SRC_PATH##"$DS_DIR/"}" + +DST_PATH=`arg_path $DST` +DST_HOST=`arg_host $DST` +DST_DIR=`dirname $DST_PATH` + +#------------------------------------------------------------------------------- +# Link (ln) SRC into DST +#------------------------------------------------------------------------------- + +if [ "$SSH" == "yes" ]; then + ssh_make_path $DST_HOST $DST_PATH + + # It's a folder, make links for all elements + SRC_FOLDER_NAME=`basename $SRC_PATH` + SRC_WITH_NO_FOLDER=`dirname $SRC_PATH` + SRC_DS_NAME=`basename $SRC_WITH_NO_FOLDER` + REL_SRC_PATH="../../../$SRC_DS_NAME/$SRC_FOLDER_NAME" + + log "Link all files in $SRC_PATH to $DST_PATH" + +LINK_SCRIPT=$(cat < Date: Fri, 7 Sep 2012 18:49:03 +0200 Subject: [PATCH 03/58] feature #1441: Add extra line at the end of tm_vmwarerc --- src/tm_mad/vmware/tm_vmwarerc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tm_mad/vmware/tm_vmwarerc b/src/tm_mad/vmware/tm_vmwarerc index d5e7e2271b..7097f98345 100644 --- a/src/tm_mad/vmware/tm_vmwarerc +++ b/src/tm_mad/vmware/tm_vmwarerc @@ -17,4 +17,4 @@ # Whether the TM VMware driver should use to invoke the VMFS native commands # * remote API calls (value set to "no") # * ssh connection (value set to "yes") -SSH=no \ No newline at end of file +SSH=no From e63a0893ac7088f98949bc8f3a5584f1202d0062 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 7 Sep 2012 18:50:07 +0200 Subject: [PATCH 04/58] feature #1441: Add stub for VMFS datastore --- src/datastore_mad/remotes/libfs.sh | 18 +++ src/datastore_mad/remotes/vmfs/bridgelist | 3 + src/datastore_mad/remotes/vmfs/cp | 150 ++++++++++++++++++++++ src/datastore_mad/remotes/vmfs/mkfs | 94 ++++++++++++++ src/datastore_mad/remotes/vmfs/rm | 66 ++++++++++ src/datastore_mad/remotes/vmfs/vmfsrc | 18 +++ 6 files changed, 349 insertions(+) create mode 100644 src/datastore_mad/remotes/vmfs/bridgelist create mode 100755 src/datastore_mad/remotes/vmfs/cp create mode 100755 src/datastore_mad/remotes/vmfs/mkfs create mode 100755 src/datastore_mad/remotes/vmfs/rm create mode 100644 src/datastore_mad/remotes/vmfs/vmfsrc diff --git a/src/datastore_mad/remotes/libfs.sh b/src/datastore_mad/remotes/libfs.sh index 0f625ee90d..dfca4cb5b0 100644 --- a/src/datastore_mad/remotes/libfs.sh +++ b/src/datastore_mad/remotes/libfs.sh @@ -137,3 +137,21 @@ function check_restricted { echo 0 } + +#------------------------------------------------------------------------------- +# Gets the ESX host to be used as bridge to register a VMware disk +# Implements a round robin for the bridges +# @param $1 - Path to the list of ESX hosts to be used as bridges +# @return host to be used as bridge +#------------------------------------------------------------------------------- +function get_destination_host { + CONF_FILE_PATH="$1/bridgelist" + + BRIDGE_HOST=`head -1 $CONF_FILE_PATH` + + sed -i -e "1d" $CONF_FILE_PATH + + cat $BRIDGE_HOST >> $CONF_FILE_PATH + + echo $BRIDGE_HOST +} diff --git a/src/datastore_mad/remotes/vmfs/bridgelist b/src/datastore_mad/remotes/vmfs/bridgelist new file mode 100644 index 0000000000..f5e366f20f --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/bridgelist @@ -0,0 +1,3 @@ +bridge-esx-1.mydomain +bridge-esx-2.mydomain +bridge-esx-3.mydomain diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp new file mode 100755 index 0000000000..5d8bc21167 --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/cp @@ -0,0 +1,150 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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 + VMWARERC=/etc/one/vmwarerc +else + LIB_LOCATION=$ONE_LOCATION/lib + VMWARERC=$ONE_LOCATION/etc/vmwarerc +fi + +. $LIB_LOCATION/sh/scripts_common.sh + +DRIVER_PATH=$(dirname $0) +source ${DRIVER_PATH}/../libfs.sh +source $(dirname $0)/vmfsrc + +# -------- Get cp and datastore arguments from OpenNebula core ------------ + +DRV_ACTION=$1 +ID=$2 + +UTILS_PATH="${DRIVER_PATH}/.." + +XPATH="$UTILS_PATH/xpath.rb -b $DRV_ACTION" + +unset i 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/UMASK \ + /DS_DRIVER_ACTION_DATA/IMAGE/PATH \ + /DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5 \ + /DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1) + +BASE_PATH="${XPATH_ELEMENTS[0]}" +RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" +SAFE_DIRS="${XPATH_ELEMENTS[2]}" +UMASK="${XPATH_ELEMENTS[3]}" +SRC="${XPATH_ELEMENTS[4]}" +MD5="${XPATH_ELEMENTS[5]}" +SHA1="${XPATH_ELEMENTS[6]}" + +# Set up the datastore +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +DST=`generate_image_path` +DST_HOST=`get_destination_host` + +if [ "$SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" +fi + +# Create DST in DST_HOST +if [ "$SSH" == "yes" ]; then + ssh_make_path $DST_HOST $DST +else + exec_and_log 'vifs $VI_PARAMS --mkdir "$DST"' "Cannot create $DST in $DST_HOST" +fi + +# Prepare for a possible download in the front-end +if [ ! -d $TMP_DIR ]; then + mkdir -p $TMP_DIR +fi + +HASHES="" + +if [ -n "$MD5" ]; then + HASHES="$HASHES --md5 $MD5" +fi + +if [ -n "$SHA1" ]; then + HASHES="$HASHES --sha1 $SHA1" +fi + +COPY_COMMAND="$UTILS_PATH/downloader.sh $HASHES $SRC $TMP_DIR/$IMAGE_HASH" + +# ------------ Copy the image to the repository ------------- + +case $SRC in +http://*|https://* ) + log "Downloading $SRC to the image repository" + + exec_and_log "$COPY_COMMAND" "Error downloading $SRC" + ;; + +*) + 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 disk folder $SRC to the image repository" + + if [ ! -d $SRC ]; then + exec_and_log "$COPY_COMMAND" "Error copying $SRC to $TMP_DIR/$IMAGE_HASH" + fi + + SRC="$TMP_DIR/$IMAGE_HASH" + ;; +esac + +# Rename the disk filename to disk.vmdk (warning: it does so in SRC) +if [ ! -f $SRC/disk.vmdk ]; then + BASE_DISK_FILE=`ls $SRC | grep -v '\-\(flat\|delta\|s[0-9]*\)\.vmdk$'` + + exec_and_log "mv -f $DST/$BASE_DISK_FILE $DST/disk.vmdk" \ + "Error renaming disk file $BASE_DISK_FILE to disk.vmdk" +fi + +# Make the final hop, front-end -> VMFS Datastore +if [ "$SSH" == "yes" ]; then + exec_and_log "$SCP -r $SRC $DST" "Error copying $SRC to $DST through SCP" +else + cd $SRC + for file in $(find . -type f); do + FNAME=$(basename $file) + exec_and_log 'vifs $VI_PARAMS -p $file $DST/$FNAME' "Cannot upload $file to $DST/$FNAME on $DST_HOST" + done +fi + +echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs new file mode 100755 index 0000000000..13cd67afdf --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -0,0 +1,94 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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 + +# -------- Get mkfs and datastore arguments from OpenNebula core ------------ + +DRV_ACTION=$1 +ID=$2 + +XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" + +unset i 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/UMASK \ + /DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ + /DS_DRIVER_ACTION_DATA/IMAGE/SIZE) + +BASE_PATH="${XPATH_ELEMENTS[0]}" +RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" +SAFE_DIRS="${XPATH_ELEMENTS[2]}" +UMASK="${XPATH_ELEMENTS[3]}" +FSTYPE="${XPATH_ELEMENTS[4]}" +SIZE="${XPATH_ELEMENTS[5]}" + +mkdir -p "$BASE_PATH" +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +DST=`generate_image_path` + +# ------------ Image to save_as disk, no need to create a FS ------------ + +if [ "$FSTYPE" = "save_as" ]; then + echo "$DST" + exit 0 +fi + +# ------------ Create the image to the repository ------------ + +DISK=$DST/disk.vmdk +DISK_TMP=$DISK.tmp + +IMAGE_FORMAT=vmdk + +MKFS_CMD=`mkfs_command $DISK_TMP $FSTYPE` + +exec_and_log "mkdir -p $DST" \ + "Could not create disk directory $DST" +exec_and_log "$DD if=/dev/zero of=$DISK_TMP bs=1 count=1 seek=${SIZE}M" \ + "Could not create temporary image $DISK_TMP" +exec_and_log "$MKFS_CMD" \ + "Unable to create filesystem $FSTYPE in $DISK_TMP" +exec_and_log "$QEMU_IMG convert -O $IMAGE_FORMAT $DISK_TMP $DISK" \ + "Unable to convert to $IMAGE_FORMAT in $DISK_TMP" +exec_and_log "rm -f $DISK_TMP" \ + "Unable to remove temporary disk $DISK_TMP" + +echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm new file mode 100755 index 0000000000..bb3ac1601f --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/rm @@ -0,0 +1,66 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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 + +# -------- Get rm and datastore arguments from OpenNebula core ------------ + +DRV_ACTION=$1 +ID=$2 + +XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" + +unset i 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/BASE_PATH) + +SRC="${XPATH_ELEMENTS[0]}" +BASE_PATH="${XPATH_ELEMENTS[1]}" + +BASENAME_SRC=`basename "${SRC##$BASE_PATH}"` + +# ------------ Remove the image from the repository ------------ + +if [ -d "$SRC" -a `dirname "$SRC"` = "$BASE_PATH" -a -n "$BASENAME_SRC" ] +then + log "Removing $SRC from the image repository" + + exec_and_log "rm -r $SRC" \ + "Error deleting $SRC" +else + log_error "Bad formed or unavailable Image source: ${SRC}" + exit 1 +fi diff --git a/src/datastore_mad/remotes/vmfs/vmfsrc b/src/datastore_mad/remotes/vmfs/vmfsrc new file mode 100644 index 0000000000..bb6463166c --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/vmfsrc @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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. # +#--------------------------------------------------------------------------- # + +TMP_DIR=/var/lib/one/tmp +SSH=no From 8d8247ab8e7f5171f0bfab4fb420dc39b45ce937 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 7 Sep 2012 18:55:32 +0200 Subject: [PATCH 05/58] feature #1437: Stub for mkfs for VMFS datastore --- src/datastore_mad/remotes/vmfs/mkfs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 13cd67afdf..5c0e0a0bd5 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -25,14 +25,17 @@ if [ -z "${ONE_LOCATION}" ]; then LIB_LOCATION=/usr/lib/one + VMWARERC=/etc/one/vmwarerc else LIB_LOCATION=$ONE_LOCATION/lib + VMWARERC=$ONE_LOCATION/etc/vmwarerc fi . $LIB_LOCATION/sh/scripts_common.sh DRIVER_PATH=$(dirname $0) source ${DRIVER_PATH}/../libfs.sh +source $(dirname $0)/vmfsrc # -------- Get mkfs and datastore arguments from OpenNebula core ------------ @@ -59,10 +62,10 @@ UMASK="${XPATH_ELEMENTS[3]}" FSTYPE="${XPATH_ELEMENTS[4]}" SIZE="${XPATH_ELEMENTS[5]}" -mkdir -p "$BASE_PATH" set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" DST=`generate_image_path` +DST_HOST=`get_destination_host` # ------------ Image to save_as disk, no need to create a FS ------------ From b22ce33616ce0f866dc3381856a3c79f02e512de Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Sep 2012 15:44:09 +0200 Subject: [PATCH 06/58] feature #1437: Finishing VMDS Datastore --- src/datastore_mad/remotes/vmfs/mkfs | 41 ++++++++++++++++++----------- src/datastore_mad/remotes/vmfs/rm | 35 +++++++++++++++++------- src/tm_mad/vmware/mkimage | 2 +- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 5c0e0a0bd5..3f03dc58aa 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -52,6 +52,7 @@ 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/UMASK \ + /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ /DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ /DS_DRIVER_ACTION_DATA/IMAGE/SIZE) @@ -59,14 +60,24 @@ BASE_PATH="${XPATH_ELEMENTS[0]}" RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" SAFE_DIRS="${XPATH_ELEMENTS[2]}" UMASK="${XPATH_ELEMENTS[3]}" -FSTYPE="${XPATH_ELEMENTS[4]}" -SIZE="${XPATH_ELEMENTS[5]}" +IMAGE_DS_ID="${XPATH_ELEMENTS[4]}" +FSTYPE="${XPATH_ELEMENTS[5]}" +SIZE="${XPATH_ELEMENTS[6]}" set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" DST=`generate_image_path` +DST_DIR=`dirname $DST` +DST_FOLDER_NAME=`basename $DST` DST_HOST=`get_destination_host` +if [ "$SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + REMOTE_DS_ROUTE="$IMAGE_DS_ID]$DST_FOLDER_NAME" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" +fi + # ------------ Image to save_as disk, no need to create a FS ------------ if [ "$FSTYPE" = "save_as" ]; then @@ -74,24 +85,22 @@ if [ "$FSTYPE" = "save_as" ]; then exit 0 fi -# ------------ Create the image to the repository ------------ +# ------------ Create the image within the image datastore ------------ -DISK=$DST/disk.vmdk -DISK_TMP=$DISK.tmp +log "Making filesystem of ${SIZE}M (with no format) at $DST" IMAGE_FORMAT=vmdk +VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` -MKFS_CMD=`mkfs_command $DISK_TMP $FSTYPE` +if [ "$SSH" == "yes" ]; then + ssh_exec_and_log $DST_HOST "mkdir -p $DST" "Could not create disk directory $DST" + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U $DST/disk.vmdk" + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" +else + exec_and_log 'vifs $VI_PARAMS --mkdir "[$IMAGE_DS_ID] $DST_FOLDER_NAME"' "Cannot create [$IMAGE_DS_ID] $DST_FOLDER_NAME on $DST_HOST" -exec_and_log "mkdir -p $DST" \ - "Could not create disk directory $DST" -exec_and_log "$DD if=/dev/zero of=$DISK_TMP bs=1 count=1 seek=${SIZE}M" \ - "Could not create temporary image $DISK_TMP" -exec_and_log "$MKFS_CMD" \ - "Unable to create filesystem $FSTYPE in $DISK_TMP" -exec_and_log "$QEMU_IMG convert -O $IMAGE_FORMAT $DISK_TMP $DISK" \ - "Unable to convert to $IMAGE_FORMAT in $DISK_TMP" -exec_and_log "rm -f $DISK_TMP" \ - "Unable to remove temporary disk $DISK_TMP" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" +fi echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index bb3ac1601f..01bd6f2528 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -24,14 +24,17 @@ if [ -z "${ONE_LOCATION}" ]; then LIB_LOCATION=/usr/lib/one + VMWARERC=/etc/one/vmwarerc else LIB_LOCATION=$ONE_LOCATION/lib + VMWARERC=$ONE_LOCATION/etc/vmwarerc fi . $LIB_LOCATION/sh/scripts_common.sh DRIVER_PATH=$(dirname $0) source ${DRIVER_PATH}/../libfs.sh +source $(dirname $0)/vmfsrc # -------- Get rm and datastore arguments from OpenNebula core ------------ @@ -45,22 +48,34 @@ unset i 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/BASE_PATH) + /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ + ) SRC="${XPATH_ELEMENTS[0]}" -BASE_PATH="${XPATH_ELEMENTS[1]}" +DS_NAME="${XPATH_ELEMENTS[1]}" -BASENAME_SRC=`basename "${SRC##$BASE_PATH}"` +DST_HOST=`get_destination_host` +FOLDER_TO_ERASE=`dirname SRC` + +if [ "$SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" +fi # ------------ Remove the image from the repository ------------ -if [ -d "$SRC" -a `dirname "$SRC"` = "$BASE_PATH" -a -n "$BASENAME_SRC" ] -then - log "Removing $SRC from the image repository" +log "Removing $SRC from the image repository" - exec_and_log "rm -r $SRC" \ - "Error deleting $SRC" +if [ "$SSH" == "yes" ]; then + ssh_exec_and_log $DST_HOST "rm -r /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE" "Error deleting $SRC" else - log_error "Bad formed or unavailable Image source: ${SRC}" - exit 1 + # We have to erase the contents of the folder one by one + FILES_TO_ERASE=`vifs $VI_PARAMS --dir "[$DS_NAME] $FOLDER_TO_ERASE"|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for file in $FILES_TO_ERASE; do + exec_and_log 'vifs $VI_PARAMS --rm "[$DS_NAME] $FOLDER_TO_ERASE/$file"' "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST" + done + exec_and_log 'vifs $VI_PARAMS --rm "[$DS_NAME] $FOLDER_TO_ERASE"' "Cannot delete $FOLDER_TO_ERASE in $DST_HOST" fi + +exit 0 diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index 013705c205..8bf8e36582 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -82,7 +82,7 @@ else exec_and_log "VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2`" exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" fi exit 0 From 3e19fc727612140f02f6501e7040c376e1a20e9e Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Sep 2012 16:18:24 +0200 Subject: [PATCH 07/58] feature #1441: Add stat and vmfs datastore to install.sh --- install.sh | 9 +++++++++ src/datastore_mad/remotes/vmfs/stat | 1 + 2 files changed, 10 insertions(+) create mode 120000 src/datastore_mad/remotes/vmfs/stat diff --git a/install.sh b/install.sh index db3f962ef7..1ce9bf5f8e 100755 --- a/install.sh +++ b/install.sh @@ -424,6 +424,7 @@ INSTALL_FILES=( DATASTORE_DRIVER_DUMMY_SCRIPTS:$VAR_LOCATION/remotes/datastore/dummy DATASTORE_DRIVER_FS_SCRIPTS:$VAR_LOCATION/remotes/datastore/fs DATASTORE_DRIVER_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/datastore/vmware + 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 NETWORK_FILES:$VAR_LOCATION/remotes/vnm @@ -922,6 +923,14 @@ DATASTORE_DRIVER_VMWARE_SCRIPTS="src/datastore_mad/remotes/vmware/cp \ src/datastore_mad/remotes/vmware/clone \ src/datastore_mad/remotes/vmware/rm" +DATASTORE_DRIVER_VMFS_SCRIPTS="src/datastore_mad/remotes/vmfs/cp \ + src/datastore_mad/remotes/vmfs/mkfs \ + src/datastore_mad/remotes/vmfs/stat \ + src/datastore_mad/remotes/vmfs/clone \ + src/datastore_mad/remotes/vmfs/rm \ + src/datastore_mad/remotes/vmfs/bridgelist \ + src/datastore_mad/remotes/vmfs/vmfsrc" + DATASTORE_DRIVER_ISCSI_SCRIPTS="src/datastore_mad/remotes/iscsi/cp \ src/datastore_mad/remotes/iscsi/mkfs \ src/datastore_mad/remotes/iscsi/stat \ diff --git a/src/datastore_mad/remotes/vmfs/stat b/src/datastore_mad/remotes/vmfs/stat new file mode 120000 index 0000000000..65583e827b --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/stat @@ -0,0 +1 @@ +../common/stat \ No newline at end of file From f8eed22dc2fb373756fda6a5963f6a28ab910ef6 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Sep 2012 16:21:47 +0200 Subject: [PATCH 08/58] feature #1437: Add VMFS folder creation to install.sh --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 1ce9bf5f8e..afe80207ff 100755 --- a/install.sh +++ b/install.sh @@ -237,6 +237,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/datastore/dummy \ $VAR_LOCATION/remotes/datastore/fs \ $VAR_LOCATION/remotes/datastore/vmware \ + $VAR_LOCATION/remotes/datastore/vmfs \ $VAR_LOCATION/remotes/datastore/iscsi \ $VAR_LOCATION/remotes/datastore/lvm \ $VAR_LOCATION/remotes/auth \ From 8981255a0de1ffb143fd62c89301470ee90c6904 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Sep 2012 16:29:43 +0200 Subject: [PATCH 09/58] feature #1437: Add VMFS datastore to oned.conf --- share/etc/oned.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/etc/oned.conf b/share/etc/oned.conf index dfb86a9984..b4e8438b64 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -303,7 +303,7 @@ TM_MAD = [ DATASTORE_MAD = [ executable = "one_datastore", - arguments = "-t 15 -d fs,vmware,iscsi,lvm" + arguments = "-t 15 -d fs,vmware,vmfs,iscsi,lvm" ] #******************************************************************************* From fa4634f4d6a93e33b19679967c54d4236ded05b4 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Sep 2012 17:59:02 +0200 Subject: [PATCH 10/58] feature #1437: Add clone action to VMFS datastore --- src/datastore_mad/remotes/vmfs/clone | 83 ++++++++++++++++++++++++++++ src/datastore_mad/remotes/vmfs/rm | 4 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100755 src/datastore_mad/remotes/vmfs/clone diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone new file mode 100755 index 0000000000..e7ea970e13 --- /dev/null +++ b/src/datastore_mad/remotes/vmfs/clone @@ -0,0 +1,83 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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 + VMWARERC=/etc/one/vmwarerc +else + LIB_LOCATION=$ONE_LOCATION/lib + VMWARERC=$ONE_LOCATION/etc/vmwarerc +fi + +. $LIB_LOCATION/sh/scripts_common.sh + +DRIVER_PATH=$(dirname $0) +source ${DRIVER_PATH}/../libfs.sh +source $(dirname $0)/vmfsrc + +# -------- Get cp and datastore arguments from OpenNebula core ------------ + +DRV_ACTION=$1 +ID=$2 + +XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" + +unset i 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/UMASK \ + /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ + /DS_DRIVER_ACTION_DATA/IMAGE/PATH) + +BASE_PATH="${XPATH_ELEMENTS[0]}" +UMASK="${XPATH_ELEMENTS[1]}" +DS_ID="${XPATH_ELEMENTS[2]}" +SRC="${XPATH_ELEMENTS[3]}" +SRC_FOLDER=`basename $SRC` + +if [ "$SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" +fi + +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +DST=`generate_image_path` +DST_FOLDER=`basename $DST` + +# ------------ Copy the image to the repository ------------- + +log "Copying local image $SRC to the image repository" + +if [ "$SSH" == "yes" ]; then + ssh_exec_and_log "$VMKFSTOOLS $VI_PARAMS $SRC $DST" "Error copying $SRC to $DST" +else + exec_and_log 'vifs $VI_PARAMS --copy "[$DS_ID] $SRC_FOLDER" "[$DS_ID] $DST_FOLDER"' "Error copying $SRC to $DST" +fi + +echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 01bd6f2528..6a5b4cb279 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -68,7 +68,9 @@ fi log "Removing $SRC from the image repository" if [ "$SSH" == "yes" ]; then - ssh_exec_and_log $DST_HOST "rm -r /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE" "Error deleting $SRC" + if [ -n $DS_NAME -a -n $FOLDER_TO_ERASE -a -d /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE ]; then + ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE" "Error deleting $SRC" + fi else # We have to erase the contents of the folder one by one FILES_TO_ERASE=`vifs $VI_PARAMS --dir "[$DS_NAME] $FOLDER_TO_ERASE"|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` From 7392786781fd2fd9ecff71fd6dff84c079670973 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 11 Sep 2012 18:07:34 +0200 Subject: [PATCH 11/58] feature #1437: Get the correct bridgelist file --- src/datastore_mad/remotes/vmfs/clone | 11 ++++++----- src/datastore_mad/remotes/vmfs/cp | 2 +- src/datastore_mad/remotes/vmfs/mkfs | 2 +- src/datastore_mad/remotes/vmfs/rm | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index e7ea970e13..1e07f26a16 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -59,17 +59,18 @@ DS_ID="${XPATH_ELEMENTS[2]}" SRC="${XPATH_ELEMENTS[3]}" SRC_FOLDER=`basename $SRC` +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +DST=`generate_image_path` +DST_FOLDER=`basename $DST` +DST_HOST=`get_destination_host $(dirname $0)` + if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" - -DST=`generate_image_path` -DST_FOLDER=`basename $DST` - # ------------ Copy the image to the repository ------------- log "Copying local image $SRC to the image repository" diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 5d8bc21167..b5b9441a5f 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -70,7 +70,7 @@ SHA1="${XPATH_ELEMENTS[6]}" set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" DST=`generate_image_path` -DST_HOST=`get_destination_host` +DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 3f03dc58aa..0abb8df4c0 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -69,7 +69,7 @@ set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" DST=`generate_image_path` DST_DIR=`dirname $DST` DST_FOLDER_NAME=`basename $DST` -DST_HOST=`get_destination_host` +DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 6a5b4cb279..c1904f1bbf 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -54,7 +54,7 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \ SRC="${XPATH_ELEMENTS[0]}" DS_NAME="${XPATH_ELEMENTS[1]}" -DST_HOST=`get_destination_host` +DST_HOST=`get_destination_host $(dirname $0)` FOLDER_TO_ERASE=`dirname SRC` if [ "$SSH" != "yes" ]; then From b15513d495058ddc9dc0c89ccd7ef5695e97e37b Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Wed, 12 Sep 2012 18:20:36 +0200 Subject: [PATCH 12/58] feature #1437: Fixing quotes problem in VMFS drivers --- src/datastore_mad/remotes/libfs.sh | 2 +- src/datastore_mad/remotes/vmfs/clone | 2 +- src/datastore_mad/remotes/vmfs/cp | 4 ++-- src/datastore_mad/remotes/vmfs/rm | 4 ++-- src/tm_mad/vmware/clone | 6 +++--- src/tm_mad/vmware/context | 4 ++-- src/tm_mad/vmware/delete | 2 +- src/tm_mad/vmware/mkimage | 6 +++--- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/datastore_mad/remotes/libfs.sh b/src/datastore_mad/remotes/libfs.sh index dfca4cb5b0..408c7740b6 100644 --- a/src/datastore_mad/remotes/libfs.sh +++ b/src/datastore_mad/remotes/libfs.sh @@ -151,7 +151,7 @@ function get_destination_host { sed -i -e "1d" $CONF_FILE_PATH - cat $BRIDGE_HOST >> $CONF_FILE_PATH + echo $BRIDGE_HOST >> $CONF_FILE_PATH echo $BRIDGE_HOST } diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index 1e07f26a16..a87cf413af 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -78,7 +78,7 @@ log "Copying local image $SRC to the image repository" if [ "$SSH" == "yes" ]; then ssh_exec_and_log "$VMKFSTOOLS $VI_PARAMS $SRC $DST" "Error copying $SRC to $DST" else - exec_and_log 'vifs $VI_PARAMS --copy "[$DS_ID] $SRC_FOLDER" "[$DS_ID] $DST_FOLDER"' "Error copying $SRC to $DST" + exec_and_log "vifs $VI_PARAMS --copy \"[$DS_ID] $SRC_FOLDER\" \"[$DS_ID] $DST_FOLDER\"" "Error copying $SRC to $DST" fi echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index b5b9441a5f..da6063fbbd 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -82,7 +82,7 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST else - exec_and_log 'vifs $VI_PARAMS --mkdir "$DST"' "Cannot create $DST in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir $DST" "Cannot create $DST in $DST_HOST" fi # Prepare for a possible download in the front-end @@ -143,7 +143,7 @@ else cd $SRC for file in $(find . -type f); do FNAME=$(basename $file) - exec_and_log 'vifs $VI_PARAMS -p $file $DST/$FNAME' "Cannot upload $file to $DST/$FNAME on $DST_HOST" + exec_and_log "vifs $VI_PARAMS -p $file $DST/$FNAME" "Cannot upload $file to $DST/$FNAME on $DST_HOST" done fi diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index c1904f1bbf..c4c6b5c035 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -75,9 +75,9 @@ else # We have to erase the contents of the folder one by one FILES_TO_ERASE=`vifs $VI_PARAMS --dir "[$DS_NAME] $FOLDER_TO_ERASE"|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for file in $FILES_TO_ERASE; do - exec_and_log 'vifs $VI_PARAMS --rm "[$DS_NAME] $FOLDER_TO_ERASE/$file"' "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --rm \"[$DS_NAME] $FOLDER_TO_ERASE/$file\"" "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST" done - exec_and_log 'vifs $VI_PARAMS --rm "[$DS_NAME] $FOLDER_TO_ERASE"' "Cannot delete $FOLDER_TO_ERASE in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --rm \"[$DS_NAME] $FOLDER_TO_ERASE\"" "Cannot delete $FOLDER_TO_ERASE in $DST_HOST" fi exit 0 diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index e232fe245d..883f060e43 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -65,8 +65,8 @@ if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_PATH else # Two calls needed since vifs cannot do a mkdir -p - exec_and_log 'vifs $VI_PARAMS --mkdir "[$SYSTEM_DS_NAME] $VMID"' "Cannot create [$SYSTEM_DS_NAME] $VMID in $DST_HOST" - exec_and_log 'vifs $VI_PARAMS --mkdir "$DST_DIR_WITHOUT_DS_PATH"' "Cannot create $DST_DIR_WITHOUT_DS_PATH in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir \"[$SYSTEM_DS_NAME] $VMID\"" "Cannot create [$SYSTEM_DS_NAME] $VMID in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir \"$DST_DIR_WITHOUT_DS_PATH\"" "Cannot create $DST_DIR_WITHOUT_DS_PATH in $DST_HOST" fi #------------------------------------------------------------------------------- @@ -91,7 +91,7 @@ EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else - exec_and_log '$VMKFSTOOLS $VI_PARAMS -i "$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk" -d thin "$DST_DIR_WITHOUT_DS_PATH/disk.vmdk"' "Error cloning $SRC to $DST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i \"$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk\" -d thin \"$DST_DIR_WITHOUT_DS_PATH/disk.vmdk\"" "Error cloning $SRC to $DST" fi exit 0 diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmware/context index 9ccfb58224..a501980d1c 100755 --- a/src/tm_mad/vmware/context +++ b/src/tm_mad/vmware/context @@ -58,7 +58,7 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_DIR else - exec_and_log 'vifs $VI_PARAMS --mkdir "$DST_DIR"' "Cannot create $DST_DIR on %DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir \"$DST_DIR\"" "Cannot create $DST_DIR on %DST_HOST" fi #------------------------------------------------------------------------------- @@ -89,7 +89,7 @@ if [ "$SSH" == "yes" ]; then exec_and_log "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST" else # Copies the iso file with .iso suffix, needed for VMware CDROMs - exec_and_log 'vifs $VI_PARAMS -p $ISO_FILE $DST_PATH.iso' "Error copying context ISO to $DST" + exec_and_log "vifs $VI_PARAMS -p $ISO_FILE $DST_PATH.iso" "Error copying context ISO to $DST" fi rm -rf $ISO_DIR > /dev/null 2>&1 diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index 29043ae8c0..19cbd901fd 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -57,7 +57,7 @@ if [ "$SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` - exec_and_log '$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH' "Cannot delelete $DST" + exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" "Cannot delelete $DST" fi exit 0 diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index 8bf8e36582..babe4a6c66 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -77,10 +77,10 @@ EOF ssh_exec_and_log $DST_HOST "$MKSCRIPT" "Could not create image $DST_PATH" else # Two calls needed since vifs cannot do a mkdir -p - exec_and_log 'vifs $VI_PARAMS --mkdir "[$SYSTEM_DS_NAME] $VMID"' "Cannot create [$SYSTEM_DS_NAME] $VMID " - exec_and_log 'vifs $VI_PARAMS --mkdir "$DST_DIR_WITHOUT_DS_PATH"' + exec_and_log "vifs $VI_PARAMS --mkdir \"[$SYSTEM_DS_NAME] $VMID\"" "Cannot create [$SYSTEM_DS_NAME] $VMID" + exec_and_log "vifs $VI_PARAMS --mkdir \"$DST_DIR_WITHOUT_DS_PATH\"" - exec_and_log "VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2`" + VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" fi From e554d5cd26b75740c34a6faf809361eb7734ca5c Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Wed, 12 Sep 2012 20:05:54 +0200 Subject: [PATCH 13/58] feature #1437: Remove quotes in username and password --- src/datastore_mad/remotes/vmfs/clone | 4 ++-- src/datastore_mad/remotes/vmfs/cp | 24 ++++++++++++++---------- src/datastore_mad/remotes/vmfs/mkfs | 4 ++-- src/datastore_mad/remotes/vmfs/rm | 4 ++-- src/tm_mad/vmware/clone | 4 ++-- src/tm_mad/vmware/context | 4 ++-- src/tm_mad/vmware/delete | 4 ++-- src/tm_mad/vmware/mkimage | 4 ++-- src/tm_mad/vmware/mvds | 4 ++-- 9 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index a87cf413af..a605306ec6 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -66,8 +66,8 @@ DST_FOLDER=`basename $DST` DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index da6063fbbd..b2d0534507 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -51,6 +51,7 @@ unset i 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/ID \ /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS \ /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \ /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK \ @@ -59,22 +60,25 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \ /DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1) BASE_PATH="${XPATH_ELEMENTS[0]}" -RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" -SAFE_DIRS="${XPATH_ELEMENTS[2]}" -UMASK="${XPATH_ELEMENTS[3]}" -SRC="${XPATH_ELEMENTS[4]}" -MD5="${XPATH_ELEMENTS[5]}" -SHA1="${XPATH_ELEMENTS[6]}" +DS_ID="${XPATH_ELEMENTS[1]}" +RESTRICTED_DIRS="${XPATH_ELEMENTS[2]}" +SAFE_DIRS="${XPATH_ELEMENTS[3]}" +UMASK="${XPATH_ELEMENTS[4]}" +SRC="${XPATH_ELEMENTS[5]}" +MD5="${XPATH_ELEMENTS[6]}" +SHA1="${XPATH_ELEMENTS[7]}" # Set up the datastore set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" DST=`generate_image_path` +DST_FOLDER=`basename $DST` +DST="/vmfs/volumes/$DS_ID/$DST_FOLDER" DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi @@ -82,7 +86,7 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST else - exec_and_log "vifs $VI_PARAMS --mkdir $DST" "Cannot create $DST in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir \"[$DS_ID] $DST_FOLDER\"" "Cannot create $DST in $DST_HOST" fi # Prepare for a possible download in the front-end @@ -143,7 +147,7 @@ else cd $SRC for file in $(find . -type f); do FNAME=$(basename $file) - exec_and_log "vifs $VI_PARAMS -p $file $DST/$FNAME" "Cannot upload $file to $DST/$FNAME on $DST_HOST" + exec_and_log "vifs $VI_PARAMS -p $file \"[$DS_ID] $DST_FOLDER/$FNAME\"" "Cannot upload $file to $DST/$FNAME on $DST_HOST" done fi diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 0abb8df4c0..b99eb1003b 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -72,8 +72,8 @@ DST_FOLDER_NAME=`basename $DST` DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` REMOTE_DS_ROUTE="$IMAGE_DS_ID]$DST_FOLDER_NAME" VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index c4c6b5c035..4e188c2d82 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -58,8 +58,8 @@ DST_HOST=`get_destination_host $(dirname $0)` FOLDER_TO_ERASE=`dirname SRC` if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 883f060e43..56a526093c 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -53,8 +53,8 @@ DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmware/context index a501980d1c..3c7d8b57ba 100755 --- a/src/tm_mad/vmware/context +++ b/src/tm_mad/vmware/context @@ -50,8 +50,8 @@ DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index 19cbd901fd..746f28b124 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -55,8 +55,8 @@ log "Deleting $DST_PATH" if [ "$SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "rm -rf $DST_PATH" "Error deleting $DST_PATH" else - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" "Cannot delelete $DST" fi diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index babe4a6c66..3b96b0b79a 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -52,8 +52,8 @@ DST_DIR=`dirname $DST_PATH` if [ "$SSH" != "yes" ]; then SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi diff --git a/src/tm_mad/vmware/mvds b/src/tm_mad/vmware/mvds index b69e14c54f..25886030dd 100755 --- a/src/tm_mad/vmware/mvds +++ b/src/tm_mad/vmware/mvds @@ -43,8 +43,8 @@ fi source $(dirname $0)/tm_vmwarerc if [ "$SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3)` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3)` + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi From 1624deaf5f3f55d20ea1f97e1aefd4624f0625ae Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 11:49:06 +0200 Subject: [PATCH 14/58] feature #1437: fix vifs command not wrapping nicely with exec_and_log --- src/datastore_mad/remotes/vmfs/clone | 2 +- src/datastore_mad/remotes/vmfs/cp | 13 ++++++------- src/datastore_mad/remotes/vmfs/mkfs | 3 +-- src/datastore_mad/remotes/vmfs/rm | 6 +++--- src/tm_mad/vmware/clone | 8 +++++--- src/tm_mad/vmware/context | 6 ++++-- src/tm_mad/vmware/delete | 3 ++- src/tm_mad/vmware/ln | 3 ++- src/tm_mad/vmware/mkimage | 9 +++++---- src/tm_mad/vmware/mvds | 5 ++--- 10 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index a605306ec6..dda3ca9dfe 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -78,7 +78,7 @@ log "Copying local image $SRC to the image repository" if [ "$SSH" == "yes" ]; then ssh_exec_and_log "$VMKFSTOOLS $VI_PARAMS $SRC $DST" "Error copying $SRC to $DST" else - exec_and_log "vifs $VI_PARAMS --copy \"[$DS_ID] $SRC_FOLDER\" \"[$DS_ID] $DST_FOLDER\"" "Error copying $SRC to $DST" + exec_and_log "vifs $VI_PARAMS --copy [$DS_ID]$SRC_FOLDER [$DS_ID]$DST_FOLDER" "Error copying $SRC to $DST" fi echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index b2d0534507..54b7363c9b 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -71,8 +71,8 @@ SHA1="${XPATH_ELEMENTS[7]}" # Set up the datastore set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" -DST=`generate_image_path` -DST_FOLDER=`basename $DST` +FE_DST=`generate_image_path` +DST_FOLDER=`basename $FE_DST` DST="/vmfs/volumes/$DS_ID/$DST_FOLDER" DST_HOST=`get_destination_host $(dirname $0)` @@ -86,7 +86,7 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST else - exec_and_log "vifs $VI_PARAMS --mkdir \"[$DS_ID] $DST_FOLDER\"" "Cannot create $DST in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" "Cannot create $DST in $DST_HOST" fi # Prepare for a possible download in the front-end @@ -126,9 +126,8 @@ http://*|https://* ) if [ ! -d $SRC ]; then exec_and_log "$COPY_COMMAND" "Error copying $SRC to $TMP_DIR/$IMAGE_HASH" + SRC="$TMP_DIR/$IMAGE_HASH" fi - - SRC="$TMP_DIR/$IMAGE_HASH" ;; esac @@ -136,7 +135,7 @@ esac if [ ! -f $SRC/disk.vmdk ]; then BASE_DISK_FILE=`ls $SRC | grep -v '\-\(flat\|delta\|s[0-9]*\)\.vmdk$'` - exec_and_log "mv -f $DST/$BASE_DISK_FILE $DST/disk.vmdk" \ + exec_and_log "mv -f $FE_DST/$BASE_DISK_FILE $DST/disk.vmdk" \ "Error renaming disk file $BASE_DISK_FILE to disk.vmdk" fi @@ -147,7 +146,7 @@ else cd $SRC for file in $(find . -type f); do FNAME=$(basename $file) - exec_and_log "vifs $VI_PARAMS -p $file \"[$DS_ID] $DST_FOLDER/$FNAME\"" "Cannot upload $file to $DST/$FNAME on $DST_HOST" + exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" "Cannot upload $file to $DST/$FNAME on $DST_HOST" done fi diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index b99eb1003b..0bd1d5138b 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -74,7 +74,6 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - REMOTE_DS_ROUTE="$IMAGE_DS_ID]$DST_FOLDER_NAME" VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi @@ -97,7 +96,7 @@ if [ "$SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U $DST/disk.vmdk" ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" else - exec_and_log 'vifs $VI_PARAMS --mkdir "[$IMAGE_DS_ID] $DST_FOLDER_NAME"' "Cannot create [$IMAGE_DS_ID] $DST_FOLDER_NAME on $DST_HOST" + exec_and_log 'vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER_NAME' "Cannot create [$IMAGE_DS_ID] $DST_FOLDER_NAME on $DST_HOST" exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 4e188c2d82..2284b3b761 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -73,11 +73,11 @@ if [ "$SSH" == "yes" ]; then fi else # We have to erase the contents of the folder one by one - FILES_TO_ERASE=`vifs $VI_PARAMS --dir "[$DS_NAME] $FOLDER_TO_ERASE"|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_NAME]$FOLDER_TO_ERASE|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for file in $FILES_TO_ERASE; do - exec_and_log "vifs $VI_PARAMS --rm \"[$DS_NAME] $FOLDER_TO_ERASE/$file\"" "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --rm [$DS_NAME]$FOLDER_TO_ERASE/$file" "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST" done - exec_and_log "vifs $VI_PARAMS --rm \"[$DS_NAME] $FOLDER_TO_ERASE\"" "Cannot delete $FOLDER_TO_ERASE in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --rm [$DS_NAME]$FOLDER_TO_ERASE" "Cannot delete $FOLDER_TO_ERASE in $DST_HOST" fi exit 0 diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 56a526093c..cf8d6b0325 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -51,13 +51,14 @@ SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` +DST_FOLDER=`basename $DST_PATH` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` - DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" + DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME]${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi @@ -65,8 +66,9 @@ if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_PATH else # Two calls needed since vifs cannot do a mkdir -p - exec_and_log "vifs $VI_PARAMS --mkdir \"[$SYSTEM_DS_NAME] $VMID\"" "Cannot create [$SYSTEM_DS_NAME] $VMID in $DST_HOST" - exec_and_log "vifs $VI_PARAMS --mkdir \"$DST_DIR_WITHOUT_DS_PATH\"" "Cannot create $DST_DIR_WITHOUT_DS_PATH in $DST_HOST" + vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID + exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" \ + "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER in $DST_HOST" fi #------------------------------------------------------------------------------- diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmware/context index 3c7d8b57ba..5f15f9670a 100755 --- a/src/tm_mad/vmware/context +++ b/src/tm_mad/vmware/context @@ -48,6 +48,7 @@ source $(dirname $0)/tm_vmwarerc DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` +DST_FOLDER=`basename $DST_PATH` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` @@ -58,7 +59,9 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_DIR else - exec_and_log "vifs $VI_PARAMS --mkdir \"$DST_DIR\"" "Cannot create $DST_DIR on %DST_HOST" + vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID + exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID/$DST_FOLDER" \ + "Cannot create [$DS_ID]$VM_ID/$DST_FOLDER on %DST_HOST" fi #------------------------------------------------------------------------------- @@ -66,7 +69,6 @@ fi #------------------------------------------------------------------------------- log "Generating context block device at $DST" -VM_ID=`basename $DST_DIR` ISO_DIR="$DS_DIR/.isofiles/$VM_ID" ISO_FILE="$ISO_DIR/$VM_ID.iso" diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index 746f28b124..f2664cde51 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -57,7 +57,8 @@ if [ "$SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" "Cannot delelete $DST" + exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" \ + "Cannot delelete $DST" fi exit 0 diff --git a/src/tm_mad/vmware/ln b/src/tm_mad/vmware/ln index ff534b58b9..96aca88290 100755 --- a/src/tm_mad/vmware/ln +++ b/src/tm_mad/vmware/ln @@ -70,7 +70,8 @@ for file in \$(cd $DST_DIR ; find $SRC_PATH -type f); do done EOF ) - ssh_exec_and_log $DST_HOST "$LINK_SCRIPT" "Could not link dir files from source DS to system DS" + ssh_exec_and_log $DST_HOST "$LINK_SCRIPT" \ + "Could not link dir files from source DS to system DS" else log "Cannot link files without SSH enabled on the ESX hosts" exit 1 diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index 3b96b0b79a..bcd93f25b0 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -49,12 +49,12 @@ source $(dirname $0)/tm_vmwarerc DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` +DST_FOLDER=`basename $DST_PATH` if [ "$SSH" != "yes" ]; then SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME] ${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi @@ -77,12 +77,13 @@ EOF ssh_exec_and_log $DST_HOST "$MKSCRIPT" "Could not create image $DST_PATH" else # Two calls needed since vifs cannot do a mkdir -p - exec_and_log "vifs $VI_PARAMS --mkdir \"[$SYSTEM_DS_NAME] $VMID\"" "Cannot create [$SYSTEM_DS_NAME] $VMID" - exec_and_log "vifs $VI_PARAMS --mkdir \"$DST_DIR_WITHOUT_DS_PATH\"" + vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID + exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ + "Cannot create $DST/disk.vmdk on $DST_HOST" fi exit 0 diff --git a/src/tm_mad/vmware/mvds b/src/tm_mad/vmware/mvds index 25886030dd..215208402d 100755 --- a/src/tm_mad/vmware/mvds +++ b/src/tm_mad/vmware/mvds @@ -55,9 +55,7 @@ set_ds_location #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC`"/disk.vmdk" DST_PATH=`arg_path $DST` - DST_PATH="$RMT_DS_DIR/${DST_PATH##"$DS_DIR/"}/disk.vmdk" - SRC_HOST=`arg_host $SRC` #------------------------------------------------------------------------------- @@ -94,7 +92,8 @@ EOF ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image $DST_PATH" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -i $SRC_PATH -d thin $DST_PATH" "Could not move image $DST_PATH" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i $SRC_PATH -d thin $DST_PATH" \ + "Could not move image $DST_PATH" fi exit 0 From 95596bb25f3be8ee76b73b107c8f9f4910a7b237 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 13:12:01 +0200 Subject: [PATCH 15/58] feature #1437: Change var names for coherence --- src/datastore_mad/remotes/vmfs/clone | 3 ++- src/datastore_mad/remotes/vmfs/cp | 10 ++++++---- src/datastore_mad/remotes/vmfs/mkfs | 12 +++++++----- src/datastore_mad/remotes/vmfs/rm | 13 ++++++++----- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index dda3ca9dfe..67d958ea60 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -78,7 +78,8 @@ log "Copying local image $SRC to the image repository" if [ "$SSH" == "yes" ]; then ssh_exec_and_log "$VMKFSTOOLS $VI_PARAMS $SRC $DST" "Error copying $SRC to $DST" else - exec_and_log "vifs $VI_PARAMS --copy [$DS_ID]$SRC_FOLDER [$DS_ID]$DST_FOLDER" "Error copying $SRC to $DST" + exec_and_log "vifs $VI_PARAMS --copy [$DS_ID]$SRC_FOLDER [$DS_ID]$DST_FOLDER" \ + "Error copying $SRC to $DST" fi echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 54b7363c9b..3dd91b2fe5 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -86,7 +86,8 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST else - exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" "Cannot create $DST in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ + "Cannot create $DST in $DST_HOST" fi # Prepare for a possible download in the front-end @@ -135,8 +136,8 @@ esac if [ ! -f $SRC/disk.vmdk ]; then BASE_DISK_FILE=`ls $SRC | grep -v '\-\(flat\|delta\|s[0-9]*\)\.vmdk$'` - exec_and_log "mv -f $FE_DST/$BASE_DISK_FILE $DST/disk.vmdk" \ - "Error renaming disk file $BASE_DISK_FILE to disk.vmdk" + exec_and_log "mv -f $SRC/$BASE_DISK_FILE $SRC/disk.vmdk" \ + "Error renaming disk file $SRC/$BASE_DISK_FILE to $SRC/disk.vmdk" fi # Make the final hop, front-end -> VMFS Datastore @@ -146,7 +147,8 @@ else cd $SRC for file in $(find . -type f); do FNAME=$(basename $file) - exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" "Cannot upload $file to $DST/$FNAME on $DST_HOST" + exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" \ + "Cannot upload $file to $DST/$FNAME on $DST_HOST" done fi diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 0bd1d5138b..5b133e49e6 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -68,7 +68,7 @@ set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" DST=`generate_image_path` DST_DIR=`dirname $DST` -DST_FOLDER_NAME=`basename $DST` +DST_FOLDER=`basename $DST` DST_HOST=`get_destination_host $(dirname $0)` if [ "$SSH" != "yes" ]; then @@ -94,12 +94,14 @@ VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` if [ "$SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "mkdir -p $DST" "Could not create disk directory $DST" ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U $DST/disk.vmdk" - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ + "Cannot create $DST/disk.vmdk on $DST_HOST" else - exec_and_log 'vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER_NAME' "Cannot create [$IMAGE_DS_ID] $DST_FOLDER_NAME on $DST_HOST" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" "Cannot create $DST/disk.vmdk on $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \ + "Cannot create [$IMAGE_DS_ID] $DST_FOLDER on $DST_HOST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ + "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 2284b3b761..ed122633f4 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -55,7 +55,7 @@ SRC="${XPATH_ELEMENTS[0]}" DS_NAME="${XPATH_ELEMENTS[1]}" DST_HOST=`get_destination_host $(dirname $0)` -FOLDER_TO_ERASE=`dirname SRC` +DST_FOLDER=`basename $SRC` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` @@ -68,16 +68,19 @@ fi log "Removing $SRC from the image repository" if [ "$SSH" == "yes" ]; then - if [ -n $DS_NAME -a -n $FOLDER_TO_ERASE -a -d /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE ]; then - ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$FOLDER_TO_ERASE" "Error deleting $SRC" + if [ -n $DS_NAME -a -n $DST_FOLDER ]; then + ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$DST_FOLDER" \ + "Error deleting $SRC" fi else # We have to erase the contents of the folder one by one FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_NAME]$FOLDER_TO_ERASE|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for file in $FILES_TO_ERASE; do - exec_and_log "vifs $VI_PARAMS --rm [$DS_NAME]$FOLDER_TO_ERASE/$file" "Cannot delete $FOLDER_TO_ERASE/$file in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER/$file"\ + "Cannot delete $DST_FOLDER/$file in $DST_HOST" done - exec_and_log "vifs $VI_PARAMS --rm [$DS_NAME]$FOLDER_TO_ERASE" "Cannot delete $FOLDER_TO_ERASE in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER" \ + "Cannot delete $DST_FOLDER in $DST_HOST" fi exit 0 From ad787ea97139bda51aca3707490b4e933c1d577d Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 13:47:06 +0200 Subject: [PATCH 16/58] feature #1437: Get rid of trailing whitespaces --- src/datastore_mad/remotes/vmfs/cp | 6 +++--- src/datastore_mad/remotes/vmfs/mkfs | 15 ++++++++------- src/datastore_mad/remotes/vmfs/rm | 8 ++++---- src/tm_mad/vmware/clone | 5 +++-- src/tm_mad/vmware/context | 5 +++-- src/tm_mad/vmware/delete | 2 +- src/tm_mad/vmware/ln | 2 +- src/tm_mad/vmware/mkimage | 2 +- src/tm_mad/vmware/mvds | 2 +- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 3dd91b2fe5..d3b7134e2f 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -86,7 +86,7 @@ fi if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST else - exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ + exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ "Cannot create $DST in $DST_HOST" fi @@ -136,7 +136,7 @@ esac if [ ! -f $SRC/disk.vmdk ]; then BASE_DISK_FILE=`ls $SRC | grep -v '\-\(flat\|delta\|s[0-9]*\)\.vmdk$'` - exec_and_log "mv -f $SRC/$BASE_DISK_FILE $SRC/disk.vmdk" \ + exec_and_log "mv -f $SRC/$BASE_DISK_FILE $SRC/disk.vmdk" \ "Error renaming disk file $SRC/$BASE_DISK_FILE to $SRC/disk.vmdk" fi @@ -147,7 +147,7 @@ else cd $SRC for file in $(find . -type f); do FNAME=$(basename $file) - exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" \ + exec_and_log "vifs $VI_PARAMS -p $file [$DS_ID]$DST_FOLDER/$FNAME" \ "Cannot upload $file to $DST/$FNAME on $DST_HOST" done fi diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 5b133e49e6..1daf2648ca 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -86,19 +86,20 @@ fi # ------------ Create the image within the image datastore ------------ -log "Making filesystem of ${SIZE}M (with no format) at $DST" +log "Making filesystem of ${SIZE}M (with no format) at [$IMAGE_DS_ID]$DST_FOLDER on $DST_HOST" IMAGE_FORMAT=vmdk VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` if [ "$SSH" == "yes" ]; then - ssh_exec_and_log $DST_HOST "mkdir -p $DST" "Could not create disk directory $DST" - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U $DST/disk.vmdk" - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ - "Cannot create $DST/disk.vmdk on $DST_HOST" + ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" \ + "Could not create disk directory /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER on $DST_HOST" + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ + "Cannot create [$IMAGE_DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \ + exec_and_log "$VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" + exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \ "Cannot create [$IMAGE_DS_ID] $DST_FOLDER on $DST_HOST" exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index ed122633f4..c93fc23b2d 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -69,17 +69,17 @@ log "Removing $SRC from the image repository" if [ "$SSH" == "yes" ]; then if [ -n $DS_NAME -a -n $DST_FOLDER ]; then - ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$DST_FOLDER" \ + ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$DST_FOLDER" \ "Error deleting $SRC" fi else # We have to erase the contents of the folder one by one - FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_NAME]$FOLDER_TO_ERASE|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_NAME]$DST_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for file in $FILES_TO_ERASE; do - exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER/$file"\ + exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER/$file" \ "Cannot delete $DST_FOLDER/$file in $DST_HOST" done - exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER" \ + exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER" \ "Cannot delete $DST_FOLDER in $DST_HOST" fi diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index cf8d6b0325..0c9855a58e 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -67,7 +67,7 @@ if [ "$SSH" == "yes" ]; then else # Two calls needed since vifs cannot do a mkdir -p vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID - exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" \ + exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" \ "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER in $DST_HOST" fi @@ -93,7 +93,8 @@ EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -i \"$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk\" -d thin \"$DST_DIR_WITHOUT_DS_PATH/disk.vmdk\"" "Error cloning $SRC to $DST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i \"$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk\" -d thin \"$DST_DIR_WITHOUT_DS_PATH/disk.vmdk\"" \ + "Error cloning $SRC to $DST" fi exit 0 diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmware/context index 5f15f9670a..2e45357d37 100755 --- a/src/tm_mad/vmware/context +++ b/src/tm_mad/vmware/context @@ -61,7 +61,7 @@ if [ "$SSH" == "yes" ]; then else vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID/$DST_FOLDER" \ - "Cannot create [$DS_ID]$VM_ID/$DST_FOLDER on %DST_HOST" + "Cannot create [$DS_ID]$VM_ID/$DST_FOLDER on $DST_HOST" fi #------------------------------------------------------------------------------- @@ -91,7 +91,8 @@ if [ "$SSH" == "yes" ]; then exec_and_log "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST" else # Copies the iso file with .iso suffix, needed for VMware CDROMs - exec_and_log "vifs $VI_PARAMS -p $ISO_FILE $DST_PATH.iso" "Error copying context ISO to $DST" + exec_and_log "vifs $VI_PARAMS -p $ISO_FILE $DST_PATH.iso" \ + "Error copying context ISO to $DST" fi rm -rf $ISO_DIR > /dev/null 2>&1 diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index f2664cde51..4ab03ced7f 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -57,7 +57,7 @@ if [ "$SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" \ + exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" \ "Cannot delelete $DST" fi diff --git a/src/tm_mad/vmware/ln b/src/tm_mad/vmware/ln index 96aca88290..cf6dacf3e1 100755 --- a/src/tm_mad/vmware/ln +++ b/src/tm_mad/vmware/ln @@ -70,7 +70,7 @@ for file in \$(cd $DST_DIR ; find $SRC_PATH -type f); do done EOF ) - ssh_exec_and_log $DST_HOST "$LINK_SCRIPT" \ + ssh_exec_and_log $DST_HOST "$LINK_SCRIPT" \ "Could not link dir files from source DS to system DS" else log "Cannot link files without SSH enabled on the ESX hosts" diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index bcd93f25b0..a91cf68bb6 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -82,7 +82,7 @@ else VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ "Cannot create $DST/disk.vmdk on $DST_HOST" fi diff --git a/src/tm_mad/vmware/mvds b/src/tm_mad/vmware/mvds index 215208402d..6a5e779e74 100755 --- a/src/tm_mad/vmware/mvds +++ b/src/tm_mad/vmware/mvds @@ -92,7 +92,7 @@ EOF ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image $DST_PATH" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -i $SRC_PATH -d thin $DST_PATH" \ + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i $SRC_PATH -d thin $DST_PATH" \ "Could not move image $DST_PATH" fi From 65113f0dfc7e742dd7e27fa651c1cf0527c3d7a9 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 14:13:16 +0200 Subject: [PATCH 17/58] feature #1437: Get rid of bogus log line --- src/datastore_mad/remotes/vmfs/mkfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 1daf2648ca..35c65e92d7 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -98,11 +98,11 @@ if [ "$SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ "Cannot create [$IMAGE_DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" + $VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \ "Cannot create [$IMAGE_DS_ID] $DST_FOLDER on $DST_HOST" exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi -echo "$DST" +echo "/vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER/disk.vmdk" From df2b13dc23a0d781e681204b7d3366292a8dc06c Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 15:04:08 +0200 Subject: [PATCH 18/58] feature #1437: Prevent fail for pre existing folder --- src/datastore_mad/remotes/vmfs/mkfs | 4 ++-- src/datastore_mad/remotes/vmfs/rm | 2 +- src/tm_mad/vmware/clone | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 35c65e92d7..17062f6323 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -95,13 +95,13 @@ if [ "$SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" \ "Could not create disk directory /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER on $DST_HOST" ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ "Cannot create [$IMAGE_DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else $VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \ "Cannot create [$IMAGE_DS_ID] $DST_FOLDER on $DST_HOST" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index c93fc23b2d..48d28b1809 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -55,7 +55,7 @@ SRC="${XPATH_ELEMENTS[0]}" DS_NAME="${XPATH_ELEMENTS[1]}" DST_HOST=`get_destination_host $(dirname $0)` -DST_FOLDER=`basename $SRC` +DST_FOLDER=`basename $(dirname $SRC)` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 0c9855a58e..d8a458d9af 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -47,6 +47,7 @@ source $(dirname $0)/tm_vmwarerc #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC` SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" +SRC_FOLDER=`basename $SRC_PATH` DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` @@ -56,7 +57,7 @@ DST_FOLDER=`basename $DST_PATH` if [ "$SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` + IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME]${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" @@ -66,9 +67,8 @@ if [ "$SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_PATH else # Two calls needed since vifs cannot do a mkdir -p - vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID - exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" \ - "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER in $DST_HOST" + vifs $VI_PARAMS --force --mkdir [$SYSTEM_DS_NAME]$VMID &> /dev/null + vifs $VI_PARAMS --force --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER &> /dev/null fi #------------------------------------------------------------------------------- @@ -93,7 +93,7 @@ EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -i \"$SRC_DIR_WITHOUT_DS_PATH/disk.vmdk\" -d thin \"$DST_DIR_WITHOUT_DS_PATH/disk.vmdk\"" \ + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i [$IMAGE_DS_NAME]$SRC_FOLDER/disk.vmdk -d thin [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ "Error cloning $SRC to $DST" fi From 211d5105fee8bb1ebfea96185d6b92a3c734efae Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 16:01:24 +0200 Subject: [PATCH 19/58] feature #1437: Fix badTM actions --- src/datastore_mad/remotes/vmfs/mkfs | 2 +- src/tm_mad/vmware/clone | 3 ++- src/tm_mad/vmware/delete | 17 +++++++++++++++-- src/tm_mad/vmware/mkimage | 6 +++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 17062f6323..b21b925a42 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -105,4 +105,4 @@ else "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi -echo "/vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER/disk.vmdk" +echo "/vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index d8a458d9af..6612b61e54 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -47,7 +47,7 @@ source $(dirname $0)/tm_vmwarerc #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC` SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" -SRC_FOLDER=`basename $SRC_PATH` +SRC_FOLDER=`basename $(dirname $SRC_PATH)` DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` @@ -93,6 +93,7 @@ EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else + $VMKFSTOOLS $VI_PARAMS -U [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk &> /dev/null exec_and_log "$VMKFSTOOLS $VI_PARAMS -i [$IMAGE_DS_NAME]$SRC_FOLDER/disk.vmdk -d thin [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ "Error cloning $SRC to $DST" fi diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index 4ab03ced7f..78ec0bd785 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -57,8 +57,21 @@ if [ "$SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" \ - "Cannot delelete $DST" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + + DIRS_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for dir in $DIRS_TO_ERASE; do + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID/$dir|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for file in $FILES_TO_ERASE; do + exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID/$dir/$file" \ + "Cannot delete [$DSID]$VMID/$dir/$file in $DST_HOST" + done + exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID/$dir" \ + "Cannot delete [$DSID]$VMID in $DST_HOST" + done + exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID" \ + "Cannot delete [$DSID]$VMID in $DST_HOST" + fi exit 0 diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index a91cf68bb6..d824b8660f 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -78,12 +78,12 @@ EOF else # Two calls needed since vifs cannot do a mkdir -p vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID - exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" + vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ - "Cannot create $DST/disk.vmdk on $DST_HOST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ + "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk on $DST_HOST" fi exit 0 From a747d2761c97a3eb7de14e241eaab30697112eed Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 16:01:24 +0200 Subject: [PATCH 20/58] feature #1437: Fix badTM actions --- src/datastore_mad/remotes/vmfs/mkfs | 2 +- src/tm_mad/vmware/clone | 3 ++- src/tm_mad/vmware/delete | 17 +++++++++++++++-- src/tm_mad/vmware/mkimage | 6 +++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 17062f6323..b21b925a42 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -105,4 +105,4 @@ else "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi -echo "/vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER/disk.vmdk" +echo "/vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index d8a458d9af..6612b61e54 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -47,7 +47,7 @@ source $(dirname $0)/tm_vmwarerc #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC` SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" -SRC_FOLDER=`basename $SRC_PATH` +SRC_FOLDER=`basename $(dirname $SRC_PATH)` DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` @@ -93,6 +93,7 @@ EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else + $VMKFSTOOLS $VI_PARAMS -U [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk &> /dev/null exec_and_log "$VMKFSTOOLS $VI_PARAMS -i [$IMAGE_DS_NAME]$SRC_FOLDER/disk.vmdk -d thin [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ "Error cloning $SRC to $DST" fi diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index 4ab03ced7f..78ec0bd785 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -57,8 +57,21 @@ if [ "$SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - exec_and_log "$VMKFSTOOLS --server $DST_HOST --username $USERNAME --password $PASSWORD -U $DST_PATH" \ - "Cannot delelete $DST" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + + DIRS_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for dir in $DIRS_TO_ERASE; do + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID/$dir|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for file in $FILES_TO_ERASE; do + exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID/$dir/$file" \ + "Cannot delete [$DSID]$VMID/$dir/$file in $DST_HOST" + done + exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID/$dir" \ + "Cannot delete [$DSID]$VMID in $DST_HOST" + done + exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID" \ + "Cannot delete [$DSID]$VMID in $DST_HOST" + fi exit 0 diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index a91cf68bb6..d824b8660f 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -78,12 +78,12 @@ EOF else # Two calls needed since vifs cannot do a mkdir -p vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID - exec_and_log "vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER" + vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ - "Cannot create $DST/disk.vmdk on $DST_HOST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ + "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk on $DST_HOST" fi exit 0 From 59d0fd7762c05de9757de60a0bdcfc4f035e8a41 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 16:22:19 +0200 Subject: [PATCH 21/58] feature #1437: disk.vmdk is not used for source anymore --- src/tm_mad/vmware/clone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 6612b61e54..52cdf9b8e9 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -47,7 +47,7 @@ source $(dirname $0)/tm_vmwarerc #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC` SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" -SRC_FOLDER=`basename $(dirname $SRC_PATH)` +SRC_FOLDER=`basename $SRC_PATH` DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` From a3aca6f2e12a3ec8418fa7cd8397dc3ddc96c432 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 16:29:31 +0200 Subject: [PATCH 22/58] feature #1437: Get rid of extra dirname --- src/tm_mad/vmware/clone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 6612b61e54..52cdf9b8e9 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -47,7 +47,7 @@ source $(dirname $0)/tm_vmwarerc #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC` SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" -SRC_FOLDER=`basename $(dirname $SRC_PATH)` +SRC_FOLDER=`basename $SRC_PATH` DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` From 68f294873c82859ca4e118bb1e420b91a057530e Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 17:00:14 +0200 Subject: [PATCH 23/58] feature #1437: Not care if the 'just-in-case' delete fails --- src/tm_mad/vmware/delete | 3 +++ src/tm_mad/vmware/mkimage | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmware/delete index 78ec0bd785..93fed2b274 100755 --- a/src/tm_mad/vmware/delete +++ b/src/tm_mad/vmware/delete @@ -27,6 +27,9 @@ DST=$1 VMID=$2 DSID=$3 +# Wait for the cancel action on the VM to complete +sleep 10 + if [ -z "${ONE_LOCATION}" ]; then TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh VMWARERC=/etc/one/vmwarerc diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmware/mkimage index d824b8660f..a194980623 100755 --- a/src/tm_mad/vmware/mkimage +++ b/src/tm_mad/vmware/mkimage @@ -81,7 +81,7 @@ else vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` - exec_and_log "$VMKFSTOOLS $VI_PARAMS -U $DST_PATH/disk.vmdk" + $VMKFSTOOLS $VI_PARAMS -U [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk &> /dev/null exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk on $DST_HOST" fi From 569d36b2674840c93f23564a6b0102cd85ff2f38 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 13 Sep 2012 20:32:27 +0200 Subject: [PATCH 24/58] =?UTF-8?q?feature=20=C2#1437:=20Fix=20por=20choice?= =?UTF-8?q?=20of=20env=20var=20name=20(facepalm)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/datastore_mad/remotes/vmfs/clone | 4 ++-- src/datastore_mad/remotes/vmfs/cp | 6 +++--- src/datastore_mad/remotes/vmfs/mkfs | 4 ++-- src/datastore_mad/remotes/vmfs/rm | 6 +++--- src/datastore_mad/remotes/vmfs/vmfsrc | 2 +- src/tm_mad/vmware/clone | 6 +++--- src/tm_mad/vmware/context | 6 +++--- src/tm_mad/vmware/delete | 2 +- src/tm_mad/vmware/ln | 2 +- src/tm_mad/vmware/mkimage | 4 ++-- src/tm_mad/vmware/mvds | 4 ++-- src/tm_mad/vmware/tm_vmwarerc | 2 +- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index 67d958ea60..36ef27e23b 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -65,7 +65,7 @@ DST=`generate_image_path` DST_FOLDER=`basename $DST` DST_HOST=`get_destination_host $(dirname $0)` -if [ "$SSH" != "yes" ]; then +if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" @@ -75,7 +75,7 @@ fi log "Copying local image $SRC to the image repository" -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then ssh_exec_and_log "$VMKFSTOOLS $VI_PARAMS $SRC $DST" "Error copying $SRC to $DST" else exec_and_log "vifs $VI_PARAMS --copy [$DS_ID]$SRC_FOLDER [$DS_ID]$DST_FOLDER" \ diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index d3b7134e2f..76f0ab6373 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -76,14 +76,14 @@ DST_FOLDER=`basename $FE_DST` DST="/vmfs/volumes/$DS_ID/$DST_FOLDER" DST_HOST=`get_destination_host $(dirname $0)` -if [ "$SSH" != "yes" ]; then +if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi # Create DST in DST_HOST -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST else exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ @@ -141,7 +141,7 @@ if [ ! -f $SRC/disk.vmdk ]; then fi # Make the final hop, front-end -> VMFS Datastore -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then exec_and_log "$SCP -r $SRC $DST" "Error copying $SRC to $DST through SCP" else cd $SRC diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index b21b925a42..8232a8337e 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -71,7 +71,7 @@ DST_DIR=`dirname $DST` DST_FOLDER=`basename $DST` DST_HOST=`get_destination_host $(dirname $0)` -if [ "$SSH" != "yes" ]; then +if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" @@ -91,7 +91,7 @@ log "Making filesystem of ${SIZE}M (with no format) at [$IMAGE_DS_ID]$DST_FOLDER IMAGE_FORMAT=vmdk VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" \ "Could not create disk directory /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER on $DST_HOST" ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 48d28b1809..b393c802c1 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -55,9 +55,9 @@ SRC="${XPATH_ELEMENTS[0]}" DS_NAME="${XPATH_ELEMENTS[1]}" DST_HOST=`get_destination_host $(dirname $0)` -DST_FOLDER=`basename $(dirname $SRC)` +DST_FOLDER=`basename $SRC` -if [ "$SSH" != "yes" ]; then +if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" @@ -67,7 +67,7 @@ fi log "Removing $SRC from the image repository" -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then if [ -n $DS_NAME -a -n $DST_FOLDER ]; then ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$DST_FOLDER" \ "Error deleting $SRC" diff --git a/src/datastore_mad/remotes/vmfs/vmfsrc b/src/datastore_mad/remotes/vmfs/vmfsrc index bb6463166c..9809cff282 100644 --- a/src/datastore_mad/remotes/vmfs/vmfsrc +++ b/src/datastore_mad/remotes/vmfs/vmfsrc @@ -15,4 +15,4 @@ #--------------------------------------------------------------------------- # TMP_DIR=/var/lib/one/tmp -SSH=no +USE_SSH=no diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 52cdf9b8e9..1bc1df13c3 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -54,7 +54,7 @@ DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` DST_FOLDER=`basename $DST_PATH` -if [ "$SSH" != "yes" ]; then +if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` @@ -63,7 +63,7 @@ if [ "$SSH" != "yes" ]; then VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" fi -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_PATH else # Two calls needed since vifs cannot do a mkdir -p @@ -76,7 +76,7 @@ fi #------------------------------------------------------------------------------- log "Cloning $SRC_PATH in $DST" -if [ "$SSH" == "yes" ]; then +if [ "$USE_SSH" == "yes" ]; then CLONESCRIPT=$(cat < Date: Fri, 14 Sep 2012 10:52:34 +0200 Subject: [PATCH 25/58] feature #1437: Add comment to configuration file --- src/datastore_mad/remotes/vmfs/vmfsrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/datastore_mad/remotes/vmfs/vmfsrc b/src/datastore_mad/remotes/vmfs/vmfsrc index 9809cff282..77294d84ca 100644 --- a/src/datastore_mad/remotes/vmfs/vmfsrc +++ b/src/datastore_mad/remotes/vmfs/vmfsrc @@ -15,4 +15,9 @@ #--------------------------------------------------------------------------- # TMP_DIR=/var/lib/one/tmp + +# Whether the VMFS Datastore driver should use to invoke the VMFS native commands +# * remote API calls (value set to "no") +# * ssh connection (value set to "yes") + USE_SSH=no From 10930165bf412aa8027535edb36eb5cb6908dc6a Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 14 Sep 2012 17:38:17 +0200 Subject: [PATCH 26/58] feature #1437: Polishing vmfs ssh drivers --- src/datastore_mad/remotes/vmfs/cp | 2 +- src/datastore_mad/remotes/vmfs/mkfs | 4 ++-- src/tm_mad/vmware/clone | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 76f0ab6373..0fe6a93ed3 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -142,7 +142,7 @@ fi # Make the final hop, front-end -> VMFS Datastore if [ "$USE_SSH" == "yes" ]; then - exec_and_log "$SCP -r $SRC $DST" "Error copying $SRC to $DST through SCP" + exec_and_log "$SCP -r $SRC $DST_HOST:$DST" "Error copying $SRC to $DST through SCP" else cd $SRC for file in $(find . -type f); do diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 8232a8337e..3fac6f92a7 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -94,8 +94,8 @@ VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` if [ "$USE_SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" \ "Could not create disk directory /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER on $DST_HOST" - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ + $SSH $DST_HOST $VMKFSTOOLS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER/disk.vmdk" \ "Cannot create [$IMAGE_DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else $VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone index 1bc1df13c3..c6ae106584 100755 --- a/src/tm_mad/vmware/clone +++ b/src/tm_mad/vmware/clone @@ -46,7 +46,6 @@ source $(dirname $0)/tm_vmwarerc # Set dst path and dir #------------------------------------------------------------------------------- SRC_PATH=`arg_path $SRC` -SRC_PATH="../../${SRC_PATH##"$DS_DIR/"}" SRC_FOLDER=`basename $SRC_PATH` DST_PATH=`arg_path $DST` From 967b6518b8fa6822351b3d1beaac97c7ca26d398 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 14 Sep 2012 18:11:48 +0200 Subject: [PATCH 27/58] feature #1437: Get cp to copy contents of the VMDK disk folder, not the folder itself --- src/datastore_mad/remotes/vmfs/cp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 0fe6a93ed3..52f8c26c3a 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -142,7 +142,7 @@ fi # Make the final hop, front-end -> VMFS Datastore if [ "$USE_SSH" == "yes" ]; then - exec_and_log "$SCP -r $SRC $DST_HOST:$DST" "Error copying $SRC to $DST through SCP" + exec_and_log "$SCP -r $SRC/* $DST_HOST:$DST" "Error copying $SRC to $DST through SCP" else cd $SRC for file in $(find . -type f); do From abd2c9c627c1e938e45558f3e7904cd96a4ec992 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 18 Sep 2012 14:36:27 +0200 Subject: [PATCH 28/58] feature #1437: Rename tm vmware -> tm vmfs --- share/etc/oned.conf | 2 +- src/tm_mad/{vmware => vmfs}/clone | 0 src/tm_mad/{vmware => vmfs}/context | 0 src/tm_mad/{vmware => vmfs}/delete | 0 src/tm_mad/{vmware => vmfs}/ln | 0 src/tm_mad/{vmware => vmfs}/mkimage | 0 src/tm_mad/{vmware => vmfs}/mkswap | 0 src/tm_mad/{vmware => vmfs}/mv | 0 src/tm_mad/{vmware => vmfs}/mvds | 0 src/tm_mad/{vmware/tm_vmwarerc => vmfs/tm_vmfsrc} | 0 10 files changed, 1 insertion(+), 1 deletion(-) rename src/tm_mad/{vmware => vmfs}/clone (100%) rename src/tm_mad/{vmware => vmfs}/context (100%) rename src/tm_mad/{vmware => vmfs}/delete (100%) rename src/tm_mad/{vmware => vmfs}/ln (100%) rename src/tm_mad/{vmware => vmfs}/mkimage (100%) rename src/tm_mad/{vmware => vmfs}/mkswap (100%) rename src/tm_mad/{vmware => vmfs}/mv (100%) rename src/tm_mad/{vmware => vmfs}/mvds (100%) rename src/tm_mad/{vmware/tm_vmwarerc => vmfs/tm_vmfsrc} (100%) diff --git a/share/etc/oned.conf b/share/etc/oned.conf index b4e8438b64..a13a3e0156 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -286,7 +286,7 @@ VM_MAD = [ TM_MAD = [ executable = "one_tm", - arguments = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmware,iscsi" ] + arguments = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmfs,iscsi" ] #******************************************************************************* # Datastore Driver Configuration diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmfs/clone similarity index 100% rename from src/tm_mad/vmware/clone rename to src/tm_mad/vmfs/clone diff --git a/src/tm_mad/vmware/context b/src/tm_mad/vmfs/context similarity index 100% rename from src/tm_mad/vmware/context rename to src/tm_mad/vmfs/context diff --git a/src/tm_mad/vmware/delete b/src/tm_mad/vmfs/delete similarity index 100% rename from src/tm_mad/vmware/delete rename to src/tm_mad/vmfs/delete diff --git a/src/tm_mad/vmware/ln b/src/tm_mad/vmfs/ln similarity index 100% rename from src/tm_mad/vmware/ln rename to src/tm_mad/vmfs/ln diff --git a/src/tm_mad/vmware/mkimage b/src/tm_mad/vmfs/mkimage similarity index 100% rename from src/tm_mad/vmware/mkimage rename to src/tm_mad/vmfs/mkimage diff --git a/src/tm_mad/vmware/mkswap b/src/tm_mad/vmfs/mkswap similarity index 100% rename from src/tm_mad/vmware/mkswap rename to src/tm_mad/vmfs/mkswap diff --git a/src/tm_mad/vmware/mv b/src/tm_mad/vmfs/mv similarity index 100% rename from src/tm_mad/vmware/mv rename to src/tm_mad/vmfs/mv diff --git a/src/tm_mad/vmware/mvds b/src/tm_mad/vmfs/mvds similarity index 100% rename from src/tm_mad/vmware/mvds rename to src/tm_mad/vmfs/mvds diff --git a/src/tm_mad/vmware/tm_vmwarerc b/src/tm_mad/vmfs/tm_vmfsrc similarity index 100% rename from src/tm_mad/vmware/tm_vmwarerc rename to src/tm_mad/vmfs/tm_vmfsrc From 05982ae0e153bc8128ab83d60c06e1308dce8e5d Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 18 Sep 2012 16:54:48 +0200 Subject: [PATCH 29/58] feature #1437: Rename tm_vmwarerc -> tm_vmfsrc --- src/tm_mad/vmfs/context | 2 +- src/tm_mad/vmfs/delete | 2 +- src/tm_mad/vmfs/mkimage | 2 +- src/tm_mad/vmfs/mvds | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tm_mad/vmfs/context b/src/tm_mad/vmfs/context index 9802abf50c..2c2afc29d8 100755 --- a/src/tm_mad/vmfs/context +++ b/src/tm_mad/vmfs/context @@ -40,7 +40,7 @@ fi . $TMCOMMON -source $(dirname $0)/tm_vmwarerc +source $(dirname $0)/tm_vmfsrc #------------------------------------------------------------------------------- # Set dst path and dirs diff --git a/src/tm_mad/vmfs/delete b/src/tm_mad/vmfs/delete index 8e668cde2c..f38cc65175 100755 --- a/src/tm_mad/vmfs/delete +++ b/src/tm_mad/vmfs/delete @@ -40,7 +40,7 @@ fi . $TMCOMMON -source $(dirname $0)/tm_vmwarerc +source $(dirname $0)/tm_vmfsrc #------------------------------------------------------------------------------- # Return if deleting a disk, we will delete them when removing the diff --git a/src/tm_mad/vmfs/mkimage b/src/tm_mad/vmfs/mkimage index e739123340..2e5fd28e63 100755 --- a/src/tm_mad/vmfs/mkimage +++ b/src/tm_mad/vmfs/mkimage @@ -41,7 +41,7 @@ fi . $TMCOMMON -source $(dirname $0)/tm_vmwarerc +source $(dirname $0)/tm_vmfsrc #------------------------------------------------------------------------------- # Set dst path and dir diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index e0c7851208..6c1f580515 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -40,7 +40,7 @@ fi . $TMCOMMON -source $(dirname $0)/tm_vmwarerc +source $(dirname $0)/tm_vmfsrc if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` From 0eb22ff76e3d34a919fe04759926556275cd539d Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 18 Sep 2012 17:00:00 +0200 Subject: [PATCH 30/58] feature #1437: Rename TM also in install.sh --- install.sh | 20 ++++++++++---------- src/tm_mad/vmfs/clone | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index afe80207ff..e1d7cef8ea 100755 --- a/install.sh +++ b/install.sh @@ -417,7 +417,7 @@ INSTALL_FILES=( TM_SHARED_FILES:$VAR_LOCATION/remotes/tm/shared TM_QCOW2_FILES:$VAR_LOCATION/remotes/tm/qcow2 TM_SSH_FILES:$VAR_LOCATION/remotes/tm/ssh - TM_VMWARE_FILES:$VAR_LOCATION/remotes/tm/vmware + 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_DUMMY_FILES:$VAR_LOCATION/remotes/tm/dummy @@ -871,15 +871,15 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \ src/tm_mad/dummy/context \ src/tm_mad/dummy/mvds" -TM_VMWARE_FILES="src/tm_mad/vmware/clone \ - src/tm_mad/vmware/delete - src/tm_mad/vmware/ln \ - src/tm_mad/vmware/mkswap \ - src/tm_mad/vmware/mkimage \ - src/tm_mad/vmware/mv \ - src/tm_mad/vmware/context \ - src/tm_mad/vmware/mvds \ - src/tm_mad/vmware/tm_vmwarerc" +TM_VMFS_FILES="src/tm_mad/vmfs/clone \ + src/tm_mad/vmfs/delete + src/tm_mad/vmfs/ln \ + src/tm_mad/vmfs/mkswap \ + src/tm_mad/vmfs/mkimage \ + src/tm_mad/vmfs/mv \ + src/tm_mad/vmfs/context \ + src/tm_mad/vmfs/mvds \ + src/tm_mad/vmfs/tm_vmfsrc" TM_ISCSI_FILES="src/tm_mad/iscsi/clone \ src/tm_mad/iscsi/ln \ diff --git a/src/tm_mad/vmfs/clone b/src/tm_mad/vmfs/clone index c6ae106584..b066846806 100755 --- a/src/tm_mad/vmfs/clone +++ b/src/tm_mad/vmfs/clone @@ -40,7 +40,7 @@ fi . $TMCOMMON -source $(dirname $0)/tm_vmwarerc +source $(dirname $0)/tm_vmfsrc #------------------------------------------------------------------------------- # Set dst path and dir From 6441c4c66b8296107ab0eca32bb2a14c8742a952 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Tue, 18 Sep 2012 17:03:29 +0200 Subject: [PATCH 31/58] feature #1437: Create TM vmfs directory --- install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index e1d7cef8ea..43495d2b80 100755 --- a/install.sh +++ b/install.sh @@ -228,7 +228,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/tm/shared \ $VAR_LOCATION/remotes/tm/qcow2 \ $VAR_LOCATION/remotes/tm/ssh \ - $VAR_LOCATION/remotes/tm/vmware \ + $VAR_LOCATION/remotes/tm/vmfs \ $VAR_LOCATION/remotes/tm/iscsi \ $VAR_LOCATION/remotes/tm/lvm \ $VAR_LOCATION/remotes/hooks \ @@ -897,7 +897,8 @@ TM_LVM_FILES="src/tm_mad/lvm/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 -# - VMware based Image Repository, $REMOTES_LOCATION/datastore/vmware +# - VMWARE-FS based Image Repository, $REMOTES_LOCATION/datastore/vmware +# - VMFS based Image Repository, $REMOTES_LOCATION/datastore/vmfs # - iSCSI based Image Repository, $REMOTES_LOCATION/datastore/iscsi # - LVM based Image Repository, $REMOTES_LOCATION/datastore/lvm #------------------------------------------------------------------------------- From 372a26653f8b29724ae2b02e17060bf7f74f6c2d Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Wed, 19 Sep 2012 13:11:00 +0200 Subject: [PATCH 32/58] feature #1437: Delete directory before attempting copies --- src/tm_mad/shared/ln | 2 +- src/tm_mad/vmfs/clone | 8 ++++++++ src/tm_mad/vmfs/mkimage | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/tm_mad/shared/ln b/src/tm_mad/shared/ln index 30ff0ec6c4..19aa46786c 100755 --- a/src/tm_mad/shared/ln +++ b/src/tm_mad/shared/ln @@ -79,7 +79,7 @@ else log "Linking $SRC_PATH in $DST" ssh_exec_and_log $DST_HOST \ - "cd $DST_DIR; ln -s $SRC_PATH $DST_PATH" \ + "cd $DST_DIR; rm $DST_PATH ; ln -s $SRC_PATH $DST_PATH" \ "Error linking $SRC to $DST" fi diff --git a/src/tm_mad/vmfs/clone b/src/tm_mad/vmfs/clone index b066846806..cf0cd7529d 100755 --- a/src/tm_mad/vmfs/clone +++ b/src/tm_mad/vmfs/clone @@ -87,12 +87,20 @@ if which sudo > /dev/null; then fi \$SUDO_CMD $VMKFSTOOLS -U $DST_PATH/disk.vmdk +\$SUDO rm $DST_PATH/* \$SUDO_CMD $VMKFSTOOLS -i $SRC_PATH/disk.vmdk -d thin $DST_PATH/disk.vmdk EOF ) ssh_exec_and_log $DST_HOST "$CLONESCRIPT" "Error cloning $SRC to $DST" else $VMKFSTOOLS $VI_PARAMS -U [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk &> /dev/null + + # Erase in case that vmkfstool didn't recognize the disk + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for file in $FILES_TO_ERASE; do + vifs $VI_PARAMS --force --rm [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/$file + done + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i [$IMAGE_DS_NAME]$SRC_FOLDER/disk.vmdk -d thin [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ "Error cloning $SRC to $DST" fi diff --git a/src/tm_mad/vmfs/mkimage b/src/tm_mad/vmfs/mkimage index 2e5fd28e63..c6a1f090b9 100755 --- a/src/tm_mad/vmfs/mkimage +++ b/src/tm_mad/vmfs/mkimage @@ -69,6 +69,7 @@ if [ "$USE_SSH" == "yes" ]; then MKFS_CMD=`mkfs_command $DST_PATH $FSTYPE $SIZE` MKSCRIPT=$(cat < /dev/null + + # Erase in case that vmkfstool didn't recognize the disk + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + for file in $FILES_TO_ERASE; do + vifs $VI_PARAMS --force --rm [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/$file + done + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk" \ "Cannot create [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk on $DST_HOST" fi From 427bb23b701519c6a63f6de85b566a0747613427 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 20 Sep 2012 13:10:58 +0200 Subject: [PATCH 33/58] feature #1437: VMFS LN with no ssh will call clone --- src/tm_mad/vmfs/ln | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tm_mad/vmfs/ln b/src/tm_mad/vmfs/ln index 465735617d..44da4da6ad 100755 --- a/src/tm_mad/vmfs/ln +++ b/src/tm_mad/vmfs/ln @@ -73,8 +73,8 @@ EOF ssh_exec_and_log $DST_HOST "$LINK_SCRIPT" \ "Could not link dir files from source DS to system DS" else - log "Cannot link files without SSH enabled on the ESX hosts" - exit 1 + log "Cannot link files without SSH enabled on the ESX hosts, calling clone" + exec $(dirname $0)/clone $* fi exit 0 From 4841c62481c166c7ff462106b5ae78ffe91ca945 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 20 Sep 2012 15:33:45 +0200 Subject: [PATCH 34/58] feature #1437: Add DST_HOST to mvds --- src/tm_mad/vmfs/mvds | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index 6c1f580515..c3f4f09d9e 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -43,6 +43,7 @@ fi source $(dirname $0)/tm_vmfsrc if [ "$USE_SSH" != "yes" ]; then + DST_HOST=`arg_host $DST` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" From 82e4b46aabf7f0fce290f02fdde32971957c6bd9 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 20 Sep 2012 16:17:42 +0200 Subject: [PATCH 35/58] feature #1437: Pick the right host --- src/tm_mad/vmfs/mvds | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index c3f4f09d9e..7272eb735b 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -42,13 +42,6 @@ fi source $(dirname $0)/tm_vmfsrc -if [ "$USE_SSH" != "yes" ]; then - DST_HOST=`arg_host $DST` - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" -fi - set_ds_location #------------------------------------------------------------------------------- @@ -59,6 +52,12 @@ DST_PATH=`arg_path $DST` DST_PATH="$RMT_DS_DIR/${DST_PATH##"$DS_DIR/"}/disk.vmdk" SRC_HOST=`arg_host $SRC` +if [ "$USE_SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` + VI_PARAMS="--server $SRC_HOST --username $USERNAME --password $PASSWORD" +fi + #------------------------------------------------------------------------------- # Move the image back to the datastore #------------------------------------------------------------------------------- From c17bff3c4f5a42bb4a26a4f21d8a2e2a9ef120da Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 20 Sep 2012 17:08:39 +0200 Subject: [PATCH 36/58] feature #1437: Fixing mvds --- src/tm_mad/vmfs/mvds | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index 7272eb735b..15438aa829 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -47,12 +47,18 @@ set_ds_location #------------------------------------------------------------------------------- # Set dst path and dir #------------------------------------------------------------------------------- -SRC_PATH=`arg_path $SRC`"/disk.vmdk" -DST_PATH=`arg_path $DST` -DST_PATH="$RMT_DS_DIR/${DST_PATH##"$DS_DIR/"}/disk.vmdk" +SRC_PATH=`arg_path $SRC` SRC_HOST=`arg_host $SRC` +SRC_FOLDER=`basename $SRC_PATH` + +DST_PATH=`arg_path $DST` +DST_FOLDER=`basename $DST_PATH` + + if [ "$USE_SSH" != "yes" ]; then + IMAGE_DS_NAME=`basename $(dirname $DST_PATH)` + SYSTEM_DS_NAME=`basename $(dirname $(dirname $SRC_PATH))` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` VI_PARAMS="--server $SRC_HOST --username $USERNAME --password $PASSWORD" @@ -77,7 +83,8 @@ else SUDO="sudo " fi - $SUDO $VMKFSTOOLS -i $SRC_PATH -d thin $DST_PATH + $SUDO $VMKFSTOOLS -U [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk + $SUDO $VMKFSTOOLS -i [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk -d thin [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk fi if [ -d $DST_PATH ]; then @@ -90,10 +97,11 @@ EOF log "Moving $SRC_PATH to datastore as $DST_PATH" - ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image $DST_PATH" + ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk to [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk in $SRC_HOST" else - exec_and_log "$VMKFSTOOLS $VI_PARAMS -i $SRC_PATH -d thin $DST_PATH" \ - "Could not move image $DST_PATH" + $VMKFSTOOLS -U [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk &> /dev/null + exec_and_log "$VMKFSTOOLS $VI_PARAMS -i [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk -d thin [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk" \ + "Could not move image [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk to [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk in $SRC_HOST" fi exit 0 From bef1d230b377252de854d74848f33e46d8e65369 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 20 Sep 2012 18:28:58 +0200 Subject: [PATCH 37/58] feature #1437: mvds vmkfstool with correct params --- src/tm_mad/vmfs/mvds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index 15438aa829..6349faa0a2 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -99,7 +99,7 @@ EOF ssh_exec_and_log $SRC_HOST "$MVSCRIPT" "Could not move image [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk to [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk in $SRC_HOST" else - $VMKFSTOOLS -U [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk &> /dev/null + $VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk &> /dev/null exec_and_log "$VMKFSTOOLS $VI_PARAMS -i [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk -d thin [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk" \ "Could not move image [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk to [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk in $SRC_HOST" fi From 45f86393ac1d2da5c0f53159ee52126d6686f53d Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 20 Sep 2012 18:29:49 +0200 Subject: [PATCH 38/58] bug #1473: Pick last deployment file --- src/vmm_mad/remotes/vmware/vmware_driver.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vmm_mad/remotes/vmware/vmware_driver.rb b/src/vmm_mad/remotes/vmware/vmware_driver.rb index 3b0bb1ca89..c6b902f850 100644 --- a/src/vmm_mad/remotes/vmware/vmware_driver.rb +++ b/src/vmm_mad/remotes/vmware/vmware_driver.rb @@ -176,9 +176,11 @@ class VMwareDriver # ------------------------------------------------------------------------ # def restore(checkpoint) begin + vm_folder=VAR_LOCATION + "/" + File.basename(File.dirname(checkpoint)) + last_deployment_file=`ls -1 #{vm_folder}/deployment*|tail -1` + # Define the VM - dfile = VAR_LOCATION + "/" + - File.basename(File.dirname(checkpoint)) + "/deployment.0" + dfile = vm_folder + "/" + last_deployment_file rescue => e OpenNebula.log_error("Cannot open checkpoint #{e.message}") exit -1 From fb8de1f49be15a1dc13d514ca3015eda0b5ab732 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 21 Sep 2012 15:11:02 +0200 Subject: [PATCH 39/58] feature #1437: Add log info, fix context for vmfs --- src/tm_mad/vmfs/context | 6 +++--- src/tm_mad/vmfs/mvds | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tm_mad/vmfs/context b/src/tm_mad/vmfs/context index 2c2afc29d8..b506877953 100755 --- a/src/tm_mad/vmfs/context +++ b/src/tm_mad/vmfs/context @@ -88,11 +88,11 @@ done exec_and_log "$MKISOFS -o $ISO_FILE -J -R $ISO_DIR" "Error creating iso fs" if [ "$USE_SSH" == "yes" ]; then - exec_and_log "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST" + exec_and_log "$SCP $ISO_FILE $DST_PATH.iso" "Error copying context ISO to $DST" else # Copies the iso file with .iso suffix, needed for VMware CDROMs - exec_and_log "vifs $VI_PARAMS -p $ISO_FILE $DST_PATH.iso" \ - "Error copying context ISO to $DST" + exec_and_log "vifs $VI_PARAMS -p $ISO_FILE [$DS_ID]$VM_ID/$DST_FOLDER.iso" \ + "Error copying context ISO to [$DS_ID]$VM_ID/$DST_FOLDER.iso in $DST_HOST" fi rm -rf $ISO_DIR > /dev/null 2>&1 diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index 6349faa0a2..9792490c80 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -68,6 +68,8 @@ fi # Move the image back to the datastore #------------------------------------------------------------------------------- +log "Moving [$SYSTEM_DS_NAME]$VMID/$SRC_FOLDER/disk.vmdk to [$IMAGE_DS_NAME]$DST_FOLDER/disk.vmdk" + if [ "$USE_SSH" == "yes" ]; then MVSCRIPT=$(cat < /dev/null From 5cbe262fda3dcaa015b9ca38665f89ddf7b9095c Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 21 Sep 2012 16:09:13 +0200 Subject: [PATCH 40/58] =?UTF-8?q?feature=20=C2#1437:=20Reove=20iso=20befor?= =?UTF-8?q?e=20trying=20to=20upload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tm_mad/vmfs/context | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tm_mad/vmfs/context b/src/tm_mad/vmfs/context index b506877953..96fef929ec 100755 --- a/src/tm_mad/vmfs/context +++ b/src/tm_mad/vmfs/context @@ -60,8 +60,7 @@ if [ "$USE_SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_DIR else vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID - exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID/$DST_FOLDER" \ - "Cannot create [$DS_ID]$VM_ID/$DST_FOLDER on $DST_HOST" + vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID/$DST_FOLDER fi #------------------------------------------------------------------------------- @@ -91,6 +90,7 @@ if [ "$USE_SSH" == "yes" ]; then exec_and_log "$SCP $ISO_FILE $DST_PATH.iso" "Error copying context ISO to $DST" else # Copies the iso file with .iso suffix, needed for VMware CDROMs + vifs $VI_PARAMS -rm [$DS_ID]$VM_ID/$DST_FOLDER.iso exec_and_log "vifs $VI_PARAMS -p $ISO_FILE [$DS_ID]$VM_ID/$DST_FOLDER.iso" \ "Error copying context ISO to [$DS_ID]$VM_ID/$DST_FOLDER.iso in $DST_HOST" fi From f2b5a80beec35e0ca6ff8d45ea4ce1aa8eadc207 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 21 Sep 2012 17:19:30 +0200 Subject: [PATCH 41/58] =?UTF-8?q?feature=20#=C21360=C2:=20Allow=20empy=20?= =?UTF-8?q?=C3passwords?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/datastore_mad/remotes/vmfs/clone | 2 +- src/datastore_mad/remotes/vmfs/cp | 2 +- src/datastore_mad/remotes/vmfs/mkfs | 2 +- src/datastore_mad/remotes/vmfs/rm | 2 +- src/im_mad/remotes/vmware.d/vmware.rb | 6 +++++- src/tm_mad/vmfs/clone | 2 +- src/tm_mad/vmfs/context | 2 +- src/tm_mad/vmfs/delete | 2 +- src/tm_mad/vmfs/mkimage | 2 +- src/tm_mad/vmfs/mvds | 2 +- src/vmm_mad/remotes/vmware/vmware_driver.rb | 6 +++++- 11 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index 36ef27e23b..686441dd2c 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -68,7 +68,7 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi # ------------ Copy the image to the repository ------------- diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 52f8c26c3a..29400e304f 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -79,7 +79,7 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi # Create DST in DST_HOST diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 3fac6f92a7..d9fd4887da 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -74,7 +74,7 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi # ------------ Image to save_as disk, no need to create a FS ------------ diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index b393c802c1..54a0ced192 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -60,7 +60,7 @@ DST_FOLDER=`basename $SRC` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi # ------------ Remove the image from the repository ------------ diff --git a/src/im_mad/remotes/vmware.d/vmware.rb b/src/im_mad/remotes/vmware.d/vmware.rb index 661f7c304e..cd02f42fbe 100755 --- a/src/im_mad/remotes/vmware.d/vmware.rb +++ b/src/im_mad/remotes/vmware.d/vmware.rb @@ -99,7 +99,11 @@ conf = YAML::load(File.read(CONF_FILE)) @uri = conf[:libvirt_uri].gsub!('@HOST@', host) @user = conf[:username] -@pass = conf[:password] +if conf[:password] and !conf[:password].empty? + @pass=conf[:password] +else + @pass="\"\"" +end # Poll the VMware hypervisor diff --git a/src/tm_mad/vmfs/clone b/src/tm_mad/vmfs/clone index cf0cd7529d..624af00eeb 100755 --- a/src/tm_mad/vmfs/clone +++ b/src/tm_mad/vmfs/clone @@ -59,7 +59,7 @@ if [ "$USE_SSH" != "yes" ]; then IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME]${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi if [ "$USE_SSH" == "yes" ]; then diff --git a/src/tm_mad/vmfs/context b/src/tm_mad/vmfs/context index 96fef929ec..8d6f720816 100755 --- a/src/tm_mad/vmfs/context +++ b/src/tm_mad/vmfs/context @@ -53,7 +53,7 @@ DST_FOLDER=`basename $DST_PATH` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi if [ "$USE_SSH" == "yes" ]; then diff --git a/src/tm_mad/vmfs/delete b/src/tm_mad/vmfs/delete index f38cc65175..8436adc417 100755 --- a/src/tm_mad/vmfs/delete +++ b/src/tm_mad/vmfs/delete @@ -60,7 +60,7 @@ if [ "$USE_SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" DIRS_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for dir in $DIRS_TO_ERASE; do diff --git a/src/tm_mad/vmfs/mkimage b/src/tm_mad/vmfs/mkimage index c6a1f090b9..281dd6148f 100755 --- a/src/tm_mad/vmfs/mkimage +++ b/src/tm_mad/vmfs/mkimage @@ -55,7 +55,7 @@ if [ "$USE_SSH" != "yes" ]; then SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" fi #------------------------------------------------------------------------------- diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index 9792490c80..2c47e9e9ba 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -61,7 +61,7 @@ if [ "$USE_SSH" != "yes" ]; then SYSTEM_DS_NAME=`basename $(dirname $(dirname $SRC_PATH))` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $SRC_HOST --username $USERNAME --password $PASSWORD" + VI_PARAMS="--server $SRC_HOST --username $USERNAME --password \"$PASSWORD\"" fi #------------------------------------------------------------------------------- diff --git a/src/vmm_mad/remotes/vmware/vmware_driver.rb b/src/vmm_mad/remotes/vmware/vmware_driver.rb index c6b902f850..7ca1079eea 100644 --- a/src/vmm_mad/remotes/vmware/vmware_driver.rb +++ b/src/vmm_mad/remotes/vmware/vmware_driver.rb @@ -50,7 +50,11 @@ class VMwareDriver @uri = conf[:libvirt_uri].gsub!('@HOST@', host) @user = conf[:username] - @pass = conf[:password] + if conf[:password] and !conf[:password].empty? + @pass=conf[:password] + else + @pass="\"\"" + end @datacenter = conf[:datacenter] @vcenter = conf[:vcenter] From aca8acc0387bad2479d239d10599aa296d6fa349 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 21 Sep 2012 17:47:20 +0200 Subject: [PATCH 42/58] bug #1360: Empty pass in shell script as well --- install.sh | 4 +++- src/datastore_mad/remotes/vmfs/clone | 6 +++++- src/datastore_mad/remotes/vmfs/cp | 6 +++++- src/datastore_mad/remotes/vmfs/mkfs | 6 +++++- src/datastore_mad/remotes/vmfs/rm | 6 +++++- src/tm_mad/vmfs/clone | 6 +++++- src/tm_mad/vmfs/context | 6 +++++- src/tm_mad/vmfs/delete | 6 +++++- src/tm_mad/vmfs/mkimage | 6 +++++- src/tm_mad/vmfs/mvds | 6 +++++- src/tm_mad/{vmware => vmfs}/postmigrate | 0 src/tm_mad/{vmware => vmfs}/premigrate | 0 12 files changed, 48 insertions(+), 10 deletions(-) rename src/tm_mad/{vmware => vmfs}/postmigrate (100%) rename src/tm_mad/{vmware => vmfs}/premigrate (100%) diff --git a/install.sh b/install.sh index 2501768021..000abf0db2 100755 --- a/install.sh +++ b/install.sh @@ -887,7 +887,9 @@ TM_VMFS_FILES="src/tm_mad/vmfs/clone \ src/tm_mad/vmfs/mv \ src/tm_mad/vmfs/context \ src/tm_mad/vmfs/mvds \ - src/tm_mad/vmfs/tm_vmfsrc" + src/tm_mad/vmfs/tm_vmfsrc + src/tm_mad/vmfs/postmigrate \ + src/tm_mad/vmfs/premigrate" TM_ISCSI_FILES="src/tm_mad/iscsi/clone \ src/tm_mad/iscsi/ln \ diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index 686441dd2c..fffdd6e157 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -68,7 +68,11 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi # ------------ Copy the image to the repository ------------- diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 29400e304f..2e5ec32b3f 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -79,7 +79,11 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi # Create DST in DST_HOST diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index d9fd4887da..86890a2f5b 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -74,7 +74,11 @@ DST_HOST=`get_destination_host $(dirname $0)` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi # ------------ Image to save_as disk, no need to create a FS ------------ diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 54a0ced192..dbaa8827b4 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -60,7 +60,11 @@ DST_FOLDER=`basename $SRC` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi # ------------ Remove the image from the repository ------------ diff --git a/src/tm_mad/vmfs/clone b/src/tm_mad/vmfs/clone index 624af00eeb..87afa2ff21 100755 --- a/src/tm_mad/vmfs/clone +++ b/src/tm_mad/vmfs/clone @@ -59,7 +59,11 @@ if [ "$USE_SSH" != "yes" ]; then IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` DST_DIR_WITHOUT_DS_PATH="[$SYSTEM_DS_NAME]${DST_PATH##"$DS_DIR/$SYSTEM_DS_NAME/"}" - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi if [ "$USE_SSH" == "yes" ]; then diff --git a/src/tm_mad/vmfs/context b/src/tm_mad/vmfs/context index 8d6f720816..008fe51b7c 100755 --- a/src/tm_mad/vmfs/context +++ b/src/tm_mad/vmfs/context @@ -53,7 +53,11 @@ DST_FOLDER=`basename $DST_PATH` if [ "$USE_SSH" != "yes" ]; then USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi if [ "$USE_SSH" == "yes" ]; then diff --git a/src/tm_mad/vmfs/delete b/src/tm_mad/vmfs/delete index 8436adc417..2558378347 100755 --- a/src/tm_mad/vmfs/delete +++ b/src/tm_mad/vmfs/delete @@ -60,7 +60,11 @@ if [ "$USE_SSH" == "yes" ]; then else USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi DIRS_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for dir in $DIRS_TO_ERASE; do diff --git a/src/tm_mad/vmfs/mkimage b/src/tm_mad/vmfs/mkimage index 281dd6148f..f7bb5b9c3f 100755 --- a/src/tm_mad/vmfs/mkimage +++ b/src/tm_mad/vmfs/mkimage @@ -55,7 +55,11 @@ if [ "$USE_SSH" != "yes" ]; then SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi #------------------------------------------------------------------------------- diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index 2c47e9e9ba..0bd7e52a13 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -61,7 +61,11 @@ if [ "$USE_SSH" != "yes" ]; then SYSTEM_DS_NAME=`basename $(dirname $(dirname $SRC_PATH))` USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - VI_PARAMS="--server $SRC_HOST --username $USERNAME --password \"$PASSWORD\"" + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi fi #------------------------------------------------------------------------------- diff --git a/src/tm_mad/vmware/postmigrate b/src/tm_mad/vmfs/postmigrate similarity index 100% rename from src/tm_mad/vmware/postmigrate rename to src/tm_mad/vmfs/postmigrate diff --git a/src/tm_mad/vmware/premigrate b/src/tm_mad/vmfs/premigrate similarity index 100% rename from src/tm_mad/vmware/premigrate rename to src/tm_mad/vmfs/premigrate From 084abbd5fc46425e2ae33eb35832d57b63e970fd Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 21 Sep 2012 17:58:20 +0200 Subject: [PATCH 43/58] =?UTF-8?q?bug=20=C2#1355:=20Workarund=20for=20argum?= =?UTF-8?q?ent=20size=20limitation=20in=20ESX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/vmm_mad/exec/one_vmm_exec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index 9dd1881578..8c6f8ccacb 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -534,6 +534,12 @@ class ExecDriver < VirtualMachineDriver action = VmmAction.new(self, id, :attach_disk, drv_message) + # Bug #1355, argument character limitation in ESX + # Message not used in vmware anyway + if @hypervisor == "vmware" + drv_message = "drv_message" + end + steps = [ # Perform a PROLOG on the disk { From afe615d326437857a67f04c8ad1fde62503c946b Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Mon, 24 Sep 2012 16:18:17 +0200 Subject: [PATCH 44/58] feature #1437: Proper indent for install.sh --- install.sh | 1223 ++++++++++++++++++++++++++-------------------------- 1 file changed, 612 insertions(+), 611 deletions(-) diff --git a/install.sh b/install.sh index 000abf0db2..32f1b71d7a 100755 --- a/install.sh +++ b/install.sh @@ -27,33 +27,33 @@ # COMMAND LINE PARSING #------------------------------------------------------------------------------- usage() { -echo -echo "Usage: install.sh [-u install_user] [-g install_group] [-k keep conf]" -echo " [-d ONE_LOCATION] [-c occi|ec2] [-r] [-h]" -echo -echo "-u: user that will run opennebula, defaults to user executing install.sh" -echo "-g: group of the user that will run opennebula, defaults to user" -echo " executing install.sh" -echo "-k: keep configuration files of existing OpenNebula installation, useful" -echo " when upgrading. This flag should not be set when installing" -echo " OpenNebula for the first time" -echo "-d: target installation directory, if not defined it'd be root. Must be" -echo " an absolute path." -echo "-c: install client utilities: OpenNebula cli, occi and ec2 client files" -echo "-s: install OpenNebula Sunstone" -echo "-o: install OpenNebula Zones (OZones)" -echo "-r: remove Opennebula, only useful if -d was not specified, otherwise" -echo " rm -rf \$ONE_LOCATION would do the job" -echo "-l: creates symlinks instead of copying files, useful for development" -echo "-h: prints this help" + echo + echo "Usage: install.sh [-u install_user] [-g install_group] [-k keep conf]" + echo " [-d ONE_LOCATION] [-c occi|ec2] [-r] [-h]" + echo + echo "-u: user that will run opennebula, defaults to user executing install.sh" + echo "-g: group of the user that will run opennebula, defaults to user" + echo " executing install.sh" + echo "-k: keep configuration files of existing OpenNebula installation, useful" + echo " when upgrading. This flag should not be set when installing" + echo " OpenNebula for the first time" + echo "-d: target installation directory, if not defined it'd be root. Must be" + echo " an absolute path." + echo "-c: install client utilities: OpenNebula cli, occi and ec2 client files" + echo "-s: install OpenNebula Sunstone" + echo "-o: install OpenNebula Zones (OZones)" + echo "-r: remove Opennebula, only useful if -d was not specified, otherwise" + echo " rm -rf \$ONE_LOCATION would do the job" + echo "-l: creates symlinks instead of copying files, useful for development" + echo "-h: prints this help" } #------------------------------------------------------------------------------- TEMP_OPT=`getopt -o hkrlcsou:g:d: -n 'install.sh' -- "$@"` if [ $? != 0 ] ; then -usage -exit 1 + usage + exit 1 fi eval set -- "$TEMP_OPT" @@ -69,20 +69,20 @@ ONEADMIN_GROUP=`id -g` SRC_DIR=$PWD while true ; do -case "$1" in --h) usage; exit 0;; --k) INSTALL_ETC="no" ; shift ;; --r) UNINSTALL="yes" ; shift ;; --l) LINK="yes" ; shift ;; --c) CLIENT="yes"; INSTALL_ETC="no" ; shift ;; --s) SUNSTONE="yes"; shift ;; --o) OZONES="yes"; shift ;; --u) ONEADMIN_USER="$2" ; shift 2;; --g) ONEADMIN_GROUP="$2"; shift 2;; --d) ROOT="$2" ; shift 2 ;; ---) shift ; break ;; -*) usage; exit 1 ;; -esac + case "$1" in + -h) usage; exit 0;; + -k) INSTALL_ETC="no" ; shift ;; + -r) UNINSTALL="yes" ; shift ;; + -l) LINK="yes" ; shift ;; + -c) CLIENT="yes"; INSTALL_ETC="no" ; shift ;; + -s) SUNSTONE="yes"; shift ;; + -o) OZONES="yes"; shift ;; + -u) ONEADMIN_USER="$2" ; shift 2;; + -g) ONEADMIN_GROUP="$2"; shift 2;; + -d) ROOT="$2" ; shift 2 ;; + --) shift ; break ;; + *) usage; exit 1 ;; + esac done #------------------------------------------------------------------------------- @@ -92,293 +92,293 @@ done CONF_LOCATION="$HOME/.one" if [ -z "$ROOT" ] ; then -BIN_LOCATION="/usr/bin" -LIB_LOCATION="/usr/lib/one" -ETC_LOCATION="/etc/one" -LOG_LOCATION="/var/log/one" -VAR_LOCATION="/var/lib/one" -SUNSTONE_LOCATION="$LIB_LOCATION/sunstone" -OZONES_LOCATION="$LIB_LOCATION/ozones" -SYSTEM_DS_LOCATION="$VAR_LOCATION/datastores/0" -DEFAULT_DS_LOCATION="$VAR_LOCATION/datastores/1" -RUN_LOCATION="/var/run/one" -LOCK_LOCATION="/var/lock/one" -INCLUDE_LOCATION="/usr/include" -SHARE_LOCATION="/usr/share/one" -MAN_LOCATION="/usr/share/man/man1" + BIN_LOCATION="/usr/bin" + LIB_LOCATION="/usr/lib/one" + ETC_LOCATION="/etc/one" + LOG_LOCATION="/var/log/one" + VAR_LOCATION="/var/lib/one" + SUNSTONE_LOCATION="$LIB_LOCATION/sunstone" + OZONES_LOCATION="$LIB_LOCATION/ozones" + SYSTEM_DS_LOCATION="$VAR_LOCATION/datastores/0" + DEFAULT_DS_LOCATION="$VAR_LOCATION/datastores/1" + RUN_LOCATION="/var/run/one" + LOCK_LOCATION="/var/lock/one" + INCLUDE_LOCATION="/usr/include" + SHARE_LOCATION="/usr/share/one" + MAN_LOCATION="/usr/share/man/man1" -if [ "$CLIENT" = "yes" ]; then -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION" + if [ "$CLIENT" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION" -DELETE_DIRS="" + DELETE_DIRS="" -CHOWN_DIRS="" -elif [ "$SUNSTONE" = "yes" ]; then -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \ - $SUNSTONE_LOCATION $ETC_LOCATION" + CHOWN_DIRS="" + elif [ "$SUNSTONE" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \ + $SUNSTONE_LOCATION $ETC_LOCATION" -DELETE_DIRS="$MAKE_DIRS" + DELETE_DIRS="$MAKE_DIRS" -CHOWN_DIRS="" -elif [ "$OZONES" = "yes" ]; then -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $OZONES_LOCATION \ - $ETC_LOCATION" + CHOWN_DIRS="" + elif [ "$OZONES" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $OZONES_LOCATION \ + $ETC_LOCATION" -DELETE_DIRS="$MAKE_DIRS" + DELETE_DIRS="$MAKE_DIRS" -CHOWN_DIRS="" -else -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ - $INCLUDE_LOCATION $SHARE_LOCATION \ - $LOG_LOCATION $RUN_LOCATION $LOCK_LOCATION \ - $SYSTEM_DS_LOCATION $DEFAULT_DS_LOCATION $MAN_LOCATION" + CHOWN_DIRS="" + else + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ + $INCLUDE_LOCATION $SHARE_LOCATION \ + $LOG_LOCATION $RUN_LOCATION $LOCK_LOCATION \ + $SYSTEM_DS_LOCATION $DEFAULT_DS_LOCATION $MAN_LOCATION" -DELETE_DIRS="$LIB_LOCATION $ETC_LOCATION $LOG_LOCATION $VAR_LOCATION \ - $RUN_LOCATION $SHARE_DIRS" + DELETE_DIRS="$LIB_LOCATION $ETC_LOCATION $LOG_LOCATION $VAR_LOCATION \ + $RUN_LOCATION $SHARE_DIRS" -CHOWN_DIRS="$LOG_LOCATION $VAR_LOCATION $RUN_LOCATION $LOCK_LOCATION" -fi + CHOWN_DIRS="$LOG_LOCATION $VAR_LOCATION $RUN_LOCATION $LOCK_LOCATION" + fi else -BIN_LOCATION="$ROOT/bin" -LIB_LOCATION="$ROOT/lib" -ETC_LOCATION="$ROOT/etc" -VAR_LOCATION="$ROOT/var" -SUNSTONE_LOCATION="$LIB_LOCATION/sunstone" -OZONES_LOCATION="$LIB_LOCATION/ozones" -SYSTEM_DS_LOCATION="$VAR_LOCATION/datastores/0" -DEFAULT_DS_LOCATION="$VAR_LOCATION/datastores/1" -INCLUDE_LOCATION="$ROOT/include" -SHARE_LOCATION="$ROOT/share" -MAN_LOCATION="$ROOT/share/man/man1" + BIN_LOCATION="$ROOT/bin" + LIB_LOCATION="$ROOT/lib" + ETC_LOCATION="$ROOT/etc" + VAR_LOCATION="$ROOT/var" + SUNSTONE_LOCATION="$LIB_LOCATION/sunstone" + OZONES_LOCATION="$LIB_LOCATION/ozones" + SYSTEM_DS_LOCATION="$VAR_LOCATION/datastores/0" + DEFAULT_DS_LOCATION="$VAR_LOCATION/datastores/1" + INCLUDE_LOCATION="$ROOT/include" + SHARE_LOCATION="$ROOT/share" + MAN_LOCATION="$ROOT/share/man/man1" -if [ "$CLIENT" = "yes" ]; then -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION" + if [ "$CLIENT" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION" -DELETE_DIRS="$MAKE_DIRS" -elif [ "$SUNSTONE" = "yes" ]; then -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \ - $SUNSTONE_LOCATION $ETC_LOCATION" + DELETE_DIRS="$MAKE_DIRS" + elif [ "$SUNSTONE" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION \ + $SUNSTONE_LOCATION $ETC_LOCATION" -DELETE_DIRS="$MAKE_DIRS" -elif [ "$OZONES" = "yes" ]; then -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $OZONES_LOCATION \ - $ETC_LOCATION" + DELETE_DIRS="$MAKE_DIRS" + elif [ "$OZONES" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $OZONES_LOCATION \ + $ETC_LOCATION" -DELETE_DIRS="$MAKE_DIRS" -else -MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ - $INCLUDE_LOCATION $SHARE_LOCATION $SYSTEM_DS_LOCATION \ - $DEFAULT_DS_LOCATION $MAN_LOCATION $OZONES_LOCATION" + DELETE_DIRS="$MAKE_DIRS" + else + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ + $INCLUDE_LOCATION $SHARE_LOCATION $SYSTEM_DS_LOCATION \ + $DEFAULT_DS_LOCATION $MAN_LOCATION $OZONES_LOCATION" -DELETE_DIRS="$MAKE_DIRS" + DELETE_DIRS="$MAKE_DIRS" -CHOWN_DIRS="$ROOT" -fi + CHOWN_DIRS="$ROOT" + fi -CHOWN_DIRS="$ROOT" + CHOWN_DIRS="$ROOT" fi SHARE_DIRS="$SHARE_LOCATION/examples" ETC_DIRS="$ETC_LOCATION/im_ec2 \ - $ETC_LOCATION/vmm_ec2 \ - $ETC_LOCATION/vmm_exec \ - $ETC_LOCATION/hm \ - $ETC_LOCATION/auth \ - $ETC_LOCATION/auth/certificates \ - $ETC_LOCATION/ec2query_templates \ - $ETC_LOCATION/occi_templates \ - $ETC_LOCATION/cli" + $ETC_LOCATION/vmm_ec2 \ + $ETC_LOCATION/vmm_exec \ + $ETC_LOCATION/hm \ + $ETC_LOCATION/auth \ + $ETC_LOCATION/auth/certificates \ + $ETC_LOCATION/ec2query_templates \ + $ETC_LOCATION/occi_templates \ + $ETC_LOCATION/cli" LIB_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula \ - $LIB_LOCATION/ruby/zona \ - $LIB_LOCATION/ruby/cloud/ \ - $LIB_LOCATION/ruby/cloud/econe \ - $LIB_LOCATION/ruby/cloud/econe/views \ - $LIB_LOCATION/ruby/cloud/occi \ - $LIB_LOCATION/ruby/cloud/marketplace \ - $LIB_LOCATION/ruby/cloud/CloudAuth \ - $LIB_LOCATION/ruby/onedb \ - $LIB_LOCATION/mads \ - $LIB_LOCATION/sh \ - $LIB_LOCATION/ruby/cli \ - $LIB_LOCATION/ruby/cli/one_helper" + $LIB_LOCATION/ruby/OpenNebula \ + $LIB_LOCATION/ruby/zona \ + $LIB_LOCATION/ruby/cloud/ \ + $LIB_LOCATION/ruby/cloud/econe \ + $LIB_LOCATION/ruby/cloud/econe/views \ + $LIB_LOCATION/ruby/cloud/occi \ + $LIB_LOCATION/ruby/cloud/marketplace \ + $LIB_LOCATION/ruby/cloud/CloudAuth \ + $LIB_LOCATION/ruby/onedb \ + $LIB_LOCATION/mads \ + $LIB_LOCATION/sh \ + $LIB_LOCATION/ruby/cli \ + $LIB_LOCATION/ruby/cli/one_helper" VAR_DIRS="$VAR_LOCATION/remotes \ - $VAR_LOCATION/remotes/im \ - $VAR_LOCATION/remotes/im/kvm.d \ - $VAR_LOCATION/remotes/im/xen.d \ - $VAR_LOCATION/remotes/im/vmware.d \ - $VAR_LOCATION/remotes/im/ganglia.d \ - $VAR_LOCATION/remotes/vmm \ - $VAR_LOCATION/remotes/vmm/kvm \ - $VAR_LOCATION/remotes/vmm/xen \ - $VAR_LOCATION/remotes/vmm/vmware \ - $VAR_LOCATION/remotes/vnm \ - $VAR_LOCATION/remotes/vnm/802.1Q \ - $VAR_LOCATION/remotes/vnm/dummy \ - $VAR_LOCATION/remotes/vnm/ebtables \ - $VAR_LOCATION/remotes/vnm/fw \ - $VAR_LOCATION/remotes/vnm/ovswitch \ - $VAR_LOCATION/remotes/vnm/vmware \ - $VAR_LOCATION/remotes/tm/ \ - $VAR_LOCATION/remotes/tm/dummy \ - $VAR_LOCATION/remotes/tm/shared \ - $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/hooks \ - $VAR_LOCATION/remotes/hooks/ft \ - $VAR_LOCATION/remotes/datastore \ - $VAR_LOCATION/remotes/datastore/dummy \ - $VAR_LOCATION/remotes/datastore/fs \ - $VAR_LOCATION/remotes/datastore/vmware \ - $VAR_LOCATION/remotes/datastore/vmfs \ - $VAR_LOCATION/remotes/datastore/iscsi \ - $VAR_LOCATION/remotes/datastore/lvm \ - $VAR_LOCATION/remotes/auth \ - $VAR_LOCATION/remotes/auth/plain \ - $VAR_LOCATION/remotes/auth/ssh \ - $VAR_LOCATION/remotes/auth/x509 \ - $VAR_LOCATION/remotes/auth/ldap \ - $VAR_LOCATION/remotes/auth/server_x509 \ - $VAR_LOCATION/remotes/auth/server_cipher \ - $VAR_LOCATION/remotes/auth/dummy" + $VAR_LOCATION/remotes/im \ + $VAR_LOCATION/remotes/im/kvm.d \ + $VAR_LOCATION/remotes/im/xen.d \ + $VAR_LOCATION/remotes/im/vmware.d \ + $VAR_LOCATION/remotes/im/ganglia.d \ + $VAR_LOCATION/remotes/vmm \ + $VAR_LOCATION/remotes/vmm/kvm \ + $VAR_LOCATION/remotes/vmm/xen \ + $VAR_LOCATION/remotes/vmm/vmware \ + $VAR_LOCATION/remotes/vnm \ + $VAR_LOCATION/remotes/vnm/802.1Q \ + $VAR_LOCATION/remotes/vnm/dummy \ + $VAR_LOCATION/remotes/vnm/ebtables \ + $VAR_LOCATION/remotes/vnm/fw \ + $VAR_LOCATION/remotes/vnm/ovswitch \ + $VAR_LOCATION/remotes/vnm/vmware \ + $VAR_LOCATION/remotes/tm/ \ + $VAR_LOCATION/remotes/tm/dummy \ + $VAR_LOCATION/remotes/tm/shared \ + $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/hooks \ + $VAR_LOCATION/remotes/hooks/ft \ + $VAR_LOCATION/remotes/datastore \ + $VAR_LOCATION/remotes/datastore/dummy \ + $VAR_LOCATION/remotes/datastore/fs \ + $VAR_LOCATION/remotes/datastore/vmware \ + $VAR_LOCATION/remotes/datastore/vmfs \ + $VAR_LOCATION/remotes/datastore/iscsi \ + $VAR_LOCATION/remotes/datastore/lvm \ + $VAR_LOCATION/remotes/auth \ + $VAR_LOCATION/remotes/auth/plain \ + $VAR_LOCATION/remotes/auth/ssh \ + $VAR_LOCATION/remotes/auth/x509 \ + $VAR_LOCATION/remotes/auth/ldap \ + $VAR_LOCATION/remotes/auth/server_x509 \ + $VAR_LOCATION/remotes/auth/server_cipher \ + $VAR_LOCATION/remotes/auth/dummy" SUNSTONE_DIRS="$SUNSTONE_LOCATION/routes \ - $SUNSTONE_LOCATION/models \ - $SUNSTONE_LOCATION/models/OpenNebulaJSON \ - $SUNSTONE_LOCATION/public \ - $SUNSTONE_LOCATION/public/js \ - $SUNSTONE_LOCATION/public/js/plugins \ - $SUNSTONE_LOCATION/public/js/user-plugins \ - $SUNSTONE_LOCATION/public/css \ - $SUNSTONE_LOCATION/public/locale \ - $SUNSTONE_LOCATION/public/locale/en_US \ - $SUNSTONE_LOCATION/public/locale/fa_IR \ - $SUNSTONE_LOCATION/public/locale/fr_FR \ - $SUNSTONE_LOCATION/public/locale/it_IT \ - $SUNSTONE_LOCATION/public/locale/pt_PT \ - $SUNSTONE_LOCATION/public/locale/ru_RU \ - $SUNSTONE_LOCATION/public/locale/sk_SK \ - $SUNSTONE_LOCATION/public/locale/zh_TW \ - $SUNSTONE_LOCATION/public/vendor \ - $SUNSTONE_LOCATION/public/vendor/crypto-js \ - $SUNSTONE_LOCATION/public/vendor/explorercanvas \ - $SUNSTONE_LOCATION/public/vendor/jQueryLayout \ - $SUNSTONE_LOCATION/public/vendor/dataTables \ - $SUNSTONE_LOCATION/public/vendor/jQueryUI \ - $SUNSTONE_LOCATION/public/vendor/jQueryUI/images \ - $SUNSTONE_LOCATION/public/vendor/jQuery \ - $SUNSTONE_LOCATION/public/vendor/jGrowl \ - $SUNSTONE_LOCATION/public/vendor/flot \ - $SUNSTONE_LOCATION/public/vendor/fileuploader \ - $SUNSTONE_LOCATION/public/vendor/FontAwesome \ - $SUNSTONE_LOCATION/public/vendor/FontAwesome/css \ - $SUNSTONE_LOCATION/public/vendor/FontAwesome/font \ - $SUNSTONE_LOCATION/public/images \ - $SUNSTONE_LOCATION/views" + $SUNSTONE_LOCATION/models \ + $SUNSTONE_LOCATION/models/OpenNebulaJSON \ + $SUNSTONE_LOCATION/public \ + $SUNSTONE_LOCATION/public/js \ + $SUNSTONE_LOCATION/public/js/plugins \ + $SUNSTONE_LOCATION/public/js/user-plugins \ + $SUNSTONE_LOCATION/public/css \ + $SUNSTONE_LOCATION/public/locale \ + $SUNSTONE_LOCATION/public/locale/en_US \ + $SUNSTONE_LOCATION/public/locale/fa_IR \ + $SUNSTONE_LOCATION/public/locale/fr_FR \ + $SUNSTONE_LOCATION/public/locale/it_IT \ + $SUNSTONE_LOCATION/public/locale/pt_PT \ + $SUNSTONE_LOCATION/public/locale/ru_RU \ + $SUNSTONE_LOCATION/public/locale/sk_SK \ + $SUNSTONE_LOCATION/public/locale/zh_TW \ + $SUNSTONE_LOCATION/public/vendor \ + $SUNSTONE_LOCATION/public/vendor/crypto-js \ + $SUNSTONE_LOCATION/public/vendor/explorercanvas \ + $SUNSTONE_LOCATION/public/vendor/jQueryLayout \ + $SUNSTONE_LOCATION/public/vendor/dataTables \ + $SUNSTONE_LOCATION/public/vendor/jQueryUI \ + $SUNSTONE_LOCATION/public/vendor/jQueryUI/images \ + $SUNSTONE_LOCATION/public/vendor/jQuery \ + $SUNSTONE_LOCATION/public/vendor/jGrowl \ + $SUNSTONE_LOCATION/public/vendor/flot \ + $SUNSTONE_LOCATION/public/vendor/fileuploader \ + $SUNSTONE_LOCATION/public/vendor/FontAwesome \ + $SUNSTONE_LOCATION/public/vendor/FontAwesome/css \ + $SUNSTONE_LOCATION/public/vendor/FontAwesome/font \ + $SUNSTONE_LOCATION/public/images \ + $SUNSTONE_LOCATION/views" OZONES_DIRS="$OZONES_LOCATION/lib \ - $OZONES_LOCATION/lib/OZones \ - $OZONES_LOCATION/models \ - $OZONES_LOCATION/templates \ - $OZONES_LOCATION/public \ - $OZONES_LOCATION/public/vendor \ - $OZONES_LOCATION/public/vendor/crypto-js \ - $OZONES_LOCATION/public/vendor/jQuery \ - $OZONES_LOCATION/public/vendor/jQueryLayout \ - $OZONES_LOCATION/public/vendor/dataTables \ - $OZONES_LOCATION/public/vendor/jQueryUI \ - $OZONES_LOCATION/public/vendor/jQueryUI/images \ - $OZONES_LOCATION/public/vendor/jGrowl \ - $OZONES_LOCATION/public/vendor/FontAwesome \ - $OZONES_LOCATION/public/vendor/FontAwesome/css \ - $OZONES_LOCATION/public/vendor/FontAwesome/font \ - $OZONES_LOCATION/public/js \ - $OZONES_LOCATION/public/js/plugins \ - $OZONES_LOCATION/public/images \ - $OZONES_LOCATION/public/css" + $OZONES_LOCATION/lib/OZones \ + $OZONES_LOCATION/models \ + $OZONES_LOCATION/templates \ + $OZONES_LOCATION/public \ + $OZONES_LOCATION/public/vendor \ + $OZONES_LOCATION/public/vendor/crypto-js \ + $OZONES_LOCATION/public/vendor/jQuery \ + $OZONES_LOCATION/public/vendor/jQueryLayout \ + $OZONES_LOCATION/public/vendor/dataTables \ + $OZONES_LOCATION/public/vendor/jQueryUI \ + $OZONES_LOCATION/public/vendor/jQueryUI/images \ + $OZONES_LOCATION/public/vendor/jGrowl \ + $OZONES_LOCATION/public/vendor/FontAwesome \ + $OZONES_LOCATION/public/vendor/FontAwesome/css \ + $OZONES_LOCATION/public/vendor/FontAwesome/font \ + $OZONES_LOCATION/public/js \ + $OZONES_LOCATION/public/js/plugins \ + $OZONES_LOCATION/public/images \ + $OZONES_LOCATION/public/css" SELF_SERVICE_DIRS="\ - $LIB_LOCATION/ruby/cloud/occi/ui \ - $LIB_LOCATION/ruby/cloud/occi/ui/templates \ - $LIB_LOCATION/ruby/cloud/occi/ui/views \ - $LIB_LOCATION/ruby/cloud/occi/ui/public \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/css \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/customize \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/images \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/js \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/js/plugins \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/en_US \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/de \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/es_ES \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fa_IR \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_CA \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_FR \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/it_IT \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_BR \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_PT \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/sk_SK \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/zh_TW \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryLayout \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/dataTables \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI/images \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQuery \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jGrowl \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/flot \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/crypto-js \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/fileuploader \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/xml2json \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/css \ - $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/font" + $LIB_LOCATION/ruby/cloud/occi/ui \ + $LIB_LOCATION/ruby/cloud/occi/ui/templates \ + $LIB_LOCATION/ruby/cloud/occi/ui/views \ + $LIB_LOCATION/ruby/cloud/occi/ui/public \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/css \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/customize \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/images \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/js \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/js/plugins \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/en_US \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/de \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/es_ES \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fa_IR \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_CA \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_FR \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/it_IT \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_BR \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_PT \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/sk_SK \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/locale/zh_TW \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryLayout \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/dataTables \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI/images \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQuery \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jGrowl \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/flot \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/crypto-js \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/fileuploader \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/xml2json \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/css \ + $LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/font" OZONES_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula \ - $LIB_LOCATION/ruby/cli \ - $LIB_LOCATION/ruby/cli/ozones_helper \ - $LIB_LOCATION/ruby/zona" + $LIB_LOCATION/ruby/OpenNebula \ + $LIB_LOCATION/ruby/cli \ + $LIB_LOCATION/ruby/cli/ozones_helper \ + $LIB_LOCATION/ruby/zona" LIB_ECO_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula \ - $LIB_LOCATION/ruby/cloud/ \ - $LIB_LOCATION/ruby/cloud/econe" + $LIB_LOCATION/ruby/OpenNebula \ + $LIB_LOCATION/ruby/cloud/ \ + $LIB_LOCATION/ruby/cloud/econe" LIB_OCCI_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula \ - $LIB_LOCATION/ruby/cloud/occi" + $LIB_LOCATION/ruby/OpenNebula \ + $LIB_LOCATION/ruby/cloud/occi" LIB_MARKET_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula \ - $LIB_LOCATION/ruby/cloud/marketplace" + $LIB_LOCATION/ruby/OpenNebula \ + $LIB_LOCATION/ruby/cloud/marketplace" LIB_OCA_CLIENT_DIRS="$LIB_LOCATION/ruby \ - $LIB_LOCATION/ruby/OpenNebula" + $LIB_LOCATION/ruby/OpenNebula" LIB_CLI_CLIENT_DIRS="$LIB_LOCATION/ruby/cli \ - $LIB_LOCATION/ruby/cli/one_helper" + $LIB_LOCATION/ruby/cli/one_helper" CONF_CLI_DIRS="$ETC_LOCATION/cli" if [ "$CLIENT" = "yes" ]; then -MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS $LIB_OCCI_CLIENT_DIRS $LIB_MARKET_CLIENT_DIRS \ - $LIB_OCA_CLIENT_DIRS $LIB_CLI_CLIENT_DIRS $CONF_CLI_DIRS \ - $ETC_LOCATION $OZONES_CLIENT_DIRS $SELF_SERVICE_DIRS" + MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS $LIB_OCCI_CLIENT_DIRS $LIB_MARKET_CLIENT_DIRS \ + $LIB_OCA_CLIENT_DIRS $LIB_CLI_CLIENT_DIRS $CONF_CLI_DIRS \ + $ETC_LOCATION $OZONES_CLIENT_DIRS $SELF_SERVICE_DIRS" elif [ "$SUNSTONE" = "yes" ]; then -MAKE_DIRS="$MAKE_DIRS $SUNSTONE_DIRS $LIB_OCA_CLIENT_DIRS" + MAKE_DIRS="$MAKE_DIRS $SUNSTONE_DIRS $LIB_OCA_CLIENT_DIRS" elif [ "$OZONES" = "yes" ]; then -MAKE_DIRS="$MAKE_DIRS $OZONES_DIRS $OZONES_CLIENT_DIRS $LIB_OCA_CLIENT_DIRS" + MAKE_DIRS="$MAKE_DIRS $OZONES_DIRS $OZONES_CLIENT_DIRS $LIB_OCA_CLIENT_DIRS" else -MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS \ - $OZONES_DIRS $OZONES_CLIENT_DIRS $SUNSTONE_DIRS $SELF_SERVICE_DIRS" + MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS \ + $OZONES_DIRS $OZONES_CLIENT_DIRS $SUNSTONE_DIRS $SELF_SERVICE_DIRS" fi #------------------------------------------------------------------------------- @@ -387,221 +387,222 @@ fi #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- INSTALL_FILES=( -BIN_FILES:$BIN_LOCATION -INCLUDE_FILES:$INCLUDE_LOCATION -LIB_FILES:$LIB_LOCATION -RUBY_LIB_FILES:$LIB_LOCATION/ruby -RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula -MAD_RUBY_LIB_FILES:$LIB_LOCATION/ruby -MAD_RUBY_LIB_FILES:$VAR_LOCATION/remotes -MAD_SH_LIB_FILES:$LIB_LOCATION/sh -MAD_SH_LIB_FILES:$VAR_LOCATION/remotes -ONEDB_MIGRATOR_FILES:$LIB_LOCATION/ruby/onedb -MADS_LIB_FILES:$LIB_LOCATION/mads -IM_PROBES_FILES:$VAR_LOCATION/remotes/im -IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d -IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d -IM_PROBES_VMWARE_FILES:$VAR_LOCATION/remotes/im/vmware.d -IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d -AUTH_SSH_FILES:$VAR_LOCATION/remotes/auth/ssh -AUTH_X509_FILES:$VAR_LOCATION/remotes/auth/x509 -AUTH_LDAP_FILES:$VAR_LOCATION/remotes/auth/ldap -AUTH_SERVER_X509_FILES:$VAR_LOCATION/remotes/auth/server_x509 -AUTH_SERVER_CIPHER_FILES:$VAR_LOCATION/remotes/auth/server_cipher -AUTH_DUMMY_FILES:$VAR_LOCATION/remotes/auth/dummy -AUTH_PLAIN_FILES:$VAR_LOCATION/remotes/auth/plain -VMM_EXEC_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm -VMM_EXEC_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen -VMM_EXEC_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/vmm/vmware -TM_FILES:$VAR_LOCATION/remotes/tm -TM_SHARED_FILES:$VAR_LOCATION/remotes/tm/shared -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_DUMMY_FILES:$VAR_LOCATION/remotes/tm/dummy -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_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/datastore/vmware -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 -NETWORK_FILES:$VAR_LOCATION/remotes/vnm -NETWORK_8021Q_FILES:$VAR_LOCATION/remotes/vnm/802.1Q -NETWORK_DUMMY_FILES:$VAR_LOCATION/remotes/vnm/dummy -NETWORK_EBTABLES_FILES:$VAR_LOCATION/remotes/vnm/ebtables -NETWORK_FW_FILES:$VAR_LOCATION/remotes/vnm/fw -NETWORK_OVSWITCH_FILES:$VAR_LOCATION/remotes/vnm/ovswitch -NETWORK_VMWARE_FILES:$VAR_LOCATION/remotes/vnm/vmware -EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples -INSTALL_NOVNC_SHARE_FILE:$SHARE_LOCATION -INSTALL_GEMS_SHARE_FILE:$SHARE_LOCATION -HOOK_FT_FILES:$VAR_LOCATION/remotes/hooks/ft -COMMON_CLOUD_LIB_FILES:$LIB_LOCATION/ruby/cloud -CLOUD_AUTH_LIB_FILES:$LIB_LOCATION/ruby/cloud/CloudAuth -ECO_LIB_FILES:$LIB_LOCATION/ruby/cloud/econe -ECO_LIB_VIEW_FILES:$LIB_LOCATION/ruby/cloud/econe/views -ECO_BIN_FILES:$BIN_LOCATION -OCCI_LIB_FILES:$LIB_LOCATION/ruby/cloud/occi -OCCI_BIN_FILES:$BIN_LOCATION -MARKET_LIB_FILES:$LIB_LOCATION/ruby/cloud/marketplace -MARKET_BIN_FILES:$BIN_LOCATION -MAN_FILES:$MAN_LOCATION -CLI_LIB_FILES:$LIB_LOCATION/ruby/cli -ONE_CLI_LIB_FILES:$LIB_LOCATION/ruby/cli/one_helper + BIN_FILES:$BIN_LOCATION + INCLUDE_FILES:$INCLUDE_LOCATION + LIB_FILES:$LIB_LOCATION + RUBY_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula + MAD_RUBY_LIB_FILES:$LIB_LOCATION/ruby + MAD_RUBY_LIB_FILES:$VAR_LOCATION/remotes + MAD_SH_LIB_FILES:$LIB_LOCATION/sh + MAD_SH_LIB_FILES:$VAR_LOCATION/remotes + ONEDB_MIGRATOR_FILES:$LIB_LOCATION/ruby/onedb + MADS_LIB_FILES:$LIB_LOCATION/mads + IM_PROBES_FILES:$VAR_LOCATION/remotes/im + IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d + IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d + IM_PROBES_VMWARE_FILES:$VAR_LOCATION/remotes/im/vmware.d + IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d + AUTH_SSH_FILES:$VAR_LOCATION/remotes/auth/ssh + AUTH_X509_FILES:$VAR_LOCATION/remotes/auth/x509 + AUTH_LDAP_FILES:$VAR_LOCATION/remotes/auth/ldap + AUTH_SERVER_X509_FILES:$VAR_LOCATION/remotes/auth/server_x509 + AUTH_SERVER_CIPHER_FILES:$VAR_LOCATION/remotes/auth/server_cipher + AUTH_DUMMY_FILES:$VAR_LOCATION/remotes/auth/dummy + AUTH_PLAIN_FILES:$VAR_LOCATION/remotes/auth/plain + VMM_EXEC_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm + VMM_EXEC_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen + VMM_EXEC_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/vmm/vmware + TM_FILES:$VAR_LOCATION/remotes/tm + TM_SHARED_FILES:$VAR_LOCATION/remotes/tm/shared + 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_VMWARE_FILES:$VAR_LOCATION/remotes/tm/vmware + TM_ISCSI_FILES:$VAR_LOCATION/remotes/tm/iscsi + TM_LVM_FILES:$VAR_LOCATION/remotes/tm/lvm + TM_DUMMY_FILES:$VAR_LOCATION/remotes/tm/dummy + 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_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/datastore/vmware + 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 + NETWORK_FILES:$VAR_LOCATION/remotes/vnm + NETWORK_8021Q_FILES:$VAR_LOCATION/remotes/vnm/802.1Q + NETWORK_DUMMY_FILES:$VAR_LOCATION/remotes/vnm/dummy + NETWORK_EBTABLES_FILES:$VAR_LOCATION/remotes/vnm/ebtables + NETWORK_FW_FILES:$VAR_LOCATION/remotes/vnm/fw + NETWORK_OVSWITCH_FILES:$VAR_LOCATION/remotes/vnm/ovswitch + NETWORK_VMWARE_FILES:$VAR_LOCATION/remotes/vnm/vmware + EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples + INSTALL_NOVNC_SHARE_FILE:$SHARE_LOCATION + INSTALL_GEMS_SHARE_FILE:$SHARE_LOCATION + HOOK_FT_FILES:$VAR_LOCATION/remotes/hooks/ft + COMMON_CLOUD_LIB_FILES:$LIB_LOCATION/ruby/cloud + CLOUD_AUTH_LIB_FILES:$LIB_LOCATION/ruby/cloud/CloudAuth + ECO_LIB_FILES:$LIB_LOCATION/ruby/cloud/econe + ECO_LIB_VIEW_FILES:$LIB_LOCATION/ruby/cloud/econe/views + ECO_BIN_FILES:$BIN_LOCATION + OCCI_LIB_FILES:$LIB_LOCATION/ruby/cloud/occi + OCCI_BIN_FILES:$BIN_LOCATION + MARKET_LIB_FILES:$LIB_LOCATION/ruby/cloud/marketplace + MARKET_BIN_FILES:$BIN_LOCATION + MAN_FILES:$MAN_LOCATION + CLI_LIB_FILES:$LIB_LOCATION/ruby/cli + ONE_CLI_LIB_FILES:$LIB_LOCATION/ruby/cli/one_helper ) INSTALL_CLIENT_FILES=( -COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud -ECO_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/econe -ECO_BIN_CLIENT_FILES:$BIN_LOCATION -COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud -OCCI_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/occi -OCCI_BIN_CLIENT_FILES:$BIN_LOCATION -MARKET_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/marketplace -MARKET_BIN_CLIENT_FILES:$BIN_LOCATION -CLI_BIN_FILES:$BIN_LOCATION -CLI_LIB_FILES:$LIB_LOCATION/ruby/cli -ONE_CLI_LIB_FILES:$LIB_LOCATION/ruby/cli/one_helper -ETC_CLIENT_FILES:$ETC_LOCATION -OZONES_BIN_CLIENT_FILES:$BIN_LOCATION -OZONES_LIB_CLIENT_CLI_FILES:$LIB_LOCATION/ruby/cli -OZONES_LIB_CLIENT_CLI_HELPER_FILES:$LIB_LOCATION/ruby/cli/ozones_helper -OZONES_LIB_API_FILES:$LIB_LOCATION/ruby -OZONES_LIB_API_ZONA_FILES:$LIB_LOCATION/ruby/zona -CLI_CONF_FILES:$ETC_LOCATION/cli -OCA_LIB_FILES:$LIB_LOCATION/ruby -RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula + COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud + ECO_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/econe + ECO_BIN_CLIENT_FILES:$BIN_LOCATION + COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud + OCCI_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/occi + OCCI_BIN_CLIENT_FILES:$BIN_LOCATION + MARKET_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/marketplace + MARKET_BIN_CLIENT_FILES:$BIN_LOCATION + CLI_BIN_FILES:$BIN_LOCATION + CLI_LIB_FILES:$LIB_LOCATION/ruby/cli + ONE_CLI_LIB_FILES:$LIB_LOCATION/ruby/cli/one_helper + ETC_CLIENT_FILES:$ETC_LOCATION + OZONES_BIN_CLIENT_FILES:$BIN_LOCATION + OZONES_LIB_CLIENT_CLI_FILES:$LIB_LOCATION/ruby/cli + OZONES_LIB_CLIENT_CLI_HELPER_FILES:$LIB_LOCATION/ruby/cli/ozones_helper + OZONES_LIB_API_FILES:$LIB_LOCATION/ruby + OZONES_LIB_API_ZONA_FILES:$LIB_LOCATION/ruby/zona + CLI_CONF_FILES:$ETC_LOCATION/cli + OCA_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula ) INSTALL_SUNSTONE_RUBY_FILES=( -RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula -OCA_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula + OCA_LIB_FILES:$LIB_LOCATION/ruby ) INSTALL_SUNSTONE_FILES=( -SUNSTONE_FILES:$SUNSTONE_LOCATION -SUNSTONE_BIN_FILES:$BIN_LOCATION -SUNSTONE_MODELS_FILES:$SUNSTONE_LOCATION/models -SUNSTONE_MODELS_JSON_FILES:$SUNSTONE_LOCATION/models/OpenNebulaJSON -SUNSTONE_VIEWS_FILES:$SUNSTONE_LOCATION/views -SUNSTONE_PUBLIC_JS_FILES:$SUNSTONE_LOCATION/public/js -SUNSTONE_PUBLIC_JS_PLUGINS_FILES:$SUNSTONE_LOCATION/public/js/plugins -SUNSTONE_PUBLIC_CSS_FILES:$SUNSTONE_LOCATION/public/css -SUNSTONE_PUBLIC_VENDOR_CRYPTOJS:$SUNSTONE_LOCATION/public/vendor/crypto-js -SUNSTONE_PUBLIC_VENDOR_EXPLORERCANVAS:$SUNSTONE_LOCATION/public/vendor/explorercanvas -SUNSTONE_PUBLIC_VENDOR_DATATABLES:$SUNSTONE_LOCATION/public/vendor/dataTables -SUNSTONE_PUBLIC_VENDOR_JGROWL:$SUNSTONE_LOCATION/public/vendor/jGrowl -SUNSTONE_PUBLIC_VENDOR_JQUERY:$SUNSTONE_LOCATION/public/vendor/jQuery -SUNSTONE_PUBLIC_VENDOR_JQUERYUI:$SUNSTONE_LOCATION/public/vendor/jQueryUI -SUNSTONE_PUBLIC_VENDOR_JQUERYUIIMAGES:$SUNSTONE_LOCATION/public/vendor/jQueryUI/images -SUNSTONE_PUBLIC_VENDOR_JQUERYLAYOUT:$SUNSTONE_LOCATION/public/vendor/jQueryLayout -SUNSTONE_PUBLIC_VENDOR_FLOT:$SUNSTONE_LOCATION/public/vendor/flot -SUNSTONE_PUBLIC_VENDOR_FILEUPLOADER:$SUNSTONE_LOCATION/public/vendor/fileuploader -SUNSTONE_PUBLIC_VENDOR_FONTAWESOME:$SUNSTONE_LOCATION/public/vendor/FontAwesome -SUNSTONE_PUBLIC_VENDOR_FONTAWESOME_FONT:$SUNSTONE_LOCATION/public/vendor/FontAwesome/font -SUNSTONE_PUBLIC_VENDOR_FONTAWESOME_CSS:$SUNSTONE_LOCATION/public/vendor/FontAwesome/css -SUNSTONE_PUBLIC_IMAGES_FILES:$SUNSTONE_LOCATION/public/images -SUNSTONE_PUBLIC_LOCALE_EN_US:$SUNSTONE_LOCATION/public/locale/en_US -SUNSTONE_PUBLIC_LOCALE_FA_IR:$SUNSTONE_LOCATION/public/locale/fa_IR -SUNSTONE_PUBLIC_LOCALE_FR_FR:$SUNSTONE_LOCATION/public/locale/fr_FR -SUNSTONE_PUBLIC_LOCALE_IT_IT:$SUNSTONE_LOCATION/public/locale/it_IT -SUNSTONE_PUBLIC_LOCALE_PT_PT:$SUNSTONE_LOCATION/public/locale/pt_PT -SUNSTONE_PUBLIC_LOCALE_RU_RU:$SUNSTONE_LOCATION/public/locale/ru_RU -SUNSTONE_PUBLIC_LOCALE_SK_SK:$SUNSTONE_LOCATION/public/locale/sk_SK -SUNSTONE_PUBLIC_LOCALE_ZH_TW:$SUNSTONE_LOCATION/public/locale/zh_TW + SUNSTONE_FILES:$SUNSTONE_LOCATION + SUNSTONE_BIN_FILES:$BIN_LOCATION + SUNSTONE_MODELS_FILES:$SUNSTONE_LOCATION/models + SUNSTONE_MODELS_JSON_FILES:$SUNSTONE_LOCATION/models/OpenNebulaJSON + SUNSTONE_VIEWS_FILES:$SUNSTONE_LOCATION/views + SUNSTONE_PUBLIC_JS_FILES:$SUNSTONE_LOCATION/public/js + SUNSTONE_PUBLIC_JS_PLUGINS_FILES:$SUNSTONE_LOCATION/public/js/plugins + SUNSTONE_PUBLIC_CSS_FILES:$SUNSTONE_LOCATION/public/css + SUNSTONE_PUBLIC_VENDOR_CRYPTOJS:$SUNSTONE_LOCATION/public/vendor/crypto-js + SUNSTONE_PUBLIC_VENDOR_EXPLORERCANVAS:$SUNSTONE_LOCATION/public/vendor/explorercanvas + SUNSTONE_PUBLIC_VENDOR_DATATABLES:$SUNSTONE_LOCATION/public/vendor/dataTables + SUNSTONE_PUBLIC_VENDOR_JGROWL:$SUNSTONE_LOCATION/public/vendor/jGrowl + SUNSTONE_PUBLIC_VENDOR_JQUERY:$SUNSTONE_LOCATION/public/vendor/jQuery + SUNSTONE_PUBLIC_VENDOR_JQUERYUI:$SUNSTONE_LOCATION/public/vendor/jQueryUI + SUNSTONE_PUBLIC_VENDOR_JQUERYUIIMAGES:$SUNSTONE_LOCATION/public/vendor/jQueryUI/images + SUNSTONE_PUBLIC_VENDOR_JQUERYLAYOUT:$SUNSTONE_LOCATION/public/vendor/jQueryLayout + SUNSTONE_PUBLIC_VENDOR_FLOT:$SUNSTONE_LOCATION/public/vendor/flot + SUNSTONE_PUBLIC_VENDOR_FILEUPLOADER:$SUNSTONE_LOCATION/public/vendor/fileuploader + SUNSTONE_PUBLIC_VENDOR_FONTAWESOME:$SUNSTONE_LOCATION/public/vendor/FontAwesome + SUNSTONE_PUBLIC_VENDOR_FONTAWESOME_FONT:$SUNSTONE_LOCATION/public/vendor/FontAwesome/font + SUNSTONE_PUBLIC_VENDOR_FONTAWESOME_CSS:$SUNSTONE_LOCATION/public/vendor/FontAwesome/css + SUNSTONE_PUBLIC_IMAGES_FILES:$SUNSTONE_LOCATION/public/images + SUNSTONE_PUBLIC_LOCALE_EN_US:$SUNSTONE_LOCATION/public/locale/en_US + SUNSTONE_PUBLIC_LOCALE_FA_IR:$SUNSTONE_LOCATION/public/locale/fa_IR + SUNSTONE_PUBLIC_LOCALE_FR_FR:$SUNSTONE_LOCATION/public/locale/fr_FR + SUNSTONE_PUBLIC_LOCALE_IT_IT:$SUNSTONE_LOCATION/public/locale/it_IT + SUNSTONE_PUBLIC_LOCALE_PT_PT:$SUNSTONE_LOCATION/public/locale/pt_PT + SUNSTONE_PUBLIC_LOCALE_RU_RU:$SUNSTONE_LOCATION/public/locale/ru_RU + SUNSTONE_PUBLIC_LOCALE_SK_SK:$SUNSTONE_LOCATION/public/locale/sk_SK + SUNSTONE_PUBLIC_LOCALE_ZH_TW:$SUNSTONE_LOCATION/public/locale/zh_TW ) INSTALL_SUNSTONE_ETC_FILES=( -SUNSTONE_ETC_FILES:$ETC_LOCATION + SUNSTONE_ETC_FILES:$ETC_LOCATION ) INSTALL_OZONES_RUBY_FILES=( -OZONES_RUBY_LIB_FILES:$LIB_LOCATION/ruby -RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula + OZONES_RUBY_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula ) INSTALL_OZONES_FILES=( -OZONES_FILES:$OZONES_LOCATION -OZONES_BIN_FILES:$BIN_LOCATION -OZONES_MODELS_FILES:$OZONES_LOCATION/models -OZONES_TEMPLATE_FILES:$OZONES_LOCATION/templates -OZONES_LIB_FILES:$OZONES_LOCATION/lib -OZONES_LIB_ZONE_FILES:$OZONES_LOCATION/lib/OZones -OZONES_PUBLIC_VENDOR_JQUERY:$OZONES_LOCATION/public/vendor/jQuery -OZONES_PUBLIC_VENDOR_DATATABLES:$OZONES_LOCATION/public/vendor/dataTables -OZONES_PUBLIC_VENDOR_CRYPTOJS:$OZONES_LOCATION/public/vendor/crypto-js -OZONES_PUBLIC_VENDOR_JGROWL:$OZONES_LOCATION/public/vendor/jGrowl -OZONES_PUBLIC_VENDOR_JQUERYUI:$OZONES_LOCATION/public/vendor/jQueryUI -OZONES_PUBLIC_VENDOR_JQUERYUIIMAGES:$OZONES_LOCATION/public/vendor/jQueryUI/images -OZONES_PUBLIC_VENDOR_JQUERYLAYOUT:$OZONES_LOCATION/public/vendor/jQueryLayout -OZONES_PUBLIC_VENDOR_FONTAWESOME:$OZONES_LOCATION/public/vendor/FontAwesome -OZONES_PUBLIC_VENDOR_FONTAWESOME_FONT:$OZONES_LOCATION/public/vendor/FontAwesome/font -OZONES_PUBLIC_VENDOR_FONTAWESOME_CSS:$OZONES_LOCATION/public/vendor/FontAwesome/css -OZONES_PUBLIC_JS_FILES:$OZONES_LOCATION/public/js -OZONES_PUBLIC_IMAGES_FILES:$OZONES_LOCATION/public/images -OZONES_PUBLIC_CSS_FILES:$OZONES_LOCATION/public/css -OZONES_PUBLIC_JS_PLUGINS_FILES:$OZONES_LOCATION/public/js/plugins -OZONES_BIN_CLIENT_FILES:$BIN_LOCATION -OZONES_LIB_CLIENT_CLI_FILES:$LIB_LOCATION/ruby/cli -OZONES_LIB_CLIENT_CLI_HELPER_FILES:$LIB_LOCATION/ruby/cli/ozones_helper -OZONES_LIB_API_FILES:$LIB_LOCATION/ruby -OZONES_LIB_API_ZONA_FILES:$LIB_LOCATION/ruby/zona + OZONES_FILES:$OZONES_LOCATION + OZONES_BIN_FILES:$BIN_LOCATION + OZONES_MODELS_FILES:$OZONES_LOCATION/models + OZONES_TEMPLATE_FILES:$OZONES_LOCATION/templates + OZONES_LIB_FILES:$OZONES_LOCATION/lib + OZONES_LIB_ZONE_FILES:$OZONES_LOCATION/lib/OZones + OZONES_PUBLIC_VENDOR_JQUERY:$OZONES_LOCATION/public/vendor/jQuery + OZONES_PUBLIC_VENDOR_DATATABLES:$OZONES_LOCATION/public/vendor/dataTables + OZONES_PUBLIC_VENDOR_CRYPTOJS:$OZONES_LOCATION/public/vendor/crypto-js + OZONES_PUBLIC_VENDOR_JGROWL:$OZONES_LOCATION/public/vendor/jGrowl + OZONES_PUBLIC_VENDOR_JQUERYUI:$OZONES_LOCATION/public/vendor/jQueryUI + OZONES_PUBLIC_VENDOR_JQUERYUIIMAGES:$OZONES_LOCATION/public/vendor/jQueryUI/images + OZONES_PUBLIC_VENDOR_JQUERYLAYOUT:$OZONES_LOCATION/public/vendor/jQueryLayout + OZONES_PUBLIC_VENDOR_FONTAWESOME:$OZONES_LOCATION/public/vendor/FontAwesome + OZONES_PUBLIC_VENDOR_FONTAWESOME_FONT:$OZONES_LOCATION/public/vendor/FontAwesome/font + OZONES_PUBLIC_VENDOR_FONTAWESOME_CSS:$OZONES_LOCATION/public/vendor/FontAwesome/css + OZONES_PUBLIC_JS_FILES:$OZONES_LOCATION/public/js + OZONES_PUBLIC_IMAGES_FILES:$OZONES_LOCATION/public/images + OZONES_PUBLIC_CSS_FILES:$OZONES_LOCATION/public/css + OZONES_PUBLIC_JS_PLUGINS_FILES:$OZONES_LOCATION/public/js/plugins + OZONES_BIN_CLIENT_FILES:$BIN_LOCATION + OZONES_LIB_CLIENT_CLI_FILES:$LIB_LOCATION/ruby/cli + OZONES_LIB_CLIENT_CLI_HELPER_FILES:$LIB_LOCATION/ruby/cli/ozones_helper + OZONES_LIB_API_FILES:$LIB_LOCATION/ruby + OZONES_LIB_API_ZONA_FILES:$LIB_LOCATION/ruby/zona ) INSTALL_OZONES_ETC_FILES=( -OZONES_ETC_FILES:$ETC_LOCATION + OZONES_ETC_FILES:$ETC_LOCATION ) INSTALL_SELF_SERVICE_FILES=( -SELF_SERVICE_TEMPLATE_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/templates -SELF_SERVICE_VIEWS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/views -SELF_SERVICE_PUBLIC_JS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/js -SELF_SERVICE_PUBLIC_JS_PLUGINS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/js/plugins -SELF_SERVICE_PUBLIC_CSS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/css -SELF_SERVICE_PUBLIC_CUSTOMIZE_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/customize -SELF_SERVICE_PUBLIC_VENDOR_DATATABLES:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/dataTables -SELF_SERVICE_PUBLIC_VENDOR_JGROWL:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jGrowl -SELF_SERVICE_PUBLIC_VENDOR_JQUERY:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQuery -SELF_SERVICE_PUBLIC_VENDOR_JQUERYUI:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI -SELF_SERVICE_PUBLIC_VENDOR_JQUERYUIIMAGES:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI/images -SELF_SERVICE_PUBLIC_VENDOR_JQUERYLAYOUT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryLayout -SELF_SERVICE_PUBLIC_VENDOR_FLOT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/flot -SELF_SERVICE_PUBLIC_VENDOR_CRYPTOJS:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/crypto-js -SELF_SERVICE_PUBLIC_VENDOR_FILEUPLOADER:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/fileuploader -SELF_SERVICE_PUBLIC_VENDOR_XML2JSON:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/xml2json -SELF_SERVICE_PUBLIC_VENDOR_FONTAWESOME:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome -SELF_SERVICE_PUBLIC_VENDOR_FONTAWESOME_CSS:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/css -SELF_SERVICE_PUBLIC_VENDOR_FONTAWESOME_FONT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/font -SELF_SERVICE_PUBLIC_IMAGES_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/images -SELF_SERVICE_PUBLIC_LOCALE_EN_US:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/en_US -SELF_SERVICE_PUBLIC_LOCALE_DE:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/de -SELF_SERVICE_PUBLIC_LOCALE_ES_ES:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/es_ES -SELF_SERVICE_PUBLIC_LOCALE_FA_IR:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fa_IR -SELF_SERVICE_PUBLIC_LOCALE_FR_CA:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_CA -SELF_SERVICE_PUBLIC_LOCALE_FR_FR:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_FR -SELF_SERVICE_PUBLIC_LOCALE_IT_IT:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/it_IT -SELF_SERVICE_PUBLIC_LOCALE_PT_BR:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_BR -SELF_SERVICE_PUBLIC_LOCALE_PT_PT:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_PT -SELF_SERVICE_PUBLIC_LOCALE_SK_SK:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/sk_SK -SELF_SERVICE_PUBLIC_LOCALE_ZH_TW:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/zh_TW + SELF_SERVICE_TEMPLATE_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/templates + SELF_SERVICE_VIEWS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/views + SELF_SERVICE_PUBLIC_JS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/js + SELF_SERVICE_PUBLIC_JS_PLUGINS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/js/plugins + SELF_SERVICE_PUBLIC_CSS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/css + SELF_SERVICE_PUBLIC_CUSTOMIZE_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/customize + SELF_SERVICE_PUBLIC_VENDOR_DATATABLES:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/dataTables + SELF_SERVICE_PUBLIC_VENDOR_JGROWL:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jGrowl + SELF_SERVICE_PUBLIC_VENDOR_JQUERY:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQuery + SELF_SERVICE_PUBLIC_VENDOR_JQUERYUI:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI + SELF_SERVICE_PUBLIC_VENDOR_JQUERYUIIMAGES:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI/images + SELF_SERVICE_PUBLIC_VENDOR_JQUERYLAYOUT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryLayout + SELF_SERVICE_PUBLIC_VENDOR_FLOT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/flot + SELF_SERVICE_PUBLIC_VENDOR_CRYPTOJS:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/crypto-js + SELF_SERVICE_PUBLIC_VENDOR_FILEUPLOADER:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/fileuploader + SELF_SERVICE_PUBLIC_VENDOR_XML2JSON:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/xml2json + SELF_SERVICE_PUBLIC_VENDOR_FONTAWESOME:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome + SELF_SERVICE_PUBLIC_VENDOR_FONTAWESOME_CSS:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/css + SELF_SERVICE_PUBLIC_VENDOR_FONTAWESOME_FONT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/FontAwesome/font + SELF_SERVICE_PUBLIC_IMAGES_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/images + SELF_SERVICE_PUBLIC_LOCALE_EN_US:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/en_US + SELF_SERVICE_PUBLIC_LOCALE_DE:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/de + SELF_SERVICE_PUBLIC_LOCALE_ES_ES:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/es_ES + SELF_SERVICE_PUBLIC_LOCALE_FA_IR:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fa_IR + SELF_SERVICE_PUBLIC_LOCALE_FR_CA:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_CA + SELF_SERVICE_PUBLIC_LOCALE_FR_FR:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/fr_FR + SELF_SERVICE_PUBLIC_LOCALE_IT_IT:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/it_IT + SELF_SERVICE_PUBLIC_LOCALE_PT_BR:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_BR + SELF_SERVICE_PUBLIC_LOCALE_PT_PT:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/pt_PT + SELF_SERVICE_PUBLIC_LOCALE_SK_SK:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/sk_SK + SELF_SERVICE_PUBLIC_LOCALE_ZH_TW:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/zh_TW ) INSTALL_ETC_FILES=( -ETC_FILES:$ETC_LOCATION -VMWARE_ETC_FILES:$ETC_LOCATION -VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 -VMM_EXEC_ETC_FILES:$ETC_LOCATION/vmm_exec -IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2 -HM_ETC_FILES:$ETC_LOCATION/hm -AUTH_ETC_FILES:$ETC_LOCATION/auth -ECO_ETC_FILES:$ETC_LOCATION -ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates -OCCI_ETC_FILES:$ETC_LOCATION -OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates -CLI_CONF_FILES:$ETC_LOCATION/cli + ETC_FILES:$ETC_LOCATION + VMWARE_ETC_FILES:$ETC_LOCATION + VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 + VMM_EXEC_ETC_FILES:$ETC_LOCATION/vmm_exec + IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2 + HM_ETC_FILES:$ETC_LOCATION/hm + AUTH_ETC_FILES:$ETC_LOCATION/auth + ECO_ETC_FILES:$ETC_LOCATION + ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates + OCCI_ETC_FILES:$ETC_LOCATION + OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates + CLI_CONF_FILES:$ETC_LOCATION/cli ) #------------------------------------------------------------------------------- @@ -609,22 +610,22 @@ CLI_CONF_FILES:$ETC_LOCATION/cli #------------------------------------------------------------------------------- BIN_FILES="src/nebula/oned \ - src/scheduler/src/sched/mm_sched \ - src/cli/onevm \ - src/cli/oneacct \ - src/cli/onehost \ - src/cli/onevnet \ - src/cli/oneuser \ - src/cli/oneimage \ - src/cli/onegroup \ - src/cli/onetemplate \ - src/cli/oneacl \ - src/cli/onedatastore \ - src/cli/onecluster \ - src/onedb/onedb \ - src/onedb/onezonedb/onezonedb \ - src/mad/utils/tty_expect \ - share/scripts/one" + src/scheduler/src/sched/mm_sched \ + src/cli/onevm \ + src/cli/oneacct \ + src/cli/onehost \ + src/cli/onevnet \ + src/cli/oneuser \ + src/cli/oneimage \ + src/cli/onegroup \ + src/cli/onetemplate \ + src/cli/oneacl \ + src/cli/onedatastore \ + src/cli/onecluster \ + src/onedb/onedb \ + src/onedb/onezonedb/onezonedb \ + src/mad/utils/tty_expect \ + share/scripts/one" #------------------------------------------------------------------------------- # C/C++ OpenNebula API Library & Development files @@ -640,19 +641,19 @@ LIB_FILES="" #------------------------------------------------------------------------------- RUBY_LIB_FILES="src/mad/ruby/ActionManager.rb \ - src/mad/ruby/CommandManager.rb \ - src/mad/ruby/OpenNebulaDriver.rb \ - src/mad/ruby/VirtualMachineDriver.rb \ - src/mad/ruby/DriverExecHelper.rb \ - src/mad/ruby/ssh_stream.rb \ - src/vnm_mad/one_vnm.rb \ - src/mad/ruby/Ganglia.rb \ - src/oca/ruby/OpenNebula.rb \ - src/authm_mad/remotes/ssh/ssh_auth.rb \ - src/authm_mad/remotes/server_x509/server_x509_auth.rb \ - src/authm_mad/remotes/server_cipher/server_cipher_auth.rb \ - src/authm_mad/remotes/ldap/ldap_auth.rb \ - src/authm_mad/remotes/x509/x509_auth.rb" + src/mad/ruby/CommandManager.rb \ + src/mad/ruby/OpenNebulaDriver.rb \ + src/mad/ruby/VirtualMachineDriver.rb \ + src/mad/ruby/DriverExecHelper.rb \ + src/mad/ruby/ssh_stream.rb \ + src/vnm_mad/one_vnm.rb \ + src/mad/ruby/Ganglia.rb \ + src/oca/ruby/OpenNebula.rb \ + src/authm_mad/remotes/ssh/ssh_auth.rb \ + src/authm_mad/remotes/server_x509/server_x509_auth.rb \ + src/authm_mad/remotes/server_cipher/server_cipher_auth.rb \ + src/authm_mad/remotes/ldap/ldap_auth.rb \ + src/authm_mad/remotes/x509/x509_auth.rb" #----------------------------------------------------------------------------- # MAD Script library files, to be installed under $LIB_LOCATION/ + + From 0b427dde457999f3783e47b43230cf504846bfd9 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 28 Sep 2012 14:45:10 +0200 Subject: [PATCH 56/58] feature #1437: Homogenoeus naming and function encapsulation for VMFS ds drivers --- src/datastore_mad/remotes/vmfs/clone | 17 ++++------- src/datastore_mad/remotes/vmfs/cp | 31 +++++++------------- src/datastore_mad/remotes/vmfs/mkfs | 43 ++++++++++++---------------- src/datastore_mad/remotes/vmfs/rm | 24 ++++++---------- src/mad/sh/scripts_common.sh | 22 ++++++++++++++ 5 files changed, 64 insertions(+), 73 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone index 6036573148..bed2c43de7 100755 --- a/src/datastore_mad/remotes/vmfs/clone +++ b/src/datastore_mad/remotes/vmfs/clone @@ -65,22 +65,15 @@ SRC="${XPATH_ELEMENTS[5]}" IMAGE_ID="${XPATH_ELEMENTS[6]}" SRC_FOLDER=`basename $SRC` - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" - DST=`generate_image_path` DST_FOLDER=`basename $DST` DST_HOST=`get_destination_host $IMAGE_ID` -if [ "$USE_SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +# ------------ Set up datastore ------------- + +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +vmfs_set_up # ------------ Copy the image to the repository ------------- diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 2984bc4cac..43d211e004 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -76,34 +76,23 @@ MD5="${XPATH_ELEMENTS[9]}" SHA1="${XPATH_ELEMENTS[10]}" IMAGE_ID="${XPATH_ELEMENTS[11]}" -# Set up the datastore -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" - FE_DST=`generate_image_path` DST_FOLDER=`basename $FE_DST` DST="/vmfs/volumes/$DS_ID/$DST_FOLDER" DST_HOST=`get_destination_host $IMAGE_ID` -if [ "$USE_SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi -# Create DST in DST_HOST -if [ "$USE_SSH" == "yes" ]; then - ssh_make_path $DST_HOST $DST -else - exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ - "Cannot create $DST in $DST_HOST" -fi +# ------------ Set up datastore ------------- -# Prepare for a possible download in the front-end -if [ ! -d $TMP_DIR ]; then +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +vmfs_set_up + +vmfs_create_remote_path + +# ------------ Prepare for a possible download in the front-end ------------- + +if [ ! -d $TMP_DIR ]; then mkdir -p $TMP_DIR fi diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 31ec0a922e..d4a633d367 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -63,27 +63,20 @@ RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" SAFE_DIRS="${XPATH_ELEMENTS[2]}" UMASK="${XPATH_ELEMENTS[3]}" USE_SSH="${XPATH_ELEMENTS[4]:-$DS_USE_SSH}" -IMAGE_DS_ID="${XPATH_ELEMENTS[5]}" +DS_ID="${XPATH_ELEMENTS[5]}" FSTYPE="${XPATH_ELEMENTS[6]}" SIZE="${XPATH_ELEMENTS[7]}" IMAGE_ID="${XPATH_ELEMENTS[8]}" - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" - DST=`generate_image_path` DST_DIR=`dirname $DST` DST_FOLDER=`basename $DST` DST_HOST=`get_destination_host $IMAGE_ID` -if [ "$USE_SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +# ------------ Set up datastore ------------- + +set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" + +vmfs_set_up # ------------ Image to save_as disk, no need to create a FS ------------ @@ -94,23 +87,23 @@ fi # ------------ Create the image within the image datastore ------------ -log "Making filesystem of ${SIZE}M (with no format) at [$IMAGE_DS_ID]$DST_FOLDER on $DST_HOST" +log "Making filesystem of ${SIZE}M (with no format) at [$DS_ID]$DST_FOLDER on $DST_HOST" IMAGE_FORMAT=vmdk VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` if [ "$USE_SSH" == "yes" ]; then - ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" \ - "Could not create disk directory /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER on $DST_HOST" - $SSH $DST_HOST $VMKFSTOOLS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} /vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER/disk.vmdk" \ - "Cannot create [$IMAGE_DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" + ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$DS_ID/$DST_FOLDER" \ + "Could not create disk directory /vmfs/volumes/$DS_ID/$DST_FOLDER on $DST_HOST" + $SSH $DST_HOST $VMKFSTOOLS -U [$DS_ID]$DST_FOLDER/disk.vmdk + ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} /vmfs/volumes/$DS_ID/$DST_FOLDER/disk.vmdk" \ + "Cannot create [$DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else - $VMKFSTOOLS $VI_PARAMS -U [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null - exec_and_log "vifs $VI_PARAMS --mkdir [$IMAGE_DS_ID]$DST_FOLDER" \ - "Cannot create [$IMAGE_DS_ID] $DST_FOLDER on $DST_HOST" - exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$IMAGE_DS_ID]$DST_FOLDER/disk.vmdk" \ - "Cannot create $IMAGE_DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" + $VMKFSTOOLS $VI_PARAMS -U [$DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null + exec_and_log "vifs $VI_PARAMS --mkdir [$IDS_ID]$DST_FOLDER" \ + "Cannot create [$DS_ID] $DST_FOLDER on $DST_HOST" + exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$DS_ID]$DST_FOLDER/disk.vmdk" \ + "Cannot create $DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi -echo "/vmfs/volumes/$IMAGE_DS_ID/$DST_FOLDER" +echo "/vmfs/volumes/$DS_ID/$DST_FOLDER" diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm index 9f38fc8286..a5a6b1eed2 100755 --- a/src/datastore_mad/remotes/vmfs/rm +++ b/src/datastore_mad/remotes/vmfs/rm @@ -53,40 +53,34 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \ /DS_DRIVER_ACTION_DATA/IMAGE/ID) SRC="${XPATH_ELEMENTS[0]}" -DS_NAME="${XPATH_ELEMENTS[1]}" +DS_ID="${XPATH_ELEMENTS[1]}" USE_SSH="${XPATH_ELEMENTS[4]:-$DS_USE_SSH}" IMAGE_ID="${XPATH_ELEMENTS[2]}" DST_HOST=`get_destination_host $IMAGE_ID` DST_FOLDER=`basename $SRC` -if [ "$USE_SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +# ------------ Set up datastore ------------ + +vmfs_set_up # ------------ Remove the image from the repository ------------ log "Removing $SRC from the image repository" if [ "$USE_SSH" == "yes" ]; then - if [ -n $DS_NAME -a -n $DST_FOLDER ]; then - ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_NAME/$DST_FOLDER" \ + if [ -n $DS_ID -a -n $DST_FOLDER ]; then + ssh_exec_and_log $DST_HOST "rm -rf /vmfs/volumes/$DS_ID/$DST_FOLDER" \ "Error deleting $SRC" fi else # We have to erase the contents of the folder one by one - FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_NAME]$DST_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` + FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DS_ID]$DST_FOLDER|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for file in $FILES_TO_ERASE; do - exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER/$file" \ + exec_and_log "vifs $VI_PARAMS --force --rm [$DS_ID]$DST_FOLDER/$file" \ "Cannot delete $DST_FOLDER/$file in $DST_HOST" done - exec_and_log "vifs $VI_PARAMS --force --rm [$DS_NAME]$DST_FOLDER" \ + exec_and_log "vifs $VI_PARAMS --force --rm [$DS_ID]$DST_FOLDER" \ "Cannot delete $DST_FOLDER in $DST_HOST" fi diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index f0f346a82b..d7a6e5aeb5 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -409,3 +409,25 @@ function iqn_get_host { VG_NAME=$(iqn_get_vg_name "$IQN") echo ${TARGET%%.$VG_NAME.$LV_NAME} } + +function vmfs_crate_remote_path { + # Create DST in DST_HOST + if [ "$USE_SSH" == "yes" ]; then + ssh_make_path $DST_HOST $DST + else + exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ + "Cannot create $DST in $DST_HOST" + fi +} + +function vmfs_set_up { + if [ "$USE_SSH" != "yes" ]; then + USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` + PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` + if [ -z $PASSWORD ]; then + VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" + else + VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" + fi + fi +} From 7d49f9cbcb1e23d4333b65132a2dd12219ec30db Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 28 Sep 2012 15:06:24 +0200 Subject: [PATCH 57/58] feature #1437: Make DS_ID a parameter in vmfs_create_remote_path --- src/datastore_mad/remotes/vmfs/cp | 2 +- src/datastore_mad/remotes/vmfs/mkfs | 6 ++---- src/mad/sh/scripts_common.sh | 8 +++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp index 43d211e004..f0d49bfc0f 100755 --- a/src/datastore_mad/remotes/vmfs/cp +++ b/src/datastore_mad/remotes/vmfs/cp @@ -88,7 +88,7 @@ set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" vmfs_set_up -vmfs_create_remote_path +vmfs_create_remote_path $DS_ID # ------------ Prepare for a possible download in the front-end ------------- diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index d4a633d367..2afba4dd8b 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -78,6 +78,8 @@ set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" vmfs_set_up +vmfs_create_remote_path $DS_ID + # ------------ Image to save_as disk, no need to create a FS ------------ if [ "$FSTYPE" = "save_as" ]; then @@ -93,15 +95,11 @@ IMAGE_FORMAT=vmdk VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` if [ "$USE_SSH" == "yes" ]; then - ssh_exec_and_log $DST_HOST "mkdir -p /vmfs/volumes/$DS_ID/$DST_FOLDER" \ - "Could not create disk directory /vmfs/volumes/$DS_ID/$DST_FOLDER on $DST_HOST" $SSH $DST_HOST $VMKFSTOOLS -U [$DS_ID]$DST_FOLDER/disk.vmdk ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} /vmfs/volumes/$DS_ID/$DST_FOLDER/disk.vmdk" \ "Cannot create [$DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else $VMKFSTOOLS $VI_PARAMS -U [$DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null - exec_and_log "vifs $VI_PARAMS --mkdir [$IDS_ID]$DST_FOLDER" \ - "Cannot create [$DS_ID] $DST_FOLDER on $DST_HOST" exec_and_log "$VMKFSTOOLS $VI_PARAMS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} [$DS_ID]$DST_FOLDER/disk.vmdk" \ "Cannot create $DS_ID]$DST_FOLDER/disk.vmdk on $DST_HOST" fi diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index d7a6e5aeb5..28cbca0d4e 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -411,12 +411,14 @@ function iqn_get_host { } function vmfs_crate_remote_path { + DS_ID=$1 # Create DST in DST_HOST if [ "$USE_SSH" == "yes" ]; then - ssh_make_path $DST_HOST $DST + exec_and_log "ssh_make_path $DST_HOST $DST" \ + "Cannot create $DST in $DST_HOST" else - exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ - "Cannot create $DST in $DST_HOST" + exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \ + "Cannot create [$DS_ID]$DST_FOLDER in $DST_HOST" fi } From 41f4891dce5dc0599d6ec8bc574136f2c718ea8f Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 28 Sep 2012 15:38:52 +0200 Subject: [PATCH 58/58] =?UTF-8?q?feature=20=C2#1437:=20Lightrefactor=20TM?= =?UTF-8?q?=20VMFS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/datastore_mad/remotes/vmfs/mkfs | 2 +- src/mad/sh/scripts_common.sh | 12 +++++++++++- src/tm_mad/vmfs/clone | 18 +++++------------- src/tm_mad/vmfs/context | 18 ++++++------------ src/tm_mad/vmfs/delete | 15 ++++++--------- src/tm_mad/vmfs/mkimage | 20 +++++++------------- src/tm_mad/vmfs/mvds | 19 ++++++++----------- 7 files changed, 44 insertions(+), 60 deletions(-) diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs index 2afba4dd8b..63a6784738 100755 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ b/src/datastore_mad/remotes/vmfs/mkfs @@ -95,7 +95,7 @@ IMAGE_FORMAT=vmdk VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` if [ "$USE_SSH" == "yes" ]; then - $SSH $DST_HOST $VMKFSTOOLS -U [$DS_ID]$DST_FOLDER/disk.vmdk + $SSH $DST_HOST $VMKFSTOOLS -U [$DS_ID]$DST_FOLDER/disk.vmdk &> /dev/null ssh_exec_and_log $DST_HOST "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} /vmfs/volumes/$DS_ID/$DST_FOLDER/disk.vmdk" \ "Cannot create [$DS_ID] $DST_FOLDER/disk.vmdk on $DST_HOST" else diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index 28cbca0d4e..74ae5eb7e9 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -410,7 +410,7 @@ function iqn_get_host { echo ${TARGET%%.$VG_NAME.$LV_NAME} } -function vmfs_crate_remote_path { +function vmfs_create_remote_path { DS_ID=$1 # Create DST in DST_HOST if [ "$USE_SSH" == "yes" ]; then @@ -433,3 +433,13 @@ function vmfs_set_up { fi fi } + +function vmfs_create_double_path { + DS_ID=$1 + FIRST_FOLDER=$2 + SECOND_FOLDER=$3 + # Two calls needed since vifs cannot do a mkdir -p + vifs $VI_PARAMS --force --mkdir [$DS_ID]$FIRST_FOLDER &> /dev/null + vifs $VI_PARAMS --force --mkdir [$DS_ID]$FIRST_FOLDER/$SECOND_FOLDER &> /dev/null + +} diff --git a/src/tm_mad/vmfs/clone b/src/tm_mad/vmfs/clone index e24000425e..c5ec706223 100755 --- a/src/tm_mad/vmfs/clone +++ b/src/tm_mad/vmfs/clone @@ -53,19 +53,13 @@ DST_DIR=`dirname $DST_PATH` DST_FOLDER=`basename $DST_PATH` IMAGE_DS_NAME=`basename $(dirname $SRC_PATH)` SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` - USE_SSH=$(get_tm_use_ssh $IMAGE_DS_NAME) -if [ "$USE_SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` +#------------------------------------------------------------------------------- +# Set up datastore +#------------------------------------------------------------------------------- - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +vmfs_set_up #------------------------------------------------------------------------------- # Create remote folder @@ -74,9 +68,7 @@ fi if [ "$USE_SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_PATH else - # Two calls needed since vifs cannot do a mkdir -p - vifs $VI_PARAMS --force --mkdir [$SYSTEM_DS_NAME]$VMID &> /dev/null - vifs $VI_PARAMS --force --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER &> /dev/null + vmfs_create_double_path $SYSTEM_DS_NAME $VMID $DST_FOLDER fi #------------------------------------------------------------------------------- diff --git a/src/tm_mad/vmfs/context b/src/tm_mad/vmfs/context index 7312189db6..48b8500218 100755 --- a/src/tm_mad/vmfs/context +++ b/src/tm_mad/vmfs/context @@ -48,18 +48,13 @@ DST_PATH=`arg_path $DST` DST_HOST=`arg_host $DST` DST_DIR=`dirname $DST_PATH` DST_FOLDER=`basename $DST_PATH` - USE_SSH=$(get_tm_use_ssh $DS_ID) -if [ "$USE_SSH" != "yes" ]; then - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +#------------------------------------------------------------------------------- +# Set up datastore +#------------------------------------------------------------------------------- + +vmfs_set_up #------------------------------------------------------------------------------- # Create remote folder @@ -68,8 +63,7 @@ fi if [ "$USE_SSH" == "yes" ]; then ssh_make_path $DST_HOST $DST_DIR else - vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID - vifs $VI_PARAMS --mkdir [$DS_ID]$VM_ID/$DST_FOLDER + vmfs_create_double_path $DS_ID $VM_ID $DST_FOLDER fi #------------------------------------------------------------------------------- diff --git a/src/tm_mad/vmfs/delete b/src/tm_mad/vmfs/delete index b7565993ea..0a7293f27c 100755 --- a/src/tm_mad/vmfs/delete +++ b/src/tm_mad/vmfs/delete @@ -47,6 +47,12 @@ source $(dirname $0)/tm_vmfs.conf USE_SSH=$(get_tm_use_ssh $DSID) +#------------------------------------------------------------------------------- +# Set up datastore +#------------------------------------------------------------------------------- + +vmfs_set_up + #------------------------------------------------------------------------------- # Return if deleting a disk, we will delete them when removing the # remote_system_ds directory for the VM (remotely) @@ -63,14 +69,6 @@ log "Deleting $DST_PATH" if [ "$USE_SSH" == "yes" ]; then ssh_exec_and_log $DST_HOST "rm -rf $DST_PATH" "Error deleting $DST_PATH" else - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi - DIRS_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` for dir in $DIRS_TO_ERASE; do FILES_TO_ERASE=`vifs $VI_PARAMS --dir [$DSID]$VMID/$dir|grep -v "Content Listing"|grep -v "\-\-\-\-\-\-\-\-"|egrep -v "^[[:space:]]*$"` @@ -83,7 +81,6 @@ else done exec_and_log "vifs $VI_PARAMS --force --rm [$DSID]$VMID" \ "Cannot delete [$DSID]$VMID in $DST_HOST" - fi exit 0 diff --git a/src/tm_mad/vmfs/mkimage b/src/tm_mad/vmfs/mkimage index 711f6b1fd2..339eec878e 100755 --- a/src/tm_mad/vmfs/mkimage +++ b/src/tm_mad/vmfs/mkimage @@ -51,17 +51,13 @@ DST_DIR=`dirname $DST_PATH` DST_FOLDER=`basename $DST_PATH` USE_SSH=$(get_tm_use_ssh $DSID) +SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` -if [ "$USE_SSH" != "yes" ]; then - SYSTEM_DS_NAME=`basename $(dirname $(dirname $DST_PATH))` - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +#------------------------------------------------------------------------------- +# Set up datastore +#------------------------------------------------------------------------------- + +vmfs_set_up #------------------------------------------------------------------------------- # Make the new image (file-based) @@ -82,9 +78,7 @@ EOF ssh_exec_and_log $DST_HOST "$MKSCRIPT" "Could not create image $DST_PATH" else - # Two calls needed since vifs cannot do a mkdir -p - vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID - vifs $VI_PARAMS --mkdir [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER + vmfs_create_double_path $SYSTEM_DS_NAME $VMID $DST_FOLDER VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` $VMKFSTOOLS $VI_PARAMS -U [$SYSTEM_DS_NAME]$VMID/$DST_FOLDER/disk.vmdk &> /dev/null diff --git a/src/tm_mad/vmfs/mvds b/src/tm_mad/vmfs/mvds index dc96f61c23..a89f8d606a 100755 --- a/src/tm_mad/vmfs/mvds +++ b/src/tm_mad/vmfs/mvds @@ -55,17 +55,14 @@ DST_FOLDER=`basename $DST_PATH` USE_SSH=$(get_tm_use_ssh $DSID) -if [ "$USE_SSH" != "yes" ]; then - IMAGE_DS_NAME=`basename $(dirname $DST_PATH)` - SYSTEM_DS_NAME=`basename $(dirname $(dirname $SRC_PATH))` - USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')` - PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')` - if [ -z $PASSWORD ]; then - VI_PARAMS="--server $DST_HOST --username $USERNAME --password \"\"" - else - VI_PARAMS="--server $DST_HOST --username $USERNAME --password $PASSWORD" - fi -fi +IMAGE_DS_NAME=`basename $(dirname $DST_PATH)` +SYSTEM_DS_NAME=`basename $(dirname $(dirname $SRC_PATH))` + +#------------------------------------------------------------------------------- +# Set up datastore +#------------------------------------------------------------------------------- + +vmfs_set_up #------------------------------------------------------------------------------- # Move the image back to the datastore