diff --git a/src/tm_mad/common/context b/src/tm_mad/common/context
index d519110140..a37c4b7f07 100755
--- a/src/tm_mad/common/context
+++ b/src/tm_mad/common/context
@@ -16,10 +16,12 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# context context.sh file1 file2 ... fileN host:remote_system_ds/disk.i
+# 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)
while (( "$#" )); do
if [ "$#" == "1" ]; then
diff --git a/src/tm_mad/common/delete b/src/tm_mad/common/delete
index f0c68244a6..9ae6e42f29 100755
--- a/src/tm_mad/common/delete
+++ b/src/tm_mad/common/delete
@@ -16,12 +16,17 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# DELETE
+# 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
else
diff --git a/src/tm_mad/common/mkimage b/src/tm_mad/common/mkimage
index 55e10ff27c..ea5a14ca86 100755
--- a/src/tm_mad/common/mkimage
+++ b/src/tm_mad/common/mkimage
@@ -16,16 +16,21 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# mkimage size format host:remote_system_ds/disk.i size
+# mkimage size format host:remote_system_ds/disk.i vmid dsid
# - size in MB of the image
# - format for the image
# - 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)
SIZE=$1
FSTYPE=$2
DST=$3
+VMID=$4
+DSID=$5
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/common/mkswap b/src/tm_mad/common/mkswap
index ba875e9b03..531b01bea3 100755
--- a/src/tm_mad/common/mkswap
+++ b/src/tm_mad/common/mkswap
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# mkswap size host:remote_system_ds/disk.i size
+# mkswap size host:remote_system_ds/disk.i size vmid dsid
# - size in MB of the image
# - 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)
SIZE=$1
DST=$2
-CMD="`dirname $0`/mkimage $SIZE swap $DST"
+VMID=$3
+DSID=$4
+
+CMD="`dirname $0`/mkimage $SIZE swap $DST $VMID $DSID"
`$CMD`
exit 0
diff --git a/src/tm_mad/iscsi/clone b/src/tm_mad/iscsi/clone
index cf3a72449a..5d51fdabd4 100755
--- a/src/tm_mad/iscsi/clone
+++ b/src/tm_mad/iscsi/clone
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# clone fe:SOURCE host:remote_system_ds/disk.i size
+# clone fe:SOURCE host:remote_system_ds/disk.i size vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/iscsi/delete b/src/tm_mad/iscsi/delete
index 229600c893..75ac636d80 100755
--- a/src/tm_mad/iscsi/delete
+++ b/src/tm_mad/iscsi/delete
@@ -16,12 +16,17 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# DELETE
+# 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
else
diff --git a/src/tm_mad/iscsi/ln b/src/tm_mad/iscsi/ln
index 5a9ea3dd92..79998118c5 100755
--- a/src/tm_mad/iscsi/ln
+++ b/src/tm_mad/iscsi/ln
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# clone fe:SOURCE host:remote_system_ds/disk.i size
+# clone fe:SOURCE host:remote_system_ds/disk.i size vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/iscsi/mv b/src/tm_mad/iscsi/mv
index 98298ab0e2..cd09ae79cc 100755
--- a/src/tm_mad/iscsi/mv
+++ b/src/tm_mad/iscsi/mv
@@ -16,14 +16,19 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# MV
+# MV vmid dsid
#
# - hostX is the target host to deploy the VM
# - system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/iscsi/mvds b/src/tm_mad/iscsi/mvds
index 5e42a50213..6a0cd96625 100755
--- a/src/tm_mad/iscsi/mvds
+++ b/src/tm_mad/iscsi/mvds
@@ -21,10 +21,15 @@
# - 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
diff --git a/src/tm_mad/qcow2/clone b/src/tm_mad/qcow2/clone
index 07f65954a7..d5271aaf8d 100755
--- a/src/tm_mad/qcow2/clone
+++ b/src/tm_mad/qcow2/clone
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# clone fe:SOURCE host:remote_system_ds/disk.i size
+# clone 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
diff --git a/src/tm_mad/qcow2/mvds b/src/tm_mad/qcow2/mvds
index dbd8a5f0b6..6b5bd356d8 100755
--- a/src/tm_mad/qcow2/mvds
+++ b/src/tm_mad/qcow2/mvds
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# mvds host:remote_system_ds/disk.i fe:SOURCE
+# mvds host:remote_system_ds/disk.i fe:SOURCE vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/shared/clone b/src/tm_mad/shared/clone
index c5126bbeeb..9888811512 100755
--- a/src/tm_mad/shared/clone
+++ b/src/tm_mad/shared/clone
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# clone fe:SOURCE host:remote_system_ds/disk.i size
+# clone 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
diff --git a/src/tm_mad/shared/ln b/src/tm_mad/shared/ln
index 2a9395d484..30ff0ec6c4 100755
--- a/src/tm_mad/shared/ln
+++ b/src/tm_mad/shared/ln
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# ln fe:SOURCE host:remote_system_ds/disk.i
+# 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
diff --git a/src/tm_mad/shared/mvds b/src/tm_mad/shared/mvds
index 94a8214662..291eb7cd87 100755
--- a/src/tm_mad/shared/mvds
+++ b/src/tm_mad/shared/mvds
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# mvds host:remote_system_ds/disk.i fe:SOURCE
+# mvds host:remote_system_ds/disk.i fe:SOURCE vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/ssh/clone b/src/tm_mad/ssh/clone
index 8a81d9b95d..d8554cbd70 100755
--- a/src/tm_mad/ssh/clone
+++ b/src/tm_mad/ssh/clone
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# clone fe:SOURCE host:remote_system_ds/disk.i size
+# clone 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
diff --git a/src/tm_mad/ssh/mv b/src/tm_mad/ssh/mv
index 90c4143dec..ffa13c08c9 100755
--- a/src/tm_mad/ssh/mv
+++ b/src/tm_mad/ssh/mv
@@ -16,14 +16,19 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# MV
+# MV vmid dsid
#
# - hostX is the target host to deploy the VM
# - system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/ssh/mvds b/src/tm_mad/ssh/mvds
index 47c66b6b41..6f546aa81e 100755
--- a/src/tm_mad/ssh/mvds
+++ b/src/tm_mad/ssh/mvds
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# mvds host:remote_system_ds/disk.i fe:SOURCE
+# mvds host:remote_system_ds/disk.i fe:SOURCE vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else
diff --git a/src/tm_mad/vmware/clone b/src/tm_mad/vmware/clone
index 7d809332cb..b23bd4746c 100755
--- a/src/tm_mad/vmware/clone
+++ b/src/tm_mad/vmware/clone
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# clone fe:SOURCE host:remote_system_ds/disk.i size
+# clone 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
diff --git a/src/tm_mad/vmware/mvds b/src/tm_mad/vmware/mvds
index 179c97200c..a70b50ea5d 100755
--- a/src/tm_mad/vmware/mvds
+++ b/src/tm_mad/vmware/mvds
@@ -16,15 +16,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
-# mvds host:remote_system_ds/disk.i fe:SOURCE
+# mvds host:remote_system_ds/disk.i fe:SOURCE vmid dsid
# - fe is the front-end hostname
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
# - host is the target host to deploy the VM
# - remote_system_ds is the path for the system datastore in the host
+# - vmid is the id of the VM
+# - dsid is the target datastore (0 is the system datastore)
SRC=$1
DST=$2
+VMID=$3
+DSID=$4
+
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else