mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
Merge branch 'feature-1112' of git.opennebula.org:one into feature-1112
This commit is contained in:
commit
5f8e1178ab
@ -232,6 +232,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/tm/shared \
|
||||
$VAR_LOCATION/remotes/tm/ssh \
|
||||
$VAR_LOCATION/remotes/tm/vmware \
|
||||
$VAR_LOCATION/remotes/tm/iscsi \
|
||||
$VAR_LOCATION/remotes/hooks \
|
||||
$VAR_LOCATION/remotes/hooks/ft \
|
||||
$VAR_LOCATION/remotes/datastore \
|
||||
@ -386,6 +387,7 @@ INSTALL_FILES=(
|
||||
TM_SHARED_FILES:$VAR_LOCATION/remotes/tm/shared
|
||||
TM_SSH_FILES:$VAR_LOCATION/remotes/tm/ssh
|
||||
TM_VMWARE_FILES:$VAR_LOCATION/remotes/tm/vmware
|
||||
TM_ISCSI_FILES:$VAR_LOCATION/remotes/tm/iscsi
|
||||
TM_DUMMY_FILES:$VAR_LOCATION/remotes/tm/dummy
|
||||
TM_LVM_FILES:$VAR_LOCATION/remotes/tm/lvm
|
||||
DATASTORE_DRIVER_COMMON_SCRIPTS:$VAR_LOCATION/remotes/datastore/
|
||||
@ -805,6 +807,11 @@ TM_VMWARE_FILES="src/tm_mad/vmware/clone \
|
||||
src/tm_mad/vmware/functions.sh \
|
||||
src/tm_mad/vmware/context"
|
||||
|
||||
TM_ISCSI_FILES="src/tm_mad/iscsi/clone \
|
||||
src/tm_mad/iscsi/ln \
|
||||
src/tm_mad/iscsi/mv \
|
||||
src/tm_mad/iscsi/mvds \
|
||||
src/tm_mad/iscsi/delete"
|
||||
#-------------------------------------------------------------------------------
|
||||
# Datastore drivers, to be installed under $REMOTES_LOCATION/datastore
|
||||
# - FS based Image Repository, $REMOTES_LOCATION/datastore/fs
|
||||
|
@ -311,7 +311,7 @@ EOT
|
||||
|
||||
opts.on(*args) do |o|
|
||||
if e[:proc]
|
||||
@options[e[:name].to_sym]=e[:proc].call(o, @options)
|
||||
e[:proc].call(o, @options)
|
||||
elsif e[:name]=="help"
|
||||
help
|
||||
exit
|
||||
|
@ -202,7 +202,7 @@ EOT
|
||||
|
||||
result = names.split(',').collect { |name|
|
||||
if name.match(/^[0123456789]+$/)
|
||||
name
|
||||
name.to_i
|
||||
else
|
||||
rc = OneHelper.name_to_id(name, pool, poolname)
|
||||
|
||||
|
@ -27,7 +27,13 @@ class OneClusterHelper < OpenNebulaHelper::OneHelper
|
||||
:proc => lambda { |o, options|
|
||||
ch = OneClusterHelper.new
|
||||
rc, cid = ch.to_id(o)
|
||||
cid
|
||||
if rc == 0
|
||||
options[:cluster] = cid
|
||||
else
|
||||
puts cid
|
||||
puts "option cluster: Parsing error"
|
||||
exit -1
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,13 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
||||
:proc => lambda { |o, options|
|
||||
ch = OneDatastoreHelper.new
|
||||
rc, dsid = ch.to_id(o)
|
||||
dsid
|
||||
if rc == 0
|
||||
options[:datastore] = dsid
|
||||
else
|
||||
puts dsid
|
||||
puts "option datastore: Parsing error"
|
||||
exit -1
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,52 +16,6 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# clone fe:SOURCE host:remote_system_ds/disk.i size
|
||||
# - fe is the front-end hostname
|
||||
# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk
|
||||
# - host is the target host to deploy the VM
|
||||
# - remote_system_ds is the path for the system datastore in the host
|
||||
log_error "CLONE not supported for TM_ISCSI. Use persistent images"
|
||||
|
||||
SRC=$1
|
||||
DST=$2
|
||||
|
||||
if [ -z "${ONE_LOCATION}" ]; then
|
||||
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
|
||||
else
|
||||
TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh
|
||||
fi
|
||||
|
||||
. $TMCOMMON
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Set dst path and dir
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
TARGET=`arg_path $SRC`
|
||||
DST_PATH=`arg_path $DST`
|
||||
DST_HOST=`arg_host $DST`
|
||||
DST_DIR=`dirname $DST_PATH`
|
||||
|
||||
IQN="$SRC"
|
||||
|
||||
LV_NAME=`iqn_get_lv_name "$IQN"`
|
||||
VG_NAME=`iqn_get_vg_name "$IQN"`
|
||||
DEV="/dev/$VG_NAME/$LV_NAME"
|
||||
|
||||
ssh_make_path "$DST_HOST" "$DST_DIR"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copy files to the remote host
|
||||
#-------------------------------------------------------------------------------
|
||||
case $SRC in
|
||||
http://*)
|
||||
log "Downloading $SRC"
|
||||
RMT_CMD="$WGET -O $DST_PATH $SRC"
|
||||
ssh_exec_and_log "$DST_HOST" "$RMT_CMD" "Error downloading $SRC"
|
||||
;;
|
||||
|
||||
*)
|
||||
log "Cloning $SRC in $DST_PATH"
|
||||
exec_and_log "$SCP $SRC $DST" "Error copying $SRC to $DST"
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
|
@ -33,9 +33,9 @@ require 'OpenNebulaDriver'
|
||||
require 'CommandManager'
|
||||
require 'getoptlong'
|
||||
|
||||
# This class provides basic messaging and logging functionality to implement
|
||||
# TransferManager Drivers. A TransferManager driver is a program (or a set of)
|
||||
# that specialize the OpenNebula behavior to distribute disk images in a
|
||||
# This class provides basic messaging and logging functionality to implement
|
||||
# TransferManager Drivers. A TransferManager driver is a program (or a set of)
|
||||
# that specialize the OpenNebula behavior to distribute disk images in a
|
||||
# specific datastore to the hosts
|
||||
class TransferManagerDriver < OpenNebulaDriver
|
||||
|
||||
@ -72,9 +72,9 @@ class TransferManagerDriver < OpenNebulaDriver
|
||||
script = parse_script(script_file)
|
||||
|
||||
if script.nil?
|
||||
send_message("TRANSFER",
|
||||
send_message("TRANSFER",
|
||||
RESULT[:failure],
|
||||
id,
|
||||
id,
|
||||
"Transfer file '#{script_file}' does not exist")
|
||||
return
|
||||
end
|
||||
@ -84,7 +84,7 @@ class TransferManagerDriver < OpenNebulaDriver
|
||||
|
||||
if result == RESULT[:failure]
|
||||
send_message("TRANSFER", result, id, info)
|
||||
return
|
||||
return
|
||||
end
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class TransferManagerDriver < OpenNebulaDriver
|
||||
stext.each_line {|line|
|
||||
next if line.match(/^\s*#/) # skip if the line is commented
|
||||
next if line.match(/^\s*$/) # skip if the line is empty
|
||||
|
||||
|
||||
command = line.split(" ")
|
||||
|
||||
lines << command
|
||||
@ -115,7 +115,7 @@ class TransferManagerDriver < OpenNebulaDriver
|
||||
return lines
|
||||
end
|
||||
|
||||
# Executes a single transfer action (command), as returned by the parse
|
||||
# Executes a single transfer action (command), as returned by the parse
|
||||
# method
|
||||
# @param id [String] with the OpenNebula ID for the TRANSFER action
|
||||
# @param command [Array]
|
||||
@ -131,10 +131,13 @@ class TransferManagerDriver < OpenNebulaDriver
|
||||
path = File.join(@local_scripts_path, tm, cmd)
|
||||
path << " " << args
|
||||
|
||||
|
||||
rc = LocalCommand.run(path, log_method(id))
|
||||
|
||||
result, info = get_info_from_execution(rc)
|
||||
|
||||
PP.pp([path,result,info],STDERR)
|
||||
|
||||
return result, info
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user