# File lib/fog/vsphere/models/compute/server.rb, line 106 def clone(options = {}) requires :name, :datacenter, :relative_path # Convert symbols to strings req_options = options.inject({}) { |hsh, (k,v)| hsh[k.to_s] = v; hsh } # Give our path to the request req_options['template_path'] ="#{relative_path}/#{name}" req_options['datacenter'] = "#{datacenter}" # Perform the actual clone clone_results = service.vm_clone(req_options) # Create the new VM model. TODO This only works when "wait=true" new_vm = self.class.new(clone_results['new_vm']) # We need to assign the collection and the connection otherwise we # cannot reload the model. new_vm.collection = self.collection new_vm.service = service # Return the new VM model. new_vm end