Module: ForemanProxmox::HostExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/foreman_proxmox/host_extensions.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #create ⇒ Object
-
#destroy ⇒ Object
create or overwrite instance methods…
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/concerns/foreman_proxmox/host_extensions.rb', line 16 def create super new_vm = Virtualmachine.new if self.params['vmid'] == nil then new_vm.get_free_vmid else new_vm.vmid = self.params['vmid'] end new_vm.sockets = self.params['sockets'] new_vm.cores = self.params['cores'] new_vm.memory = self.params['memory'] new_vm.size = self.params['size'] new_vm.mac = self.mac new_vm.host_id = self.id new_vm.save new_vm.create_harddisk new_vm.create_virtualmachine new_vm.start end |
#destroy ⇒ Object
create or overwrite instance methods…
10 11 12 13 14 |
# File 'app/models/concerns/foreman_proxmox/host_extensions.rb', line 10 def destroy vm = Virtualmachine.where("host_id = #{self.id}").first vm.delete_virtualmachine super end |