foreman_fog_proxmox 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of foreman_fog_proxmox might be problematic. Click here for more details.

Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -12
  3. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js +26 -0
  4. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +92 -0
  5. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_container.js +60 -0
  6. data/app/assets/javascripts/foreman_fog_proxmox/{proxmox.js → proxmox_vm_server.js} +10 -10
  7. data/app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb +1 -1
  8. data/app/controllers/foreman_fog_proxmox/compute_resources_controller.rb +9 -1
  9. data/app/helpers/node_dashboard_helper.rb +36 -0
  10. data/app/helpers/proxmox_compute_selectors_helper.rb +23 -0
  11. data/app/helpers/proxmox_container_helper.rb +157 -0
  12. data/app/helpers/proxmox_form_helper.rb +67 -0
  13. data/app/helpers/{proxmox_compute_helper.rb → proxmox_server_helper.rb} +49 -38
  14. data/app/helpers/proxmox_vm_helper.rb +86 -0
  15. data/app/models/concerns/fog_extensions/proxmox/container.rb +57 -0
  16. data/{test/factories/foreman_fog_proxmox_factories.rb → app/models/concerns/fog_extensions/proxmox/container_config.rb} +16 -13
  17. data/app/models/concerns/fog_extensions/proxmox/server.rb +8 -2
  18. data/app/models/foreman_fog_proxmox/proxmox.rb +160 -67
  19. data/app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb +24 -0
  20. data/app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb +32 -0
  21. data/app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb +25 -0
  22. data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb +24 -0
  23. data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb +24 -0
  24. data/app/services/foreman_fog_proxmox/node_dashboard/data.rb +37 -0
  25. data/app/views/compute_resources/form/_proxmox.html.erb +7 -4
  26. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb +23 -0
  27. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb +25 -0
  28. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +23 -0
  29. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb +73 -0
  30. data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +16 -23
  31. data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +37 -0
  32. data/app/views/compute_resources_vms/form/proxmox/_network.html.erb +2 -7
  33. data/app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb +31 -0
  34. data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +41 -0
  35. data/app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb +26 -0
  36. data/app/views/compute_resources_vms/form/proxmox/container/_network.html.erb +25 -0
  37. data/app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb +25 -0
  38. data/app/views/compute_resources_vms/form/proxmox/container/_volume_rootfs.html.erb +24 -0
  39. data/app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb +31 -0
  40. data/app/views/compute_resources_vms/form/proxmox/{_config.html.erb → server/_config.html.erb} +11 -8
  41. data/app/views/compute_resources_vms/form/proxmox/server/_network.html.erb +29 -0
  42. data/app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb +27 -0
  43. data/app/views/compute_resources_vms/index/_proxmox.html.erb +4 -2
  44. data/app/views/compute_resources_vms/show/_proxmox.html.erb +9 -2
  45. data/app/views/dashboard/_foreman_fog_proxmox_widget.erb +4 -2
  46. data/app/views/images/form/_proxmox.html.erb +17 -0
  47. data/config/routes.rb +1 -0
  48. data/lib/foreman_fog_proxmox/engine.rb +10 -3
  49. data/lib/foreman_fog_proxmox/value.rb +24 -0
  50. data/lib/foreman_fog_proxmox/version.rb +1 -1
  51. data/locale/en/foreman_fog_proxmox.edit.po +456 -0
  52. data/locale/en/foreman_fog_proxmox.po +327 -11
  53. data/locale/en/foreman_fog_proxmox.po.time_stamp +0 -0
  54. data/locale/foreman_fog_proxmox.pot +515 -8
  55. data/locale/fr/foreman_fog_proxmox.edit.po +456 -0
  56. data/locale/fr/foreman_fog_proxmox.po +327 -11
  57. data/locale/fr/foreman_fog_proxmox.po.time_stamp +0 -0
  58. data/test/factories/proxmox_factory.rb +72 -0
  59. data/test/functional/compute_resources_controller_test.rb +34 -0
  60. data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +205 -0
  61. data/test/{helpers/proxmox_compute_helper_test.rb → unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb} +36 -28
  62. data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +240 -0
  63. data/test/unit/foreman_fog_proxmox/proxmox_test.rb +327 -0
  64. data/test/unit/foreman_fog_proxmox/proxmox_test_helpers.rb +251 -0
  65. metadata +83 -14
  66. data/app/views/compute_resources_vms/form/proxmox/_volume.html.erb +0 -23
  67. data/test/unit/foreman_fog_proxmox_test.rb +0 -11
@@ -0,0 +1,24 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => "compute_resources_vms/form/_volumes",
20
+ :name => "add_vm_type_to_volumes_edit",
21
+ :replace_contents => "div.children_fields",
22
+ :partial => "compute_resources_vms/form/proxmox/add_vm_type_to_volumes_edit",
23
+ :original => '741194531465d567107d762aa11de9d00628c841'
24
+ )
@@ -0,0 +1,24 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => "compute_resources_vms/form/_volumes",
20
+ :name => "add_vm_type_to_volumes_new_volume",
21
+ :replace => "erb[silent]:contains('volume = compute_resource.new_volume')",
22
+ :text => "<% volume = compute_resource.new_volume(type: f.object.type) %>",
23
+ :original => "<% volume = compute_resource.new_volume %>"
24
+ )
@@ -0,0 +1,37 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright 2018 Tristan Robert
5
+
6
+ # This file is part of ForemanFogProxmox.
7
+
8
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+
13
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ module ForemanFogProxmox::NodeDashboard
22
+ class Data
23
+
24
+ def initialize(filter="")
25
+ @filter = filter
26
+ end
27
+
28
+ def node
29
+ @compute_resource = ComputeResource.find_by(type: 'ForemanFogProxmox::Proxmox')
30
+ @compute_resource.node if @compute_resource
31
+ end
32
+
33
+ def statistics
34
+ node.statistics('rrddata', { timeframe: 'hour', cf: 'AVERAGE' }) if node
35
+ end
36
+ end
37
+ end
@@ -15,10 +15,13 @@ GNU General Public License for more details.
15
15
  You should have received a copy of the GNU General Public License
16
16
  along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
17
 
18
- <% node = f.object.node rescue nil %>
19
- <%= text_f f, :url, :help_block => _("e.g. https://127.0.0.1:8006/api2/json"), :help_inline_permanent => load_button_f(f, !!node, _("Test failed")) %>
18
+ <%= javascript_include_tag 'foreman_fog_proxmox/proxmox_compute_resource', "data-turbolinks-track" => true %>
19
+
20
+ <% nodes = f.object.nodes rescue nil %>
21
+ <%= text_f f, :url, :help_block => _("e.g. https://127.0.0.1:8006/api2/json"), :help_inline_permanent => load_button_f(f, !!nodes, _("Test failed")) %>
20
22
  <%= text_f f, :user , :help_block => _("e.g. root@pam") %>
21
23
  <%= password_f f, :password, :keep_value => true, :unset => unset_password? %>
22
- <%= checkbox_f f, :ssl_verify_peer, :label => _("SSL verify peer") %>
23
- <%= textarea_f f, :ssl_certs, :label => _("X509 Certification Authorities"), :size => "col-md-8",
24
+ <%= checkbox_f f, :ssl_verify_peer, :label => _("SSL verify peer"), :checked => true, :onchange => "sslVerifyPeerSelected(this)" %>
25
+ <%= textarea_f f, :ssl_certs, :label => _("X509 Certification Authorities"), :size => "col-md-4",
24
26
  :placeholder => _("Optionally provide a CA, or a correctly ordered CA chain. If left blank, disable ssl_verify_peer.") %>
27
+ <%= select_f f, :node_name, nodes, :node, :node, { :include_blank => true }, :label => _('Node'), :label_size => "col-md-2", :required => true %>
@@ -0,0 +1,23 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% vm_type = f.object.type %>
19
+
20
+ <%= render :partial => provider_partial(compute_resource, 'network'),
21
+ :locals => { :f => i, :vm_type => vm_type, :compute_resource => compute_resource, :new_host => new_host, :new_vm => new_vm, :remove_title => _('remove network interface') },
22
+ :layout => 'compute_resources_vms/form/deletable_layout' %>
23
+
@@ -0,0 +1,25 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% vm_type = f.object.type %>
19
+
20
+ <%= new_child_fields_template(f, compute_resource.interfaces_attrs_name, {
21
+ :object => compute_resource.new_interface,
22
+ :partial => provider_partial(compute_resource, 'network'),
23
+ :form_builder_attrs => { :vm_type => vm_type, :compute_resource => compute_resource, :new_host => new_host, :new_vm => new_vm, :remove_title => _('remove network interface') },
24
+ :layout => 'compute_resources_vms/form/deletable_layout' }) %>
25
+
@@ -0,0 +1,23 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+ <% compute_attributes = f.options[:parent_builder].object.compute_attributes %>
18
+ <% vm_type = compute_attributes ? compute_attributes['type'] : f.object.type %>
19
+
20
+ <%= f.fields_for 'compute_attributes', OpenStruct.new(f.object.compute_attributes) do |f| %>
21
+ <%= render provider_partial(@host.compute_resource, 'network'), :f => f, :vm_type => vm_type, :disabled => f.object.persisted?, :compute_resource => @host.compute_resource, :new_host => new_vm?(@host), :new_vm => new_vm?(@host) %>
22
+ <% end %>
23
+
@@ -0,0 +1,73 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% type = f.object.type %>
19
+ <% logger.debug("type=#{type}") %>
20
+ <% server = type == 'qemu' %>
21
+ <% container = type == 'lxc' %>
22
+
23
+ <%= new_child_fields_template(f, :server_volumes, {
24
+ :object => compute_resource.new_volume_server,
25
+ :partial => provider_partial(compute_resource, 'server/volume'),
26
+ :form_builder_attrs => { :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
27
+ :layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
28
+ <%= new_child_fields_template(f, :container_volumes, {
29
+ :object => compute_resource.new_volume_container(id: 'mp0'),
30
+ :partial => provider_partial(compute_resource, 'container/volume_mp'),
31
+ :form_builder_attrs => { :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
32
+ :layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
33
+
34
+
35
+ <% if server %>
36
+ <div id="server_volumes">
37
+ <%= f.fields_for :volumes do |i| %>
38
+ <%= render :partial => provider_partial(compute_resource, 'server/volume'), :locals => { :f => i, :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
39
+ <% end %>
40
+ </div>
41
+ <%= second_child_fields_template(f, :volumes, {
42
+ :object => compute_resource.new_volume_container(id: 'rootfs'),
43
+ :partial => provider_partial(compute_resource, 'container/volume_rootfs'),
44
+ :type => 'container',
45
+ :form_builder_attrs => { :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
46
+ :layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
47
+ <% end %>
48
+ <% if container %>
49
+ <div id="container_volumes">
50
+ <%= f.fields_for :volumes do |i| %>
51
+ <% if i.object.id == 'rootfs' %>
52
+ <%= render :partial => provider_partial(compute_resource, 'container/volume_rootfs'), :locals => { :f => i, :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
53
+ <% else %>
54
+ <%= render :partial => provider_partial(compute_resource, 'container/volume_mp'), :locals => { :f => i, :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
55
+ <% end %>
56
+ <% end %>
57
+ </div>
58
+ <%= second_child_fields_template(f, :volumes, {
59
+ :object => compute_resource.new_volume_server,
60
+ :partial => provider_partial(compute_resource, 'server/volume'),
61
+ :type => 'server',
62
+ :form_builder_attrs => { :type => type, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
63
+ :layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
64
+ <% end %>
65
+ <% if new_vm %>
66
+ <%= add_child_link '+ ' + _("Add Volume"), :server_volumes, { :class => "info", :style => ("display: none;" unless server), :title => _('add new storage volume') } %>
67
+ <% end %>
68
+ <% if new_vm %>
69
+ <%= add_child_link '+ ' + _("Add Volume"), :container_volumes, { :class => "info", :style => ("display: none;" unless container), :title => _('add new storage volume') } %>
70
+ <% end %>
71
+
72
+
73
+
@@ -15,31 +15,24 @@ GNU General Public License for more details.
15
15
  You should have received a copy of the GNU General Public License
16
16
  along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
17
 
18
- <%= javascript_include_tag 'foreman_fog_proxmox/proxmox' %>
18
+ <%= javascript_include_tag 'foreman_fog_proxmox/proxmox_vm', "data-turbolinks-track" => true %>
19
19
 
20
- <%= javascript_tag("$(document).on('ContentLoad', tfm.numFields.initAll)"); %>
20
+ <%= select_f f, :type, proxmox_types_map, :id, :name, { }, :label => _('Type'), :label_size => "col-md-2", :onchange => "vmTypeSelected()", :disabled => !new_vm %>
21
21
 
22
22
  <!-- VM General Settings -->
23
- <%= field_set_tag _("General"), :id => "general" do %>
24
- <%= checkbox_f f, :templated, :label => _('Create image?'), :disabled => new_vm || f.object.templated? %>
25
- <%= counter_f f, :vmid, :label => _('VM ID'), :label_size => "col-md-2", :required => true, :disabled => !new_vm %>
26
- <%= select_f f, :node, compute_resource.nodes, :node, :node, { }, :label => _('Node'), :label_size => "col-md-2", :required => true, :disabled => !new_vm %>
27
- <% unless local_assigns[:hide_image] && !new_vm %>
28
- <%
29
- arch ||= nil ; os ||= nil
30
- images = possible_images(compute_resource, arch, os)
31
- -%>
32
- <div id='image_selection'>
33
- <%= select_f f, :image_id, images, :uuid, :name, { :include_blank => true },
34
- :disabled => true,
35
- :help_inline => :indicator,
36
- :label => _('Image'),
37
- :label_size => "col-md-2" %>
38
- </div>
39
- <% end %>
40
- <% end %>
23
+ <%= render :partial => "compute_resources_vms/form/proxmox/general", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
24
+
25
+ <!-- VM Extended Settings -->
26
+ <%= render :partial => "compute_resources_vms/form/proxmox/container/extended", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
41
27
 
42
- <!-- Config -->
43
- <%= f.fields_for :config do |config_f|%>
44
- <%= render :partial => 'compute_resources_vms/form/proxmox/config', :locals => { :f => config_f, :compute_resource => compute_resource, :host => @host, :new_vm => new_vm, :item_layout => 'removable' } %>
28
+ <!-- VM Advanced Settings -->
29
+ <%= render :partial => "compute_resources_vms/form/proxmox/server/advanced", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
30
+ <%= render :partial => "compute_resources_vms/form/proxmox/container/advanced", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
31
+
32
+ <!-- Config Options Settings-->
33
+ <%= f.fields_for :config, compute_resource.new_server_vm(object_to_config_hash(f.object,'qemu')).config, include_id: false do |server_config|%>
34
+ <%= render :partial => "compute_resources_vms/form/proxmox/server/config", :locals => { :f => server_config, :compute_resource => compute_resource, :host => @host, :new_vm => new_vm, :item_layout => 'removable', :type => f.object.type } %>
35
+ <% end %>
36
+ <%= f.fields_for :config, compute_resource.new_container_vm(object_to_config_hash(f.object,'lxc')).config, include_id: false do |container_config|%>
37
+ <%= render :partial => "compute_resources_vms/form/proxmox/container/config", :locals => { :f => container_config, :compute_resource => compute_resource, :host => @host, :new_vm => new_vm, :item_layout => 'removable', :type => f.object.type } %>
45
38
  <% end %>
@@ -0,0 +1,37 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% untemplatable = new_vm || f.object.templated? %>
19
+
20
+ <%= field_set_tag _("General"), :id => "general" do %>
21
+ <%= checkbox_f f, :templated, :label => _('Create image?'), :disabled => untemplatable, :class => ('hide' if untemplatable), :no_label => untemplatable %>
22
+ <%= counter_f f, :vmid, :label => _('VM ID'), :label_size => "col-md-2", :required => true, :disabled => !new_vm %>
23
+ <%= select_f f, :node, compute_resource.nodes, :node, :node, { }, :label => _('Node'), :label_size => "col-md-2", :required => true, :disabled => true %>
24
+ <% unless local_assigns[:hide_image] && !new_vm %>
25
+ <%
26
+ arch ||= nil ; os ||= nil
27
+ images = possible_images(compute_resource, arch, os)
28
+ -%>
29
+ <div id='image_selection'>
30
+ <%= select_f f, :image_id, images, :uuid, :name, { :include_blank => true },
31
+ :disabled => true,
32
+ :help_inline => :indicator,
33
+ :label => _('Image'),
34
+ :label_size => "col-md-2" %>
35
+ </div>
36
+ <% end %>
37
+ <% end %>
@@ -15,10 +15,5 @@ GNU General Public License for more details.
15
15
  You should have received a copy of the GNU General Public License
16
16
  along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
17
 
18
- <%= select_f f, :model, proxmox_networkcards_map, :id, :name, { }, :label => _('Card'), :label_size => "col-md-2" %>
19
- <%= select_f f, :bridge, compute_resource.bridges, :iface, :iface, { }, :label => _('Bridge'), :label_size => "col-md-2" %>
20
- <%= counter_f f, :tag, :class => "input-mini", :label => _('VLAN tag'), :label_size => "col-md-2" %>
21
- <%= counter_f f, :rate, :class => "input-mini", :label => _('Rate limit'), :label_size => "col-md-2" %>
22
- <%= counter_f f, :queues, :class => "input-mini", :label => _('Multiqueue'), :label_size => "col-md-2" %>
23
- <%= checkbox_f f, :firewall, :label => _('Firewall') %>
24
- <%= checkbox_f f, :link_down, :label => _('Disconnect') %>
18
+ <%= render :partial => "compute_resources_vms/form/proxmox/server/network", :locals => { :f => f, :type => vm_type, :compute_resource => compute_resource, :new_vm => new_vm } %>
19
+ <%= render :partial => "compute_resources_vms/form/proxmox/container/network", :locals => { :f => f, :type => vm_type, :compute_resource => compute_resource, :new_vm => new_vm } %>
@@ -0,0 +1,31 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% container = f.object.type == 'lxc' %>
19
+
20
+ <%= field_set_tag _("Advanced"), :id => "container_config_advanced_options", :class => ('hide' unless container) do %>
21
+ <%= label_tag 'show_container_config_options', n_("Main option", "Main options", 2) %>
22
+ <%= check_box_tag 'show_container_config_options', '1', false, :onclick => "$('#container_config_options').toggle()" %>
23
+ <%= label_tag 'show_container_config_cpu', _("CPU") %>
24
+ <%= check_box_tag 'show_container_config_cpu', '1', false, :onclick => "$('#container_config_cpu').toggle()" %>
25
+ <%= label_tag 'show_container_config_memory', _("Memory") %>
26
+ <%= check_box_tag 'show_container_config_memory', '1', false, :onclick => "$('#container_config_memory').toggle()" %>
27
+ <%= label_tag 'show_container_config_dns', _("DNS") %>
28
+ <%= check_box_tag 'show_container_config_dns', '1', false, :onclick => "$('#container_config_dns').toggle()" %>
29
+ <%= label_tag 'show_container_config_os', _("OS") %>
30
+ <%= check_box_tag 'show_container_config_os', '1', false, :onclick => "$('#container_config_os').toggle()" %>
31
+ <% end %>
@@ -0,0 +1,41 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <%= javascript_include_tag 'foreman_fog_proxmox/proxmox_vm_container', "data-turbolinks-track" => true %>
19
+ <% container = type == 'lxc' %>
20
+ <%= field_set_tag n_("Main option", "Main options", 2), :id => "container_config_options", :class => 'hide', :disabled => !container do %>
21
+ <%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
22
+ <%= checkbox_f f, :onboot, :label => _('Start at boot') %>
23
+ <% end %>
24
+ <%= field_set_tag _("CPU"), :id => "container_config_cpu", :class => 'hide', :disabled => !container do %>
25
+ <%= select_f f, :arch, proxmox_archs_map, :id, :name, { }, :label => _('Architecture'), :label_size => "col-md-2" %>
26
+ <%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
27
+ <%= counter_f f, :cpulimit, :class => "input-mini", :label => _('CPU limit'), :label_size => "col-md-2" %>
28
+ <%= counter_f f, :cpuunits, :class => "input-mini", :label => _('CPU units'), :label_size => "col-md-2" %>
29
+ <% end %>
30
+ <%= field_set_tag _("Memory"), :id => "container_config_memory", :class => 'hide', :disabled => !container do %>
31
+ <%= byte_size_f f, :memory, :class => "input-mini", :label => _('Memory'), :label_size => "col-md-2" %>
32
+ <%= byte_size_f f, :swap, :class => "input-mini", :label => _('Swap'), :label_size => "col-md-2" %>
33
+ <% end %>
34
+ <%= field_set_tag _("DNS"), :id => "container_config_dns", :class => 'hide', :disabled => !container do %>
35
+ <%= text_f f, :hostname, :label => _('Hostname'), :label_size => "col-md-2", :disabled => true %>
36
+ <%= text_f f, :nameserver, :label => _('DNS server'), :label_size => "col-md-2" %>
37
+ <%= text_f f, :searchdomain, :label => _('Search domain'), :label_size => "col-md-2" %>
38
+ <% end %>
39
+ <%= field_set_tag _("Operating System"), :id => "container_config_os", :class => 'hide', :disabled => !container do %>
40
+ <%= select_f f, :ostype, proxmox_ostypes_map, :id, :name, { }, :label => _('OS type'), :label_size => "col-md-2" %>
41
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% container = f.object.type == 'lxc' %>
19
+
20
+ <%= field_set_tag _("Extended"), :id => "container_config_ext", :class => ('hide' unless (new_vm && container)), :disabled => (!container || !new_vm) do %>
21
+ <div id="ostemplate_form">
22
+ <%= select_f f, :ostemplate_storage, compute_resource.storages('vztmpl'), :storage, :storage, { :include_blank => true }, :disabled => !new_vm, :class => ('hide' unless new_vm), :label => _('Template storage'), :label_size => "col-md-2", :onchange => 'storageOstemplateSelected(this)' %>
23
+ <%= select_f f, :ostemplate_file, compute_resource.images_by_storage('vztmpl',f.object.ostemplate_storage), :volid, :volid, { :include_blank => true }, :disabled => !new_vm, :class => ('hide' unless new_vm), :label => _('OS Template'), :label_size => "col-md-2", :required => true %>
24
+ </div>
25
+ <%= password_proxmox_f f, :password, :label => _("Root password"), :required => true %>
26
+ <% end %>