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.
8 9 10 |
# File 'app/models/concerns/fog_extensions/ovirt/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/ovirt/server.rb', line 18 def interfaces_attributes=(attrs) end |
#poweroff ⇒ Object
24 25 26 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 24 def poweroff service.vm_action(:id => id, :action => :shutdown) end |
#reset ⇒ Object
28 29 30 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 28 def reset reboot end |
#select_nic(fog_nics, nic) ⇒ Object
36 37 38 39 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 36 def select_nic(fog_nics, nic) nic_network = @service.list_networks(@attributes[:cluster]).detect { |n| n.name == nic.compute_attributes['network'] }.try(:id) || nic.compute_attributes['network'] fog_nics.detect { |fn| fn.network == nic_network } # grab any nic on the same network end |
#state ⇒ Object
14 15 16 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 14 def state status end |
#to_s ⇒ Object
10 11 12 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 10 def to_s name end |
#vm_description ⇒ Object
32 33 34 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 32 def vm_description _("%{cores} Cores and %{memory} memory") % {:cores => cores, :memory => number_to_human_size(memory.to_i)} end |
#volumes_attributes=(attrs) ⇒ Object
21 22 |
# File 'app/models/concerns/fog_extensions/ovirt/server.rb', line 21 def volumes_attributes=(attrs) end |