1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-08 05:57:23 +03:00

Added a test mad for the new libraries

git-svn-id: http://svn.opennebula.org/one/trunk@346 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Javier Fontán Muiños 2009-02-09 22:52:20 +00:00
parent 62e25f09de
commit c8a83f5638

39
src/mad/ruby/test_mad.rb Normal file
View File

@ -0,0 +1,39 @@
require 'OpenNebulaDriver'
require 'CommandManager'
class TestDriver < OpenNebulaDriver
def initialize(num)
super(num, true)
register_action(:SLEEP_LOCAL,method("my_sleep_ssh"))
register_action(:SLEEP_SSH,method("my_sleep_ssh"))
end
def my_sleep_local(timeout, num)
log(num,"Sleeping #{timeout} seconds")
command=LocalCommand.new("sleep #{timeout}", log_method(num))
command.run
log(num,"Done with #{num}")
send_message("SLEEP",RESULT[:success],num.to_s)
end
def my_sleep_ssh(host, timeout, num)
log(num,"Sleeping #{timeout} seconds (remote)")
command=SSHCommand.new("sleep #{timeout}", host, log_method(num))
command.run
log(num,"Done with #{num}")
send_message("SLEEP",RESULT[:success],num.to_s)
end
end
sd = TestDriver.new(15)
sd.start_driver