Module: FogExtensions::Ovirt::Server
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActionView::Helpers::NumberHelper
- Defined in:
- app/models/concerns/fog_extensions/ovirt/server.rb
Instance Attribute Summary collapse
-
#image_id ⇒ Object
Returns the value of attribute image_id.
Instance Method Summary collapse
- #interfaces_attributes=(attrs) ⇒ Object
- #poweroff ⇒ Object
- #reset ⇒ Object
- #select_nic(fog_nics, nic) ⇒ Object
- #state ⇒ Object
- #to_s ⇒ Object
- #vm_description ⇒ Object
- #volumes_attributes=(attrs) ⇒ Object
Instance Attribute Details
#image_id ⇒ Object
Returns the value of attribute image_id.
10 11 12 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 10 def image_id @image_id end |
Instance Method Details
#interfaces_attributes=(attrs) ⇒ Object
20 21 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 20 def interfaces_attributes=(attrs) end |
#poweroff ⇒ Object
26 27 28 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 26 def poweroff service.vm_action(id: id, action: :shutdown) end |
#reset ⇒ Object
30 31 32 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 30 def reset reboot end |
#select_nic(fog_nics, nic) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 40 def select_nic(fog_nics, nic) nic_network = @service.list_networks(@attributes[:cluster]).detect do |n| n.name == nic.compute_attributes['network'] end.try(:id) || nic.compute_attributes['network'] # grab any nic on the same network fog_nics.detect do |fn| fn.network == nic_network end end |
#state ⇒ Object
16 17 18 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 16 def state status end |
#to_s ⇒ Object
12 13 14 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 12 def to_s name end |
#vm_description ⇒ Object
34 35 36 37 38 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 34 def vm_description format( _('%<cores>s Cores and %<memory>s memory'), cores: cores, memory: number_to_human_size(memory.to_i) ) end |
#volumes_attributes=(attrs) ⇒ Object
23 24 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 23 def volumes_attributes=(attrs) end |