Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Report VM clone progress
  • Loading branch information
otwieracz committed Aug 22, 2017
commit da4d0843b1c448a15d184fc7083c707531d539f4
9 changes: 8 additions & 1 deletion lib/vSphere/action/clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ def call(env)
env[:ui].info " -- #{config.clone_from_vm ? 'Source' : 'Template'} VM: #{template.pretty_path}"
env[:ui].info " -- Target VM: #{vm_base_folder.pretty_path}/#{name}"

new_vm = template.CloneVM_Task(folder: vm_base_folder, name: name, spec: spec).wait_for_completion
last_progress = 0;
new_vm = template.CloneVM_Task(folder: vm_base_folder, name: name, spec: spec) .wait_for_progress do |progress|
if (progress.is_a? Numeric) && (progress/10).floor != (last_progress/10).floor
env[:ui].info "Progress: #{progress}%"
last_progress = progress
end
end
env[:ui].info "Done!"

config.custom_attributes.each do |k, v|
env[:ui].info "Setting custom attribute: #{k}=#{v}"
Expand Down