Class: Chef::Knife::Cloud::OvirtServerCreate

Inherits:
ServerCreateCommand
  • Object
show all
Includes:
OvirtHelpers, OvirtServerCreateOptions, OvirtServiceOptions
Defined in:
lib/chef/knife/ovirt_server_create.rb

Instance Method Summary collapse

Methods included from OvirtServiceOptions

included

Methods included from OvirtServerCreateOptions

included

Methods included from OvirtHelpers

#create_service_instance, #humanize, #validate!, #volume_ready

Instance Method Details

#before_exec_commandObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chef/knife/ovirt_server_create.rb', line 24

def before_exec_command
  super
  # setup the create options
  @create_options = {
    server_def: {
      name: config[:chef_node_name],
      os: { boot: ['hd'] },
    },
    cloud_init: config[:ovirt_cloud_init],
    server_create_timeout: locate_config_value(:server_create_timeout),
  }
  @create_options[:server_def][:template] = config[:ovirt_template] if config[:ovirt_template]
  @create_options[:server_def][:template_name] = config[:ovirt_template_name] if config[:ovirt_template_name]
  @create_options[:server_def][:memory] = config[:ovirt_memory] if config[:ovirt_memory]
  @create_options[:server_def][:cores] = config[:ovirt_cores] if config[:ovirt_cores]

  @create_options[:server_volumes] = config[:ovirt_volumes] if config[:ovirt_volumes]

  @columns_with_info = [
    { label: 'VM ID', key: 'id' },
    { label: 'Name', key: 'name' },
    { label: 'Cores', key: 'cores' },
    { label: 'Memory', key: 'memory', value_callback: method(:humanize) },
    { label: 'Storage', key: 'storage', value_callback: method(:humanize) },
    { label: 'Status', key: 'status' },
  ]
end