Class: OvirtSDK4::VmPlacementPolicy

Inherits:
Struct
  • Object
show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ VmPlacementPolicy

Creates a new instance of the OvirtSDK4::VmPlacementPolicy class.

Parameters:

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

    A hash containing the attributes of the object. The keys of the hash should be symbols corresponding to the names of the attributes. The values of the hash should be the values of the attributes.

Options Hash (opts):

  • :affinity (VmAffinity)

    The value of attribute affinity.

  • :hosts (Array<Host>, Array<Hash>)

    The values of attribute hosts.


26040
26041
26042
26043
26044
# File 'lib/ovirtsdk4/types.rb', line 26040

def initialize(opts = {})
  super(opts)
  self.affinity = opts[:affinity]
  self.hosts = opts[:hosts]
end

Instance Method Details

#==(other) ⇒ Object

Returns true if self and other have the same attributes and values.


26049
26050
26051
26052
26053
# File 'lib/ovirtsdk4/types.rb', line 26049

def ==(other)
  super &&
  @affinity == other.affinity &&
  @hosts == other.hosts
end

#affinityVmAffinity

Returns the value of the affinity attribute.

Returns:


25989
25990
25991
# File 'lib/ovirtsdk4/types.rb', line 25989

def affinity
  @affinity
end

#affinity=(value) ⇒ Object

Sets the value of the affinity attribute.

Parameters:


25998
25999
26000
# File 'lib/ovirtsdk4/types.rb', line 25998

def affinity=(value)
  @affinity = value
end

#hashObject

Generates a hash value for this object.


26058
26059
26060
26061
26062
# File 'lib/ovirtsdk4/types.rb', line 26058

def hash
  super +
  @affinity.hash +
  @hosts.hash
end

#hostsArray<Host>

Returns the value of the hosts attribute.

Returns:


26007
26008
26009
# File 'lib/ovirtsdk4/types.rb', line 26007

def hosts
  @hosts
end

#hosts=(list) ⇒ Object

Sets the value of the hosts attribute.

Parameters:

  • list (Array<Host>)

26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
# File 'lib/ovirtsdk4/types.rb', line 26016

def hosts=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = Host.new(value)
      end
    end
  end
  @hosts = list
end