server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
# Images are virtual machines with 'template' flag set to be true.
# Thus we're getting them using find_vm and list_virtual_machines
Images are virtual machines with 'template' flag set to be true.
Thus we're getting them using find_vm and list_virtual_machines
Images are virtual machines with ' template ' flag set to be true . Thus we ' re getting them using find_vm and list_virtual_machines
def images(credentials, opts={})
      img_arr = []
      profiles = hardware_profiles(credentials)
      safely do
        if opts[:id]
          template_vms = [ find_vm(credentials, opts[:id]) ].select { |vm| vm[:instance] }.compact
        else
          template_vms = list_virtual_machines(credentials).select { |vm| vm[:instance] && vm[:instance].summary.config[:template] }
        end
        img_arr = template_vms.collect do |image_hash|
          image = image_hash[:instance]
          config = image.summary.config
          properties = {
            :name => config[:name],
            :full_name => config[:guestFullName]
          }
          image_state = convert_state(:image, image.summary.runtime[:powerState])
          image_architecture = extract_architecture(properties[:full_name]) || 'x86_64'
          Image.new(
            :id => properties[:name],
            :name => properties[:name],
            :architecture => image_architecture,
            :owner_id => credentials.user,
            :description => properties[:full_name],
            :state => image_state,
            :creation_time => image.storage[:timestamp],
            :hardware_profiles => profiles
          )
        end
      end
      img_arr = filter_on( img_arr, :architecture, opts )
      img_arr.sort_by{|e| [e.owner_id, e.name]}
    end
def images ( credentials , opts = { } ) img_arr = [ ] profiles = hardware_profiles ( credentials ) safely do if opts [ :id ] template_vms = [ find_vm ( credentials , opts [ :id ] ) ] . select { | vm | vm [ :instance ] } . compact else template_vms = list_virtual_machines ( credentials ) . select { | vm | vm [ :instance ] && vm [ :instance ] . summary . config [ :template ] } end img_arr = template_vms . collect do | image_hash | image = image_hash [ :instance ] config = image . summary . config properties = { :name => config [ :name ] , :full_name => config [ :guestFullName ] } image_state = convert_state ( :image , image . summary . runtime [ :powerState ] ) image_architecture = extract_architecture ( properties [ :full_name ] ) || 'x86_64' Image . new ( :id => properties [ :name ] , :name => properties [ :name ] , :architecture => image_architecture , :owner_id => credentials . user , :description => properties [ :full_name ] , :state => image_state , :creation_time => image . storage [ :timestamp ] , :hardware_profiles => profiles ) end end img_arr = filter_on ( img_arr , :architecture , opts ) img_arr . sort_by { | e | [ e . owner_id , e . name ] } end
Images are virtual machines with 'template' flag set to be true.
Images are virtual machines with ' template ' flag set to be true .
# Skip traversing through all instances in all datacenters when ID # attribute is set # Preload all properties to save multiple SOAP calls to vSphere # This will determine image architecture using image description. # Ussualy description include '64-bit' or '32-bit'. In case you used # some weird template/OS it will fallback to 64 bit
credentials
<not_specific>
opts
<not_specific>