1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-08 21:17:43 +03:00

B #6162: Use stdin for datastore drivers

New option for datastore driver (--stdin) that sends driver information
    through stdin. Driver actions will read stdin if the first argument is
    '-'. This change is compatible with drivers that read input from argument command
    line. By default the driver will work using the command line arguments.

    Monitor scripts part of the transfer manager are also updated

    File oned.conf is changed to use stdin by default

(cherry picked from commit 8c12a8dbcd)
(cherry picked from commit aa1e6b4196)
This commit is contained in:
Ruben S. Montero 2023-03-27 19:00:48 +02:00
parent e3ceecc132
commit 52156312fc
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
53 changed files with 171 additions and 27 deletions

View File

@ -662,7 +662,7 @@ TM_MAD = [
DATASTORE_MAD = [ DATASTORE_MAD = [
EXECUTABLE = "one_datastore", EXECUTABLE = "one_datastore",
ARGUMENTS = "-t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,vcenter,restic,rsync -s shared,ssh,ceph,fs_lvm,fs_lvm_ssh,qcow2,vcenter" ARGUMENTS = "-i -t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,vcenter,restic,rsync -s shared,ssh,ceph,fs_lvm,fs_lvm_ssh,qcow2,vcenter"
] ]
#******************************************************************************* #*******************************************************************************

View File

@ -93,6 +93,7 @@ class DatastoreDriver < OpenNebulaDriver
:concurrency => 10, :concurrency => 10,
:threaded => true, :threaded => true,
:retries => 0, :retries => 0,
:stdin => false,
:local_actions => { :local_actions => {
ACTION[:stat] => nil, ACTION[:stat] => nil,
ACTION[:cp] => nil, ACTION[:cp] => nil,
@ -148,62 +149,62 @@ class DatastoreDriver < OpenNebulaDriver
def cp(id, drv_message) def cp(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :cp, "#{drv_message} #{id}") do_image_action(id, ds, :cp, drv_message)
end end
def rm(id, drv_message) def rm(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :rm, "#{drv_message} #{id}") do_image_action(id, ds, :rm, drv_message)
end end
def mkfs(id, drv_message) def mkfs(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :mkfs, "#{drv_message} #{id}") do_image_action(id, ds, :mkfs, drv_message)
end end
def stat(id, drv_message) def stat(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :stat, "#{drv_message} #{id}") do_image_action(id, ds, :stat, drv_message)
end end
def clone(id, drv_message) def clone(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :clone, "#{drv_message} #{id}") do_image_action(id, ds, :clone, drv_message)
end end
def monitor(id, drv_message) def monitor(id, drv_message)
ds, sys = get_ds_type(drv_message) ds, sys = get_ds_type(drv_message)
do_image_action(id, ds, :monitor, "#{drv_message} #{id}", sys, true) do_image_action(id, ds, :monitor, drv_message, sys, true)
end end
def snap_delete(id, drv_message) def snap_delete(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :snap_delete, "#{drv_message} #{id}") do_image_action(id, ds, :snap_delete, drv_message)
end end
def snap_revert(id, drv_message) def snap_revert(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :snap_revert, "#{drv_message} #{id}") do_image_action(id, ds, :snap_revert, drv_message)
end end
def snap_flatten(id, drv_message) def snap_flatten(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :snap_flatten, "#{drv_message} #{id}") do_image_action(id, ds, :snap_flatten, drv_message)
end end
def restore(id, drv_message) def restore(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :restore, "#{drv_message} #{id}") do_image_action(id, ds, :restore, drv_message)
end end
def increment_flatten(id, drv_message) def increment_flatten(id, drv_message)
ds, _sys = get_ds_type(drv_message) ds, _sys = get_ds_type(drv_message)
do_image_action(id, ds, :increment_flatten, "#{drv_message} #{id}") do_image_action(id, ds, :increment_flatten, drv_message)
end end
private private
def is_available?(ds, id, action) def available?(ds, id, action)
if @types.include?(ds) if @types.include?(ds)
true true
else else
@ -213,7 +214,7 @@ class DatastoreDriver < OpenNebulaDriver
end end
end end
def is_sys_available?(sys, id, action) def sys_available?(sys, id, action)
if @sys_types.include?(sys) if @sys_types.include?(sys)
true true
else else
@ -223,21 +224,29 @@ class DatastoreDriver < OpenNebulaDriver
end end
end end
def do_image_action(id, ds, action, arguments, sys = '', encode64 = false) # rubocop:disable Metrics/ParameterLists
def do_image_action(id, ds, action, stdin, sys = '', encode64 = false)
if !sys.empty? if !sys.empty?
return unless is_sys_available?(sys, id, action) return unless sys_available?(sys, id, action)
path = File.join(@local_tm_scripts_path, sys) path = File.join(@local_tm_scripts_path, sys)
else else
return unless is_available?(ds, id, action) return unless available?(ds, id, action)
path = File.join(@local_scripts_path, ds) path = File.join(@local_scripts_path, ds)
end end
cmd = File.join(path, ACTION[action].downcase) if @options[:stdin]
cmd << ' ' << arguments arguments = " - #{id}"
else
arguments = " #{stdin} #{id}"
stdin = nil
end
rc = LocalCommand.run(cmd, log_method(id)) cmd = File.join(path, ACTION[action].downcase)
cmd << arguments
rc = LocalCommand.run(cmd, log_method(id), stdin)
result, info = get_info_from_execution(rc) result, info = get_info_from_execution(rc)
@ -245,6 +254,7 @@ class DatastoreDriver < OpenNebulaDriver
send_message(ACTION[action], result, id, info) send_message(ACTION[action], result, id, info)
end end
# rubocop:enable Metrics/ParameterLists
def get_ds_type(drv_message) def get_ds_type(drv_message)
message = Base64.decode64(drv_message) message = Base64.decode64(drv_message)
@ -274,16 +284,18 @@ end
################################################################################ ################################################################################
opts = GetoptLong.new( opts = GetoptLong.new(
['--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT], ['--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT],
['--ds-types', '-d', GetoptLong::OPTIONAL_ARGUMENT], ['--ds-types', '-d', GetoptLong::OPTIONAL_ARGUMENT],
['--system-ds-types', '-s', GetoptLong::OPTIONAL_ARGUMENT], ['--system-ds-types', '-s', GetoptLong::OPTIONAL_ARGUMENT],
['--timeout', '-w', GetoptLong::OPTIONAL_ARGUMENT] ['--timeout', '-w', GetoptLong::OPTIONAL_ARGUMENT],
['--stdin', '-i', GetoptLong::NO_ARGUMENT]
) )
ds_type = nil ds_type = nil
sys_ds_type = nil sys_ds_type = nil
threads = 15 threads = 15
timeout = nil timeout = nil
stdin = false
begin begin
opts.each do |opt, arg| opts.each do |opt, arg|
@ -296,13 +308,16 @@ begin
sys_ds_type = arg.split(',').map {|a| a.strip } sys_ds_type = arg.split(',').map {|a| a.strip }
when '--timeout' when '--timeout'
timeout = arg.to_i timeout = arg.to_i
when '--stdin'
stdin = true
end end
end end
rescue StandardError rescue StandardError => _e
exit(-1) exit(-1)
end end
ds_driver = DatastoreDriver.new(ds_type, sys_ds_type, ds_driver = DatastoreDriver.new(ds_type, sys_ds_type,
:concurrency => threads, :concurrency => threads,
:timeout => timeout) :timeout => timeout,
:stdin => stdin)
ds_driver.start_driver ds_driver.start_driver

View File

@ -38,6 +38,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -40,6 +40,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
export DRV_ACTION export DRV_ACTION
UTILS_PATH="${DRIVER_PATH}/.." UTILS_PATH="${DRIVER_PATH}/.."

View File

@ -39,6 +39,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -41,6 +41,10 @@ source ${DRIVER_PATH}/../../etc/datastore/datastore.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -40,6 +40,10 @@ source ${DRIVER_PATH}/ceph_utils.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i j XPATH_ELEMENTS unset i j XPATH_ELEMENTS

View File

@ -40,6 +40,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i j XPATH_ELEMENTS unset i j XPATH_ELEMENTS

View File

@ -41,6 +41,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -41,6 +41,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -41,6 +41,10 @@ source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -20,6 +20,8 @@ script_name=$(basename $0)
source $(dirname $0)/../../scripts_common.sh source $(dirname $0)/../../scripts_common.sh
STDIN=`cat -`
error_message "$script_name: Operation not supported" error_message "$script_name: Operation not supported"
exit 1 exit 1

View File

@ -39,6 +39,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -39,6 +39,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
export DRV_ACTION export DRV_ACTION
UTILS_PATH="${DRIVER_PATH}/.." UTILS_PATH="${DRIVER_PATH}/.."

View File

@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "USED_MB=0" echo "USED_MB=0"
echo "TOTAL_MB=1" echo "TOTAL_MB=1"

View File

@ -16,5 +16,7 @@
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
exit 0 exit 0

View File

@ -16,5 +16,7 @@
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "0" echo "0"

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "dummy_path" echo "dummy_path"

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "dummy_path dummy_format" echo "dummy_path dummy_format"

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "dummy_path" echo "dummy_path"

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "dummy_path" echo "dummy_path"

View File

@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "USED_MB=9720" echo "USED_MB=9720"
echo "TOTAL_MB=20480" echo "TOTAL_MB=20480"

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
exit 0 exit 0

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
exit 0 exit 0

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
exit 0 exit 0

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
exit 0 exit 0

View File

@ -15,5 +15,6 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "1024" echo "1024"

View File

@ -39,6 +39,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -40,6 +40,10 @@ source ${DRIVER_PATH}/../../etc/datastore/fs/fs.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
export DRV_ACTION export DRV_ACTION
UTILS_PATH="${DRIVER_PATH}/.." UTILS_PATH="${DRIVER_PATH}/.."

View File

@ -38,6 +38,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -40,6 +40,10 @@ source ${DRIVER_PATH}/../../etc/datastore/datastore.conf
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -38,6 +38,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -38,6 +38,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -39,6 +39,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i j XPATH_ELEMENTS unset i j XPATH_ELEMENTS

View File

@ -19,6 +19,10 @@
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
if [ -z "${ONE_LOCATION}" ]; then if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
else else

View File

@ -19,6 +19,10 @@
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
if [ -z "${ONE_LOCATION}" ]; then if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh
DATASTORES=/var/lib/one/datastores DATASTORES=/var/lib/one/datastores

View File

@ -59,6 +59,7 @@ require_relative '../../tm/lib/backup'
require_relative '../../tm/lib/tm_action' require_relative '../../tm/lib/tm_action'
daction64 = ARGV[0] daction64 = ARGV[0]
daction64 = STDIN.read if daction64 == '-'
# Parse input data. # Parse input data.

View File

@ -34,6 +34,10 @@ source ${DRIVER_PATH}/../libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -69,7 +69,9 @@ require_relative '../../tm/lib/tm_action'
# - vm.xml description # - vm.xml description
# - list of disks in the backup # - list of disks in the backup
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
daction64 = ARGV[0] daction64 = ARGV[0]
daction64 = STDIN.read if daction64 == '-'
_request_id = ARGV[1] _request_id = ARGV[1]
begin begin

View File

@ -59,6 +59,7 @@ require_relative '../../tm/lib/backup'
require_relative '../../tm/lib/tm_action' require_relative '../../tm/lib/tm_action'
daction64 = ARGV[0] daction64 = ARGV[0]
daction64 = STDIN.read if daction64 == '-'
# Parse input data. # Parse input data.

View File

@ -58,6 +58,8 @@ require 'base64'
require_relative '../../tm/lib/tm_action' require_relative '../../tm/lib/tm_action'
daction64 = ARGV[0] daction64 = ARGV[0]
daction64 = STDIN.read if daction64 == '-'
_ds_id = ARGV[1] _ds_id = ARGV[1]
# Image path in the form: # Image path in the form:

View File

@ -53,6 +53,7 @@ require 'vcenter_driver'
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
id = ARGV[1] id = ARGV[1]
drv_action_enc = STDIN.read if drv_action_enc == '-'
DRV_ACTION_DS = '/DS_DRIVER_ACTION_DATA/DATASTORE/' DRV_ACTION_DS = '/DS_DRIVER_ACTION_DATA/DATASTORE/'

View File

@ -127,6 +127,7 @@ end
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
id = ARGV[1] id = ARGV[1]
drv_action_enc = STDIN.read if drv_action_enc == '-'
drv_action = OpenNebula::XMLElement.new drv_action = OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), drv_action.initialize_xml(Base64.decode64(drv_action_enc),

View File

@ -56,6 +56,7 @@ $LOAD_PATH << File.dirname(__FILE__)
require 'opennebula' require 'opennebula'
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
drv_action_enc = STDIN.read if drv_action_enc == '-'
drv_action = OpenNebula::XMLElement.new drv_action = OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), drv_action.initialize_xml(Base64.decode64(drv_action_enc),

View File

@ -56,6 +56,7 @@ $LOAD_PATH << File.dirname(__FILE__)
require 'vcenter_driver' require 'vcenter_driver'
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
drv_action_enc = STDIN.read if drv_action_enc == '-'
drv_action = OpenNebula::XMLElement.new drv_action = OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), drv_action.initialize_xml(Base64.decode64(drv_action_enc),

View File

@ -61,6 +61,7 @@ end
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
id = ARGV[1] id = ARGV[1]
drv_action_enc = STDIN.read if drv_action_enc == '-'
drv_action = OpenNebula::XMLElement.new drv_action = OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), drv_action.initialize_xml(Base64.decode64(drv_action_enc),

View File

@ -60,6 +60,7 @@ def img_not_imported?(imported)
end end
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
drv_action_enc = STDIN.read if drv_action_enc == '-'
drv_action =OpenNebula::XMLElement.new drv_action =OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), drv_action.initialize_xml(Base64.decode64(drv_action_enc),

View File

@ -56,6 +56,7 @@ $LOAD_PATH << File.dirname(__FILE__)
require 'vcenter_driver' require 'vcenter_driver'
drv_action_enc = ARGV[0] drv_action_enc = ARGV[0]
drv_action_enc = STDIN.read if drv_action_enc == '-'
drv_action =OpenNebula::XMLElement.new drv_action =OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), drv_action.initialize_xml(Base64.decode64(drv_action_enc),

View File

@ -40,6 +40,10 @@ source ${DRIVER_PATH}/../../datastore/ceph/ceph_utils.sh
DRV_ACTION=$1 DRV_ACTION=$1
ID=$2 ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION"
unset i j XPATH_ELEMENTS unset i j XPATH_ELEMENTS

View File

@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and # # See the License for the specific language governing permissions and #
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
echo "USED_MB=1429920" echo "USED_MB=1429920"
echo "FREE_MB=3333260" echo "FREE_MB=3333260"

View File

@ -38,6 +38,10 @@ source ${DRIVER_PATH}/../../datastore/libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
DS_ID=$2 DS_ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -38,6 +38,10 @@ source ${DRIVER_PATH}/../../datastore/libfs.sh
DRV_ACTION=$1 DRV_ACTION=$1
DS_ID=$2 DS_ID=$2
if [ "${DRV_ACTION}" = "-" ]; then
DRV_ACTION=`cat -`
fi
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION" XPATH="${DRIVER_PATH}/../../datastore/xpath.rb -b $DRV_ACTION"
unset i XPATH_ELEMENTS unset i XPATH_ELEMENTS

View File

@ -16,5 +16,7 @@
# limitations under the License. # # limitations under the License. #
#--------------------------------------------------------------------------- # #--------------------------------------------------------------------------- #
STDIN=`cat -`
#The ssh system ds is monitored in each host using the monitor_ds.sh probe #The ssh system ds is monitored in each host using the monitor_ds.sh probe
exit 0 exit 0