Module: FogExtensions::Proxmox::Server

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/fog_extensions/proxmox/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#image_idObject

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_fileObject

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_storageObject

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

#passwordObject

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_createObject

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

#templatedObject

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

Returns:

  • (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

#disksObject



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

#macObject



47
48
49
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 47

def mac
  config.mac_addresses.first
end

#memoryObject



51
52
53
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 51

def memory
  maxmem.to_i
end

#nicsObject



72
73
74
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 72

def nics
  config.interfaces.collect(&:to_s)
end

#rebootObject



38
39
40
41
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 38

def reboot
  stop
  start
end

#resetObject



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

#startObject



30
31
32
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 30

def start
  action('start')
end

#stateObject



55
56
57
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 55

def state
  status
end

#stopObject



34
35
36
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 34

def stop
  action('stop')
end

#templated?Boolean

Returns:

  • (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_descriptionObject



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

#volumesObject



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