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

#additional_disks, #copy_vm_file_ps, #delete_vm_ps, #encode_command, #ensure_vm_running_ps, #execute_command, #is_32bit?, #is_64bit?, #mount_vm_iso, #new_additional_disk_ps, #new_differencing_disk_ps, #new_vm_ps, #powershell_64_bit, #resize_vhd, #run_ps, #sanitize_stdout, #set_vm_ipaddress_ps, #set_vm_note, #vm_default_switch_ps, #vm_details_ps, #wrap_command

Instance Method Details

#create(state) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/kitchen/driver/hyperv.rb', line 75

def create(state)
  @state = state
  validate_vm_settings
  create_new_differencing_disk
  create_additional_disks
  create_virtual_machine
  set_virtual_machine_note
  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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/kitchen/driver/hyperv.rb', line 89

def destroy(state)
  @state = state
  if differencing_disk_exists && !vm_exists_silent
    remove_differencing_disk
  end
  return unless vm_exists

  instance.transport.connection(state).close
  remove_virtual_machine
  remove_differencing_disk
  remove_additional_disks
  info("The Hyper-V instance #{instance.to_str} has been removed.")
  state.delete(:id)
end