Class: Chef::Knife::XapiVdiList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::XapiVdiList
- Includes:
- XapiBase
- Defined in:
- lib/chef/knife/xapi_vdi_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_vdi_info, set_defaults, #start, #stop, #user_select, #wait_on_task, #xapi, #yes_no?
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/chef/knife/xapi_vdi_list.rb', line 38 def run # Get all VDIs known to the system name = @name_args[0] # if we were passed a guest name find its vdi's # otherwise do it for everything vdis = Array.new if name.nil? or name.empty? vdis = xapi.VDI.get_all elsif config[:vdi_name] vdis = xapi.VDI.get_by_name_label( name ) else ref = xapi.VM.get_by_name_label( name ) vm = xapi.VM.get_record( ref.first ) vm["VBDs"].each do |vbd| vdis << xapi.VBD.get_record( vbd )["VDI"] end end vdis.each do |vdi| print_vdi_info vdi end end |