Method: Jupiter::Host#clone_vm

Defined in:
lib/jupiter/host.rb

#clone_vm(vm, newvm) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/jupiter/host.rb', line 102

def clone_vm(vm, newvm)
  snapshot_create(vm)
  sleep 5
  ssh.exec!("mkdir #{vmpath}/#{newvm}")
  ssh.exec!("cp -Rfv #{vmpath}/#{vm}/* #{vmpath}/#{newvm}")
  rename_cp_files(vm, newvm)
  update_vmx(vm, newvm)
  update_vmxf(vm, newvm)
  update_vmdk(vm, newvm)
  register_vm(newvm)
  close_ssh
  snapshots_remove(vm)
  consolidate_snapshots(vm)
  sleep 5
  power_on_vm(newvm)
  sleep 5
  answer_vm_question(newvm) # Needed to answer the "Was the VM moved" question that pops up.
  sleep 5
  power_on_vm(newvm)
end