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

#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

#config_attributes=(attrs) ⇒ Object



76
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 76

def config_attributes=(attrs); end

#descriptionObject



53
54
55
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 53

def description
    config.description
end

#disksObject



68
69
70
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 68

def disks
    config.disks.collect { |disk| disk.id+': '+disk.volid }
end

#interfacesObject



62
63
64
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 62

def interfaces
    config.interfaces
end

#interfaces_attributes=(attrs) ⇒ Object



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

def interfaces_attributes=(attrs); end

#macObject



44
45
46
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 44

def mac
    config.mac_addresses.first
end

#memoryObject



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

def memory
    config.memory * 1024 * 1024
end

#persisted?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 28

def persisted?
    !!identity && !!uptime
end

#rebootObject



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

def reboot
    stop
    start
end

#resetObject



41
42
43
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 41

def reset
    reboot
end

#select_nic(fog_nics, nic) ⇒ Object



59
60
61
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 59

def select_nic(fog_nics, nic)
    fog_nics.find {|fog_nic| fog_nic.identity.to_s == nic.identifier}
end

#startObject



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

def start
    action('start')
end

#stateObject



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

def state
    qmpstatus
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)


77
78
79
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 77

def templated?
    volumes.any? { |volume| volume.templated? }
end

#to_sObject



25
26
27
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 25

def to_s
    name
end

#vgaObject



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

def vga
    config.vga
end

#vm_descriptionObject



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

def vm_description
    "Name=#{name}, vmid=#{vmid}"
end

#volumesObject



65
66
67
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 65

def volumes
    config.disks.reject { |disk| disk.cdrom? }
end

#volumes_attributes=(attrs) ⇒ Object



75
# File 'app/models/concerns/fog_extensions/proxmox/server.rb', line 75

def volumes_attributes=(attrs); end