Sha256: 53ff83b7fa3f172eb9a85dde2bb718b2865d72941b8ab96d1062b9960ff0d30d

Contents?: true

Size: 1.01 KB

Versions: 30

Compression:

Stored size: 1.01 KB

Contents

module Fog
  module Compute
    class Libvirt
      class Real
        def get_node_info
          node_hash = Hash.new
          node_info = client.node_get_info
          [:model, :memory, :cpus, :mhz, :nodes, :sockets, :cores, :threads].each do |param|
            node_hash[param] = node_info.send(param) rescue nil
          end
          [:type, :version, :node_free_memory, :max_vcpus].each do |param|
            node_hash[param] = client.send(param) rescue nil
          end
          node_hash[:uri] = client.uri
          xml = client.sys_info rescue nil
          [:uuid, :manufacturer, :product, :serial].each do |attr|
            node_hash[attr] = node_attr(attr, xml) rescue nil
          end if xml

          node_hash[:hostname] = client.hostname
          [node_hash]
        end

        private

        def node_attr attr, xml
          xml_element(xml, "sysinfo/system/entry[@name='#{attr}']").strip
        end
      end

      class Mock
        def get_node_info
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 5 rubygems

Version Path
fog-libvirt-0.5.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.4.2 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.4.1 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.4.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.3.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.2.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.1.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.0.4 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.0.3 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.0.2 lib/fog/libvirt/requests/compute/get_node_info.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/libvirt/requests/compute/get_node_info.rb
fog-libvirt-0.0.1 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-1.29.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-1.28.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-1.27.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-1.26.0 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-1.25.0 lib/fog/libvirt/requests/compute/get_node_info.rb
nsidc-fog-1.24.1 lib/fog/libvirt/requests/compute/get_node_info.rb
fog-1.24.0 lib/fog/libvirt/requests/compute/get_node_info.rb
ns-fog-1.22.11 lib/fog/libvirt/requests/compute/get_node_info.rb