Class: Chef::Knife::KvmVmList

Inherits:
Chef::Knife show all
Includes:
KVMBase
Defined in:
lib/chef/knife/kvm_vm_list.rb

Instance Method Summary collapse

Methods included from KVMBase

#connection, included, #locate_config_value, #upload_file

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/chef/knife/kvm_vm_list.rb', line 29

def run
  $stdout.sync = true
  vm_table = table do |t|
    t.headings = %w{NAME STATE MAX_MEM CPUS OS_TYPE ARCH}
    connection.servers.each do |vm|
      t << [vm.name, vm.state, "#{vm.memory_size.to_i.kilobytes.to.megabytes.round} MB", vm.cpus, vm.os_type, vm.arch]
    end
  end
  puts vm_table
end