Sha256: b0429af2bb0b1d8007b0b39d4320acd547e091f195421b36b1e5f59089685cfe

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

module Fog
  module Ovirt
    class Compute
      class V4
        class Real
          def list_vm_volumes(vm_id)
            vm = client.system_service.vms_service.vm_service(vm_id).get
            attachments = client.follow_link(vm.disk_attachments)
            attachments.map do |attachment|
              attachment_disk = client.follow_link(attachment.disk)
              attachment = client.follow_link(attachment)
              bootable = attachment.bootable
              interface = attachment.interface
              attachment_disk.bootable = bootable if attachment_disk.bootable.nil?
              attachment_disk.interface = interface if attachment_disk.interface.nil?
              attachment_disk.storage_domain = attachment_disk.storage_domains[0].id
              ovirt_attrs attachment_disk
            end
          end
        end
        class Mock
          def list_vm_volumes(_vm_id)
            xml = read_xml "volumes.xml"
            Nokogiri::XML(xml).xpath("/disks/disk").map do |vol|
              ovirt_attrs OvirtSDK4::Reader.read(vol.to_s)
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-ovirt-2.0.2 lib/fog/ovirt/requests/compute/v4/list_vm_volumes.rb
fog-ovirt-2.0.1 lib/fog/ovirt/requests/compute/v4/list_vm_volumes.rb
fog-ovirt-2.0.0 lib/fog/ovirt/requests/compute/v4/list_vm_volumes.rb
fog-ovirt-1.2.5 lib/fog/ovirt/requests/compute/v4/list_vm_volumes.rb