Navigation


Changeset 252

Show
Ignore:
Timestamp:
11/19/08 16:02:41 (7 weeks ago)
Author:
jfontan
Message:

vmm_mad: now deployment file copy is logged to vm log file

Location:
one/trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • one/trunk/src/mad/ruby/one_mad.rb

    r247 r252  
    146146        exit(0) 
    147147    end 
     148 
     149    # Functions for VM deployment 
     150    # TODO: Move elsewhere 
     151    def get_local_deployment_file(remote_deployment_file) 
     152        local_deployment_file=nil 
     153 
     154        one_location=ENV["ONE_LOCATION"] 
     155        m=remote_deployment_file.match(/.*?\/(\d+)\/images\/(deployment.\d+)$/) 
     156        local_deployment_file="#{one_location}/var/#{m[1]}/#{m[2]}" if m 
     157 
     158        return local_deployment_file 
     159    end 
     160 
     161    def execute_local_command(cmd_string) 
     162        command=SSHCommand.new(cmd_string) 
     163        stdout, stderr=command.exec_local_command(cmd_string) 
     164        exit_code=command.get_exit_code(stderr) 
     165        if exit_code!=0 
     166            return stderr 
     167        else 
     168            nil 
     169        end 
     170    end 
     171  
    148172         
    149173end 
  • one/trunk/src/mad/ruby/one_ssh.rb

    r230 r252  
    3838    end 
    3939     
    40     private 
     40    #private 
    4141     
    4242    # Gets exit code from STDERR 
  • one/trunk/src/vmm_mad/xen/one_vmm_xen.rb

    r248 r252  
    3737        send_message("INIT", "SUCCESS") 
    3838    end 
    39          
     39 
    4040    def action_deploy(args) 
    4141        action_number=args[1] 
    4242        action_host=args[2] 
     43        remote_deployment_file=args[3] 
    4344         
    4445        # Get local deployment file 
    45         one_location=ENV["ONE_LOCATION"] 
    46         m=args[3].match(/.*?\/(\d+)\/images\/(deployment.\d+)$/) 
     46        local_deployment_file=get_local_deployment_file(remote_deployment_file) 
    4747         
    4848        # If matched the we can read the file and get more configuration values 
    49         if m 
    50             local_deployment_file="#{one_location}/var/#{m[1]}/#{m[2]}" 
    51  
     49        if local_deployment_file 
    5250            # TODO: review this way of copying files 
    5351            # This command copies deployment file to remote machine 
    5452            # when shared directories are not used 
    55             copy_deploy="scp #{local_deployment_file} #{args[2]}:#{args[3]}" 
    56             copy_deploy_exit=system(copy_deploy) 
     53            copy_deploy="scp #{local_deployment_file} "+ 
     54                "#{action_host}:#{remote_deployment_file}" 
    5755            mad_log("DEPLOY", action_number, "Command: #{copy_deploy}") 
    58             mad_log("DEPLOY", action_number, "Command finalized: "+copy_deploy_exit.to_s) 
     56            copy_deploy_exit=execute_local_command(copy_deploy) 
     57 
     58            if copy_deploy_exit 
     59                mad_log("DEPLOY", action_number,  
     60                    "Error: "+copy_deploy_exit.to_s) 
     61            else 
     62                mad_log("DEPLOY", action_number, 
     63                    "Copy success") 
     64            end 
    5965 
    6066