Class: Chef::Knife::XapiGuestList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::XapiGuestList
- Includes:
- XapiBase
- Defined in:
- lib/chef/knife/xapi_guest_list.rb
Instance Attribute Summary
Attributes included from XapiBase
Instance Method Summary collapse
Methods included from XapiBase
#add_vif_by_name, #cleanup, #clear_vm_vifs, #color_kv, #create_vbd, #create_vdi, defaults, #destroy_vdi, #detach_vdi, #fail, #find_default_sr, #find_template, #generate_mac, #get_all_vdis, get_default, #get_guest_ip, #get_host_ref, #get_sr_by_name, #get_task_ref, #get_template, #get_vbd_by_uuid, #get_vbds_from_vdi, #get_vdi_by_name_label, #get_vdi_by_uuid, #h, included, #input_to_bytes, #locate_config_value, #print_record, #print_vdi_info, set_defaults, #start, #stop, #user_select, #wait_on_task, #xapi, #yes_no?
Instance Method Details
#run ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/chef/knife/xapi_guest_list.rb', line 36 def run vms = xapi.VM.get_all if locate_config_value(:id) printf "%-25s %-12s %-16s %-46s %-36s \n", "Name Label", "State", "IP Address", "Ref", "UUID" else printf "%-25s %-12s %-16s\n", "Name Label", "State", "IP Address" end vms.each do |vm| record = xapi.VM.get_record(vm) ip_address = get_guest_ip(vm) # make sure you can't do bad things to these VM's next if record['is_a_template'] next if record['name_label'] =~ /control domain/i if locate_config_value(:id) printf "%-25s %-12s %-16s %46s %36s \n", record['name_label'], record['power_state'], ip_address, vm, record['uuid'] else printf "%-25s %-12s %-16s\n", record['name_label'], record['power_state'], ip_address end end end |