Module: FogExtensions::Kubevirt::Server

Extended by:
ActiveSupport::Concern
Includes:
ActionView::Helpers::NumberHelper
Defined in:
app/models/concerns/fog_extensions/kubevirt/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#image_idObject

Returns the value of attribute image_id.



8
9
10
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 8

def image_id
  @image_id
end

Instance Method Details

#interfaces_attributes=(attrs) ⇒ Object



18
19
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 18

def interfaces_attributes=(attrs)
end

#ip_addressesObject

TODO: Update once new API for reporting IP_ADRESSSES is set



33
34
35
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 33

def ip_addresses
  [interfaces&.first&.ip_address]
end

#macObject



28
29
30
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 28

def mac
  interfaces.map(&:mac_address).compact.min
end

#poweroffObject



37
38
39
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 37

def poweroff
  stop
end

#resetObject



41
42
43
44
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 41

def reset
  stop
  start
end

#select_nic(fog_nics, _nic) ⇒ Object



50
51
52
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 50

def select_nic(fog_nics, _nic)
  fog_nics.find { |iface| !iface.mac.nil? }
end

#stateObject



14
15
16
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 14

def state
  status
end

#to_sObject



10
11
12
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 10

def to_s
  name
end

#uuidObject



24
25
26
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 24

def uuid
  name
end

#vm_descriptionObject



46
47
48
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 46

def vm_description
  _("%{cpu_cores} Cores and %{memory} memory") % { :cpu_cores => cpu_cores, :memory => number_to_human_size(memory.to_i) }
end

#volumes_attributes=(attrs) ⇒ Object



21
22
# File 'app/models/concerns/fog_extensions/kubevirt/server.rb', line 21

def volumes_attributes=(attrs)
end