Skip to content
Browse files

tm_nfs now fixes urls that point to VM_DIR remotelly

git-svn-id: http://svn.opennebula.org/one/trunk@894 3034c82b-c49b-4eb3-8279-a7acafdc01c0
  • Loading branch information...
1 parent 809dc26 commit ed1b1d210063e95c72e101967087449ce6a4d340 jfontan committed Oct 26, 2009
View
4 src/tm_mad/nfs/tm_clone.sh
@@ -28,9 +28,13 @@ fi
. $TMCOMMON
+get_vmdir
+
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
+fix_paths
+
log "$1 $2"
log "DST: $DST_PATH"
View
4 src/tm_mad/nfs/tm_context.sh
@@ -38,8 +38,12 @@ fi
. $TMCOMMON
+get_vmdir
DST_PATH=`arg_path $DST`
+
+fix_dst_path
+
DST_DIR=`dirname $DST_PATH`
ISO_DIR=$DST_DIR/isofiles
View
4 src/tm_mad/nfs/tm_delete.sh
@@ -28,7 +28,11 @@ fi
. $TMCOMMON
+get_vmdir
+
SRC_PATH=`arg_path $SRC`
+fix_src_path
+
log "Deleting $SRC_PATH"
exec_and_log "rm -rf $SRC_PATH"
View
4 src/tm_mad/nfs/tm_ln.sh
@@ -28,9 +28,13 @@ fi
. $TMCOMMON
+get_vmdir
+
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
+fix_dst_path
+
DST_DIR=`dirname $DST_PATH`
log "Creating directory $DST_DIR"
View
5 src/tm_mad/nfs/tm_mkimage.sh
@@ -25,11 +25,16 @@ fi
. $TMCOMMON
+get_vmdir
+
SIZE=$1
FSTYPE=$2
DST=$3
DST_PATH=`arg_path $DST`
+
+fix_dst_path
+
DST_DIR=`dirname $DST_PATH`
exec_and_log "mkdir -p $DST_DIR"
View
5 src/tm_mad/nfs/tm_mkswap.sh
@@ -28,7 +28,12 @@ fi
. $TMCOMMON
+get_vmdir
+
DST_PATH=`arg_path $DST`
+
+fix_dst_path
+
DST_DIR=`dirname $DST_PATH`
log "Creating directory $DST_DIR"
View
4 src/tm_mad/nfs/tm_mv.sh
@@ -30,9 +30,13 @@ fi
. $TMCOMMON
+get_vmdir
+
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
+fix_paths
+
if [ "$SRC_PATH" == "$DST_PATH" ]; then
log "Will not move, source and destination are equal"
else
View
35 src/tm_mad/tm_common.sh
@@ -15,6 +15,41 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
+if [ -z "$ONE_LOCATION" ]; then
+ ONE_CONF=/etc/one/oned.conf
+ ONE_LOCAL_VAR=/var/lib/one
+else
+ ONE_CONF=$ONE_LOCATION/etc/oned.conf
+ ONE_LOCAL_VAR=$ONE_LOCATION/var
+fi
+
+function get_vmdir
+{
+ VMDIR=`cat $ONE_CONF | grep ^VM_DIR= | cut -d= -f2`
+}
+
+function fix_paths
+{
+ if [ -n "$VMDIR" ]; then
+ SRC_PATH=${SRC_PATH/$VMDIR/$ONE_LOCAL_VAR}
+ DST_PATH=${DST_PATH/$VMDIR/$ONE_LOCAL_VAR}
+ fi
+}
+
+function fix_src_path
+{
+ if [ -n "$VMDIR" ]; then
+ SRC_PATH=${SRC_PATH/$VMDIR/$ONE_LOCAL_VAR}
+ fi
+}
+
+function fix_dst_path
+{
+ if [ -n "$VMDIR" ]; then
+ DST_PATH=${DST_PATH/$VMDIR/$ONE_LOCAL_VAR}
+ fi
+}
+
# Used for log messages
SCRIPT_NAME=`basename $0`

0 comments on commit ed1b1d2

Please sign in to comment.
Something went wrong with that request. Please try again.