Class: Kitchen::Driver::Proxmox

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/driver/proxmox.rb,
lib/kitchen/driver/proxmox/api_client.rb

Overview

Proxmox VE driver for Test Kitchen.

Manages VM lifecycle via the Proxmox REST API:

  • create: clone a template, configure hardware, start, wait for IP

  • destroy: stop and delete the VM

Defined Under Namespace

Classes: ApiClient

Instance Method Summary collapse

Instance Method Details

#create(state) ⇒ Object



36
37
38
39
40
41
# File 'lib/kitchen/driver/proxmox.rb', line 36

def create(state)
  return if state[:vm_id]

  validate_config!
  clone_and_start(state)
end

#destroy(state) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/kitchen/driver/proxmox.rb', line 43

def destroy(state)
  return unless state[:vm_id]

  vm_id = state[:vm_id]
  info("Destroying Proxmox VM #{state[:vm_name]} (#{vm_id})...")
  safe_stop_vm(vm_id)
  api_client.destroy_vm(node: config[:node], vm_id:)
  clear_state(state)
  info("Proxmox VM #{vm_id} destroyed.")
end