Module: FogExtensions::Proxmox::Server
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/fog_extensions/proxmox/server.rb
Instance Attribute Summary collapse
-
#image_id ⇒ Object
Returns the value of attribute image_id.
-
#ostemplate_file ⇒ Object
Returns the value of attribute ostemplate_file.
-
#ostemplate_storage ⇒ Object
Returns the value of attribute ostemplate_storage.
-
#password ⇒ Object
Returns the value of attribute password.
-
#start_after_create ⇒ Object
Returns the value of attribute start_after_create.
-
#templated ⇒ Object
Returns the value of attribute templated.
Instance Method Summary collapse
- #cdrom? ⇒ Boolean
- #config_attributes=(attrs) ⇒ Object
- #disks ⇒ Object
- #interfaces_attributes=(attrs) ⇒ Object
- #mac ⇒ Object
- #memory ⇒ Object
- #nics ⇒ Object
- #reboot ⇒ Object
- #reset ⇒ Object
- #select_nic(fog_nics, nic) ⇒ Object
- #start ⇒ Object
- #state ⇒ Object
- #stop ⇒ Object
- #templated? ⇒ Boolean
- #unique_cluster_identity(compute_resource) ⇒ Object
- #vm_description ⇒ Object
- #volumes ⇒ Object
- #volumes_attributes=(attrs) ⇒ Object
Instance Attribute Details
#image_id ⇒ Object
Returns the value of attribute image_id.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def image_id @image_id end |
#ostemplate_file ⇒ Object
Returns the value of attribute ostemplate_file.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def ostemplate_file @ostemplate_file end |
#ostemplate_storage ⇒ Object
Returns the value of attribute ostemplate_storage.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def ostemplate_storage @ostemplate_storage end |
#password ⇒ Object
Returns the value of attribute password.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def password @password end |
#start_after_create ⇒ Object
Returns the value of attribute start_after_create.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def start_after_create @start_after_create end |
#templated ⇒ Object
Returns the value of attribute templated.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def templated @templated end |
Instance Method Details
#cdrom? ⇒ Boolean
101 102 103 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 101 def cdrom? volumes.any?(&:cdrom?) end |
#config_attributes=(attrs) ⇒ Object
94 95 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 94 def config_attributes=(attrs) end |
#disks ⇒ Object
80 81 82 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 80 def disks config.disks.collect(&:to_s) end |
#interfaces_attributes=(attrs) ⇒ Object
88 89 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 88 def interfaces_attributes=(attrs) end |
#mac ⇒ Object
47 48 49 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 47 def mac config.mac_addresses.first end |
#memory ⇒ Object
51 52 53 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 51 def memory maxmem.to_i end |
#nics ⇒ Object
72 73 74 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 72 def nics config.interfaces.collect(&:to_s) end |
#reboot ⇒ Object
38 39 40 41 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 38 def reboot stop start end |
#reset ⇒ Object
43 44 45 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 43 def reset reboot end |
#select_nic(fog_nics, nic) ⇒ Object
66 67 68 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 66 def select_nic(fog_nics, nic) fog_nics.find { |fog_nic| fog_nic.identity.to_s == nic.compute_attributes[:id] } end |
#start ⇒ Object
30 31 32 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 30 def start action('start') end |
#state ⇒ Object
55 56 57 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 55 def state status end |
#stop ⇒ Object
34 35 36 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 34 def stop action('stop') end |
#templated? ⇒ Boolean
97 98 99 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 97 def templated? volumes.any?(&:template?) end |
#unique_cluster_identity(compute_resource) ⇒ Object
26 27 28 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 26 def unique_cluster_identity(compute_resource) compute_resource.id.to_s + '_' + identity.to_s end |
#vm_description ⇒ Object
61 62 63 64 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 61 def vm_description format(_('Type %<type>s, node %<node>s, %<cpus>s CPUs and %<memory>s MB memory'), type: type, node: node_id, cpus: config.cores || '0', memory: config.memory) end |
#volumes ⇒ Object
76 77 78 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 76 def volumes config.disks end |
#volumes_attributes=(attrs) ⇒ Object
91 92 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 91 def volumes_attributes=(attrs) end |