Revision 28917152

View differences:

src/im_mad/im_ssh/one_im_ssh.rb
38 38
class InformationManagerDriverSSH < OpenNebulaDriver
39 39

  
40 40
    # Init the driver
41
    def initialize(hypervisor, threads, retries, local_actions)
42
        super(threads, true, retries, 'im', local_actions)
41
    def initialize(hypervisor, options)
42
        @options={
43
            :threaded => true
44
        }.merge!(options)
45
        
46
        super('im', @options)
43 47

  
44 48
        @hypervisor = hypervisor
45 49

  
src/mad/ruby/OpenNebulaDriver.rb
67 67
        :failure => "FAILURE"
68 68
    }
69 69

  
70
    def initialize(concurrency=10, threaded=true, retries=0,
71
                directory='subsystem', local_actions={})
72
        super(concurrency, threaded)
70
    # Initialize OpenNebulaDriver object
71
    #
72
    # @param [String] directory path inside the remotes directory where the
73
    #   scripts are located
74
    # @param [Hash] options named options to change the object's behaviour
75
    # @option options [Number] :concurrency (10) max number of threads
76
    # @option options [Boolean] :threaded (true) enables or disables threads
77
    # @option options [Number] :retries (0) number of retries to copy scripts
78
    #   to the remote host
79
    # @option options [Hash] :local_actions ({}) hash with the actions
80
    #   executed locally and the name of the script if it differs from the
81
    #   default one. This hash can be constructed using {parse_actions_list}
82
    def initialize(directory, options={})
83
        @options={
84
            :concurrency => 10,
85
            :threaded => true,
86
            :retries => 0,
87
            :local_actions => {}
88
        }.merge!(options)
89
        
90
        super(@options[:concurrency], @options[:threaded])
73 91

  
74
        @retries = retries
92
        @retries = @options[:retries]
75 93
        @send_mutex=Mutex.new
76
        @local_actions=local_actions
94
        @local_actions=@options[:local_actions]
77 95

  
78 96
        # set default values
79 97
        @config = read_configuration
80 98
        @remote_scripts_base_path=@config['SCRIPTS_REMOTE_DIR']
81
        if ONE_LOCATION == nil
99
        if ENV['ONE_LOCATION'] == nil
82 100
            @local_scripts_base_path = "/var/lib/one/remotes"
83 101
        else
84 102
            @local_scripts_base_path = "#{ENV['ONE_LOCATION']}/var/remotes"
src/mad/ruby/VirtualMachineDriver.rb
61 61

  
62 62
    HOST_ARG = 1
63 63

  
64
    # Register default actions for the protocol
65
    def initialize(concurrency=10, threaded=true, retries=0,
66
                directory='vmm', local_actions={})
67
        super(concurrency, threaded, retries, directory, local_actions)
64
    # Register default actions for the protocol.
65
    #
66
    # @param [String] directory path inside remotes path where the scripts
67
    #   reside
68
    # @param [Hash] options options for OpenNebula driver (check the available
69
    #   options in {OpenNebulaDriver#initialize})
70
    # @option options [Boolean] :threaded (true) enables or disables threads
71
    def initialize(directory, options={})
72
        @options={
73
            :threaded => true
74
        }.merge!(options)
75
        
76
        super(directory, @options)
68 77

  
69 78
        @hosts   = Array.new
70 79

  
......
201 210

  
202 211
    class TemplateDriver < VirtualMachineDriver
203 212
        def initialize
204
            super(15,true)
213
            super('vmm/dummy',
214
                :concurrency => 15,
215
                :threaded => true)
205 216
        end
206 217

  
207 218
        def deploy(id, host, remote_dfile, not_used)
src/vmm_mad/ssh/one_vmm_ssh.rb
38 38
class SshDriver < VirtualMachineDriver
39 39

  
40 40
    # SshDriver constructor
41
    def initialize(hypervisor, threads, retries, local_actions)
42
        super(threads, true, retries, "vmm/#{hypervisor}", local_actions)
41
    def initialize(hypervisor, options={})
42
        @options={
43
            :threaded => true
44
        }.merge!(options)
45
        
46
        super("vmm/#{hypervisor}", @options)
43 47

  
44 48
        @hypervisor  = hypervisor
45 49
    end
......
128 132
    exit(-1)
129 133
end
130 134

  
131
ssh_driver = SshDriver.new(hypervisor, threads, retries, local_actions)
135
ssh_driver = SshDriver.new(hypervisor,
136
                :concurrency => threads,
137
                :retries => retries,
138
                :local_actions => local_actions)
139

  
132 140
ssh_driver.start_driver

Also available in: Unified diff