Class: OvirtSDK4::HostNumaNodesService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (Array<NumaNode>) list(opts = {})

Returns the representation of the object managed by this service.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :max (Integer)

    Sets the maximum number of nodes to return. If not specified all the nodes are returned.

Returns:



9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
# File 'lib/ovirtsdk4/services.rb', line 9894

def list(opts = {})
  query = {}
  value = opts[:max]
  unless value.nil?
    value = Writer.render_integer(value)
    query['max'] = value
  end
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return NumaNodeReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (HostNumaNodeService) node_service(id)

Locates the node service.

Parameters:

  • id (String)

    The identifier of the node.

Returns:



9923
9924
9925
# File 'lib/ovirtsdk4/services.rb', line 9923

def node_service(id)
  return HostNumaNodeService.new(@connection, "#{@path}/#{id}")
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
# File 'lib/ovirtsdk4/services.rb', line 9934

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return node_service(path)
  end
  return node_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


9950
9951
9952
# File 'lib/ovirtsdk4/services.rb', line 9950

def to_s
  return "#<#{HostNumaNodesService}:#{@path}>"
end