Class: ForemanProxmox::Virtualmachine
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ForemanProxmox::Virtualmachine
- Defined in:
- app/models/foreman_proxmox/virtualmachine.rb
Instance Method Summary collapse
- #create_harddisk ⇒ Object
- #create_virtualmachine ⇒ Object
- #delete_virtualmachine ⇒ Object
- #get_free_vmid ⇒ Object
- #reboot ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Instance Method Details
#create_harddisk ⇒ Object
5 6 7 8 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 5 def create_harddisk proxmoxserver = Proxmoxserver.where("current = 'true'").first proxmoxserver.create_ide(self.vmid,self.size) end |
#create_virtualmachine ⇒ Object
10 11 12 13 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 10 def create_virtualmachine proxmoxserver = Proxmoxserver.where("current = 'true'").first proxmoxserver.create_kvm(self.vmid,self.sockets,self.cores,self.memory,self.mac) end |
#delete_virtualmachine ⇒ Object
30 31 32 33 34 35 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 30 def delete_virtualmachine proxmoxserver = Proxmoxserver.where("current = 'true'").first self.stop proxmoxserver.delete_kvm(self.vmid) self.destroy end |
#get_free_vmid ⇒ Object
37 38 39 40 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 37 def get_free_vmid proxmoxserver = Proxmoxserver.where("current = 'true'").first self.vmid = proxmoxserver.get_next_free_vmid end |
#reboot ⇒ Object
25 26 27 28 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 25 def reboot proxmoxserver = Proxmoxserver.where("current = 'true'").first proxmoxserver.reboot_kvm(self.vmid) end |
#start ⇒ Object
15 16 17 18 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 15 def start proxmoxserver = Proxmoxserver.where("current = 'true'").first proxmoxserver.start_kvm(self.vmid) end |
#stop ⇒ Object
20 21 22 23 |
# File 'app/models/foreman_proxmox/virtualmachine.rb', line 20 def stop proxmoxserver = Proxmoxserver.where("current = 'true'").first proxmoxserver.stop_kvm(self.vmid) end |