Module: FogExtensions::Proxmox::Server
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/fog_extensions/proxmox/server.rb
Instance Attribute Summary collapse
-
#compute_resource_id ⇒ Object
Returns the value of attribute compute_resource_id.
-
#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
- #foreman_uuid ⇒ Object
- #interfaces_attributes=(attrs) ⇒ Object
- #mac ⇒ Object
- #memory ⇒ Object
- #nics ⇒ Object
- #poweroff ⇒ 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
#compute_resource_id ⇒ Object
Returns the value of attribute compute_resource_id.
24 25 26 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 24 def compute_resource_id @compute_resource_id end |
#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
112 113 114 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 112 def cdrom? volumes.any?(&:cdrom?) end |
#config_attributes=(attrs) ⇒ Object
105 106 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 105 def config_attributes=(attrs) end |
#disks ⇒ Object
90 91 92 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 90 def disks config.disks.collect(&:to_s) end |
#foreman_uuid ⇒ Object
30 31 32 33 34 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 30 def foreman_uuid return identity.to_s if compute_resource_id.nil? compute_resource_id.to_s + '_' + identity.to_s end |
#interfaces_attributes=(attrs) ⇒ Object
99 100 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 99 def interfaces_attributes=(attrs) end |
#mac ⇒ Object
57 58 59 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 57 def mac config.mac_addresses.first end |
#memory ⇒ Object
61 62 63 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 61 def memory maxmem.to_i end |
#nics ⇒ Object
82 83 84 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 82 def nics config.interfaces.collect(&:to_s) end |
#poweroff ⇒ Object
53 54 55 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 53 def poweroff stop end |
#reboot ⇒ Object
44 45 46 47 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 44 def reboot stop start end |
#reset ⇒ Object
49 50 51 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 49 def reset reboot end |
#select_nic(fog_nics, nic) ⇒ Object
76 77 78 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 76 def select_nic(fog_nics, nic) fog_nics.find { |fog_nic| fog_nic.identity.to_s == nic.compute_attributes[:id] } end |
#start ⇒ Object
36 37 38 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 36 def start action('start') end |
#state ⇒ Object
65 66 67 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 65 def state status end |
#stop ⇒ Object
40 41 42 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 40 def stop action('stop') end |
#templated? ⇒ Boolean
108 109 110 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 108 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
71 72 73 74 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 71 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
86 87 88 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 86 def volumes config.disks end |
#volumes_attributes=(attrs) ⇒ Object
102 103 |
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 102 def volumes_attributes=(attrs) end |