Class: Kitchen::Driver::Vz

Inherits:
SSHBase
  • Object
show all
Defined in:
lib/kitchen/driver/vz.rb

Overview

Virtuozzo driver for Kitchen.

Author:

Instance Method Summary collapse

Instance Method Details

#create(state) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/kitchen/driver/vz.rb', line 45

def create(state)
  return if state[:ct_id]
  state[:ct_id] = SecureRandom.uuid
  generate_keys
  state[:ssh_key] = config[:ssh_key] = config[:private_key]
  create_ct(state)
  set_ct_network(state)
  set_ct_cpu(state)
  set_ct_mem(state)
  set_ct_disk(state)
  set_additional_options(state)
  run_ct(state)
  create_user(state)
  state[:hostname] = ct_ip(state)
  wait_for_sshd(state[:hostname], nil, keys: [state[:ssh_key]])
end

#destroy(state) ⇒ Object



62
63
64
65
# File 'lib/kitchen/driver/vz.rb', line 62

def destroy(state)
  execute_command("#{prlctl} stop #{state[:ct_id]}") if state[:ct_id]
  execute_command("#{prlctl} destroy #{state[:ct_id]}") if state[:ct_id]
end