Class: Kitchen::Driver::Hyperv

Inherits:
Base
  • Object
show all
Includes:
PowerShellScripts
Defined in:
lib/kitchen/driver/hyperv.rb

Overview

Driver for Hyper-V

Instance Method Summary collapse

Methods included from PowerShellScripts

#copy_vm_file_ps, #delete_vm_ps, #encode_command, #ensure_vm_running_ps, #execute_command, #is_64bit?, #mount_vm_iso, #new_differencing_disk_ps, #new_vm_ps, #powershell_64_bit, #run_ps, #set_vm_ipaddress_ps, #vm_default_switch_ps, #vm_details_ps, #wrap_command

Instance Method Details

#create(state) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/kitchen/driver/hyperv.rb', line 54

def create(state)
  @state = state
  validate_vm_settings
  create_new_differencing_disk
  create_virtual_machine
  update_state
  mount_virtual_machine_iso
  instance.transport.connection(@state).wait_until_ready
  copy_vm_files
  info("Hyper-V instance #{instance.to_str} created.")
end

#destroy(state) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/kitchen/driver/hyperv.rb', line 66

def destroy(state)
  @state = state
  return unless vm_exists
  instance.transport.connection(state).close
  remove_virtual_machine
  remove_differencing_disk
  info("The Hyper-V instance #{instance.to_str} has been removed.")
  state.delete(:id)
end