Changeset 252
- Timestamp:
- 11/19/08 16:02:41 (7 weeks ago)
- Location:
- one/trunk/src
- Files:
-
- 3 modified
-
mad/ruby/one_mad.rb (modified) (1 diff)
-
mad/ruby/one_ssh.rb (modified) (1 diff)
-
vmm_mad/xen/one_vmm_xen.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
one/trunk/src/mad/ruby/one_mad.rb
r247 r252 146 146 exit(0) 147 147 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 148 172 149 173 end -
one/trunk/src/mad/ruby/one_ssh.rb
r230 r252 38 38 end 39 39 40 private40 #private 41 41 42 42 # Gets exit code from STDERR -
one/trunk/src/vmm_mad/xen/one_vmm_xen.rb
r248 r252 37 37 send_message("INIT", "SUCCESS") 38 38 end 39 39 40 40 def action_deploy(args) 41 41 action_number=args[1] 42 42 action_host=args[2] 43 remote_deployment_file=args[3] 43 44 44 45 # 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) 47 47 48 48 # 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 52 50 # TODO: review this way of copying files 53 51 # This command copies deployment file to remote machine 54 52 # 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}" 57 55 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 59 65 60 66
