foreman_fog_proxmox 0.12.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.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +290 -0
- data/Rakefile +49 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js +33 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +187 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_container.js +24 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +125 -0
- data/app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb +41 -0
- data/app/controllers/foreman_fog_proxmox/compute_resources_controller.rb +86 -0
- data/app/helpers/node_dashboard_helper.rb +35 -0
- data/app/helpers/proxmox_compute_selectors_helper.rb +184 -0
- data/app/helpers/proxmox_container_helper.rb +163 -0
- data/app/helpers/proxmox_form_helper.rb +70 -0
- data/app/helpers/proxmox_server_helper.rb +155 -0
- data/app/helpers/proxmox_vm_helper.rb +88 -0
- data/app/models/concerns/fog_extensions/proxmox/disk.rb +29 -0
- data/app/models/concerns/fog_extensions/proxmox/interface.rb +40 -0
- data/app/models/concerns/fog_extensions/proxmox/node.rb +41 -0
- data/app/models/concerns/fog_extensions/proxmox/server.rb +93 -0
- data/app/models/concerns/fog_extensions/proxmox/server_config.rb +71 -0
- data/app/models/concerns/fog_extensions/proxmox/volume.rb +29 -0
- data/app/models/concerns/host_ext/proxmox/interfaces.rb +52 -0
- data/app/models/concerns/orchestration/proxmox/compute.rb +42 -0
- data/app/models/foreman_fog_proxmox/options_select.rb +36 -0
- data/app/models/foreman_fog_proxmox/proxmox.rb +133 -0
- data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +67 -0
- data/app/models/foreman_fog_proxmox/proxmox_connection.rb +67 -0
- data/app/models/foreman_fog_proxmox/proxmox_console.rb +41 -0
- data/app/models/foreman_fog_proxmox/proxmox_images.rb +61 -0
- data/app/models/foreman_fog_proxmox/proxmox_interfaces.rb +103 -0
- data/app/models/foreman_fog_proxmox/proxmox_operating_systems.rb +49 -0
- data/app/models/foreman_fog_proxmox/proxmox_pools.rb +56 -0
- data/app/models/foreman_fog_proxmox/proxmox_token_expiration.rb +30 -0
- data/app/models/foreman_fog_proxmox/proxmox_version.rb +36 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +116 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +178 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_queries.rb +75 -0
- data/app/models/foreman_fog_proxmox/proxmox_volumes.rb +94 -0
- data/app/models/foreman_fog_proxmox/vms.rb +37 -0
- data/app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb +34 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_node_to_new_form.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb +34 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb +26 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb +25 -0
- data/app/overrides/compute_resources_vms/form/remove_new_vm_from_removable_layout.rb +25 -0
- data/app/services/foreman_fog_proxmox/node_dashboard/data.rb +37 -0
- data/app/views/api/v2/compute_resources/proxmox.json.rabl +3 -0
- data/app/views/compute_resources/form/_proxmox.html.erb +29 -0
- data/app/views/compute_resources/show/_proxmox.html.erb +37 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_attributes_form.html.erb +23 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_form.html.erb +23 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_hosts_compute_detail_form.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_node_to_new_form.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb +28 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb +32 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +30 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb +71 -0
- data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +39 -0
- data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +39 -0
- data/app/views/compute_resources_vms/form/proxmox/_network.html.erb +19 -0
- data/app/views/compute_resources_vms/form/proxmox/_removable_layout.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb +31 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +41 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_network.html.erb +33 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_volume_rootfs.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb +31 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +60 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_network.html.erb +30 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb +28 -0
- data/app/views/compute_resources_vms/index/_proxmox.html.erb +49 -0
- data/app/views/compute_resources_vms/show/_proxmox.html.erb +42 -0
- data/app/views/dashboard/_foreman_fog_proxmox_widget.erb +21 -0
- data/app/views/images/form/_proxmox.html.erb +21 -0
- data/config/routes.rb +30 -0
- data/lib/foreman_fog_proxmox.rb +23 -0
- data/lib/foreman_fog_proxmox/engine.rb +105 -0
- data/lib/foreman_fog_proxmox/semver.rb +102 -0
- data/lib/foreman_fog_proxmox/value.rb +26 -0
- data/lib/foreman_fog_proxmox/version.rb +22 -0
- data/lib/tasks/foreman_fog_proxmox_tasks.rake +37 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_fog_proxmox.po +401 -0
- data/locale/foreman_fog_proxmox.pot +627 -0
- data/locale/fr/foreman_fog_proxmox.po +401 -0
- data/locale/gemspec.rb +4 -0
- data/test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb +137 -0
- data/test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb +87 -0
- data/test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb +134 -0
- data/test/factories/proxmox_factory.rb +79 -0
- data/test/functional/compute_resources_controller_test.rb +48 -0
- data/test/test_plugin_helper.rb +19 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +204 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb +149 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +216 -0
- data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +124 -0
- data/test/unit/foreman_fog_proxmox/proxmox_images_test.rb +52 -0
- data/test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb +117 -0
- data/test/unit/foreman_fog_proxmox/proxmox_test.rb +58 -0
- data/test/unit/foreman_fog_proxmox/proxmox_version_test.rb +94 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb +280 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb +110 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb +222 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb +308 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb +43 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb +71 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb +68 -0
- data/test/unit/foreman_fog_proxmox/semver_test.rb +111 -0
- metadata +249 -0
@@ -0,0 +1,27 @@
|
|
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 = type == 'lxc' %>
|
19
|
+
<% new_volume = f.object.volid.nil? %>
|
20
|
+
|
21
|
+
<%= field_set_tag _("Mount point"), :id => "container_volume_mp_#{f.index}", :class => ('hide' unless container), :disabled => !container do %>
|
22
|
+
<%= f.hidden_field :volid if !new_vm %>
|
23
|
+
<%= select_f f, :storage, compute_resource.storages(node_id), :storage, :storage, { }, :label => _('Storage'), :label_size => "col-md-2" %>
|
24
|
+
<%= text_f f, :mp, :label => _('Path'), :label_size => "col-md-2", :required => true, :help_inline => _("e.g. /path/to/") %>
|
25
|
+
<%= text_f f, :device, :label => _('Device'), :label_size => "col-md-2", :class => ('hide' if f.object.rootfs?), :disabled => (!new_volume || f.object.rootfs?), :'data-soft-max' => 10 %>
|
26
|
+
<%= byte_size_f f, :size, :class => "input-mini", :label => _("Size"), :label_size => "col-md-2" %>
|
27
|
+
<% end %>
|
@@ -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
|
+
<% container = type == 'lxc' %>
|
19
|
+
|
20
|
+
<%= field_set_tag _("Rootfs"), :id => "container_volume_rootfs", :class => ('hide' unless container), :disabled => !container do %>
|
21
|
+
<%= f.hidden_field :volid if !new_vm %>
|
22
|
+
<%= select_f f, :storage, compute_resource.storages(node_id), :storage, :storage, { }, :label => _('Storage'), :label_size => "col-md-2" %>
|
23
|
+
<%= byte_size_f f, :size, :class => "input-mini", :label => _("Size"), :label_size => "col-md-2" %>
|
24
|
+
<% end %>
|
@@ -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
|
+
<% server = f.object.type == 'qemu' %>
|
19
|
+
|
20
|
+
<%= field_set_tag _("Advanced"), :id => "server_config_advanced_options", :class => ('hide' unless server) do %>
|
21
|
+
<%= label_tag 'show_server_config_options', n_("Main option", "Main options", 2) %>
|
22
|
+
<%= check_box_tag 'show_server_config_options', '1', false, :onclick => "$('#server_config_options').toggle()" %>
|
23
|
+
<%= label_tag 'show_server_config_cpu', _("CPU") %>
|
24
|
+
<%= check_box_tag 'show_server_config_cpu', '1', false, :onclick => "$('#server_config_cpu').toggle()" %>
|
25
|
+
<%= label_tag 'show_server_config_memory', _("Memory") %>
|
26
|
+
<%= check_box_tag 'show_server_config_memory', '1', false, :onclick => "$('#server_config_memory').toggle()" %>
|
27
|
+
<%= label_tag 'show_server_config_cdrom', _("CDROM") %>
|
28
|
+
<%= check_box_tag 'show_server_config_cdrom', '1', false, :onclick => "$('#server_config_cdrom').toggle()" %>
|
29
|
+
<%= label_tag 'show_server_config_os', _("OS") %>
|
30
|
+
<%= check_box_tag 'show_server_config_os', '1', false, :onclick => "$('#server_config_os').toggle()" %>
|
31
|
+
<% end %>
|
@@ -0,0 +1,60 @@
|
|
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_server', "data-turbolinks-track" => true %>
|
19
|
+
|
20
|
+
<% server = type == 'qemu' %>
|
21
|
+
|
22
|
+
<%= field_set_tag n_("Main option", "Main options", 2), :id => "server_config_options", :class => 'hide', :disabled => !server do %>
|
23
|
+
<%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
|
24
|
+
<%= text_f f, :boot, :label => _('Boot device order'), :label_size => "col-md-2", :label_help => _('Floppy disk (a), hard disk (c), cdrom (d), network (n). Default cdn') %>
|
25
|
+
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
26
|
+
<%= checkbox_f f, :agent, :label => _('Qemu Agent') %>
|
27
|
+
<%= checkbox_f f, :kvm, :label => _('KVM'), :label_help => _('Enable/disable KVM hardware virtualization') %>
|
28
|
+
<%= select_f f, :keyboard, proxmox_keyboards_map, :id, :name, { }, :label => _('Keyboard'), :label_size => "col-md-2" %>
|
29
|
+
<%= select_f f, :vga, proxmox_vgas_map, :id, :name, { :include_blank => true }, :label => _('VGA'), :label_size => "col-md-2" %>
|
30
|
+
<%= select_f f, :scsihw, proxmox_scsi_controllers_map, :id, :name, { }, :label => _('SCSI Controller'), :label_size => "col-md-2" %>
|
31
|
+
<%= select_f f, :bios, proxmox_bios_map, :id, :name, { }, :label => _('BIOS'), :label_size => "col-md-2" %>
|
32
|
+
<% end %>
|
33
|
+
<%= field_set_tag _("CPU"), :id => "server_config_cpu", :class => 'hide', :disabled => !server do %>
|
34
|
+
<%= select_f f, :cpu_type, proxmox_cpus_map, :id, :name, { }, :label => _('Type'), :label_size => "col-md-2" %>
|
35
|
+
<%= counter_f f, :sockets, :class => "input-mini", :label => _('Sockets'), :label_size => "col-md-2" %>
|
36
|
+
<%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
|
37
|
+
<%= counter_f f, :vcpus, :class => "input-mini", :label => _('VCPUs'), :label_size => "col-md-2" %>
|
38
|
+
<%= counter_f f, :cpulimit, :class => "input-mini", :label => _('CPU limit'), :label_size => "col-md-2" %>
|
39
|
+
<%= counter_f f, :cpuunits, :class => "input-mini", :label => _('CPU units'), :label_size => "col-md-2" %>
|
40
|
+
<%= checkbox_f f, :numa, :label => _('Enable NUMA') %>
|
41
|
+
<%= checkbox_f f, :pcid, :label => _('PCID') %>
|
42
|
+
<%= checkbox_f f, :spectre, :label => _('Spectre-CTRL') %>
|
43
|
+
<% end %>
|
44
|
+
<%= field_set_tag _("Memory"), :id => "server_config_memory", :class => 'hide', :disabled => !server do %>
|
45
|
+
<%= byte_size_f f, :memory, :class => "input-mini", :label => _('Memory'), :label_size => "col-md-2" %>
|
46
|
+
<%= byte_size_f f, :balloon, :class => "input-mini", :label => _('Minimum memory'), :label_size => "col-md-2" %>
|
47
|
+
<%= counter_f f, :shares, :class => "input-mini", :label => _('Shares'), :label_size => "col-md-2" %>
|
48
|
+
<% end %>
|
49
|
+
<%= field_set_tag _("CD-ROM"), :id => "server_config_cdrom", :class => 'hide', :disabled => !server do %>
|
50
|
+
<%= radio_button_f f, :cdrom, :value => 'none', :text => _('None'), :onclick => 'cdromSelected(this)' %>
|
51
|
+
<%= radio_button_f f, :cdrom, :value => 'cdrom' , :text => _('Physical'), :onclick => 'cdromSelected(this)' %>
|
52
|
+
<%= radio_button_f f, :cdrom, :value => 'image' , :text => _('Image'), :onclick => 'cdromSelected(this)' %>
|
53
|
+
<div id='cdrom_image_form' class='<%= 'hide' if %[none cdrom].include? f.object.cdrom %>'>
|
54
|
+
<%= select_f f, :cdrom_storage, compute_resource.storages(node_id,'iso'), :storage, :storage, { :include_blank => true }, :label => _('Storage'), :label_size => "col-md-2", :onchange => 'storageIsoSelected(this)' %>
|
55
|
+
<%= select_f f, :cdrom_iso, compute_resource.images_by_storage(f.object.cdrom_storage, 'iso'), :volid, :volid, { :include_blank => true }, :label => _('Image ISO'), :label_size => "col-md-2" %>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
<%= field_set_tag _("Operating System"), :id => "server_config_os", :class => 'hide', :disabled => !server do %>
|
59
|
+
<%= select_f f, :ostype, proxmox_operating_systems_map, :id, :name, { :include_blank => true }, :label => _('OS type'), :label_size => "col-md-2" %>
|
60
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
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
|
+
<% server = vm_type == 'qemu' %>
|
19
|
+
<% index = f.index ? f.index.present? : 0 %>
|
20
|
+
|
21
|
+
<%= field_set_tag _("Nic"), :id => "server_network_#{index}", :style => ('display: none;' unless server), :disabled => !server do %>
|
22
|
+
<%= f.hidden_field :id if !new_vm %>
|
23
|
+
<%= select_f f, :model, proxmox_networkcards_map, :id, :name, { }, :label => _('Card'), :label_size => "col-md-2" %>
|
24
|
+
<%= select_f f, :bridge, compute_resource.bridges(node_id), :iface, :iface, { }, :label => _('Bridge'), :label_size => "col-md-2" %>
|
25
|
+
<%= counter_f f, :tag, :class => "input-mini", :label => _('VLAN tag'), :label_size => "col-md-2" %>
|
26
|
+
<%= counter_f f, :rate, :class => "input-mini", :label => _('Rate limit'), :label_size => "col-md-2" %>
|
27
|
+
<%= counter_f f, :queues, :class => "input-mini", :label => _('Multiqueue'), :label_size => "col-md-2" %>
|
28
|
+
<%= checkbox_f f, :firewall, :label => _('Firewall') %>
|
29
|
+
<%= checkbox_f f, :link_down, :label => _('Disconnect') %>
|
30
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
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
|
+
<% server = type == 'qemu' %>
|
19
|
+
<% new_volume = f.object.volid.nil? %>
|
20
|
+
|
21
|
+
<%= field_set_tag _("Disk"), :id => "server_volume_#{f.index}", :class => ('hide' unless server), :disabled => !server do %>
|
22
|
+
<%= f.hidden_field :volid if !new_vm %>
|
23
|
+
<%= select_f f, :storage, compute_resource.storages(node_id), :storage, :storage, { }, :label => _('Storage'), :label_size => "col-md-2" %>
|
24
|
+
<%= select_f f, :controller, proxmox_controllers_map, :id, :name, { }, :label => _('Controller'), :label_size => "col-md-2", :disabled => !new_volume, :onchange => 'controllerSelected(this)' %>
|
25
|
+
<%= text_f f, :device, :label => _('Device'), :label_size => "col-md-2", :disabled => !new_volume, :'data-min' => 0, :'data-soft-max' => proxmox_max_device(f.object.controller), :onchange => 'deviceSelected(this)' %>
|
26
|
+
<%= select_f f, :cache, proxmox_caches_map, :id, :name, { include_blank: true }, :label => _('Cache'), :label_size => "col-md-2" %>
|
27
|
+
<%= byte_size_f f, :size, :class => "input-mini", :label => _("Size"), :label_size => "col-md-2" %>
|
28
|
+
<% end %>
|
@@ -0,0 +1,49 @@
|
|
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
|
+
<table class="table table-bordered" data-table='inline'>
|
19
|
+
<thead>
|
20
|
+
<tr>
|
21
|
+
<th><%= _('Name') -%></th>
|
22
|
+
<th><%= _('Node') -%></th>
|
23
|
+
<th><%= _('Type') -%></th>
|
24
|
+
<th><%= _('CPUs') -%></th>
|
25
|
+
<th><%= _('Memory') -%></th>
|
26
|
+
<th><%= _('Power') -%></th>
|
27
|
+
<th><%= _('Uptime') -%></th>
|
28
|
+
<th></th>
|
29
|
+
</tr>
|
30
|
+
</thead>
|
31
|
+
<tbody>
|
32
|
+
<% @vms.each do |vm| -%>
|
33
|
+
<tr>
|
34
|
+
<td><%= link_to_if_authorized vm.name, hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.identity) %></td>
|
35
|
+
<td><%= vm.node_id %></td>
|
36
|
+
<td><%= vm.type %></td>
|
37
|
+
<td><%= vm.cpus %></td>
|
38
|
+
<td><%= Fog::Proxmox::DiskHelper.to_human_bytes(vm.maxmem) %></td>
|
39
|
+
<td> <span <%= vm_power_class(vm.ready?) %>> <%= vm_state(vm) %></span> </td>
|
40
|
+
<td><%= vm.uptime %></td>
|
41
|
+
<td>
|
42
|
+
<%= action_buttons(
|
43
|
+
vm_power_action(vm, authorizer),
|
44
|
+
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.identity).merge(:auth_object => @compute_resource, :authorizer => authorizer))) %>
|
45
|
+
</td>
|
46
|
+
</tr>
|
47
|
+
<% end -%>
|
48
|
+
</tbody>
|
49
|
+
</table>
|
@@ -0,0 +1,42 @@
|
|
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
|
+
<% title @vm.name unless @vm.nil? %>
|
19
|
+
<div class='span12'>
|
20
|
+
<table class="table table-bordered table-striped">
|
21
|
+
<tr>
|
22
|
+
<th colspan="2">Properties</th>
|
23
|
+
</tr>
|
24
|
+
<% unless @vm.nil? %>
|
25
|
+
<%= prop :name %>
|
26
|
+
<%= prop :type %>
|
27
|
+
<%= prop :node_id %>
|
28
|
+
<%= prop :templated? %>
|
29
|
+
<%= prop :pool %>
|
30
|
+
<%= prop :memory %>
|
31
|
+
<% unless @vm.container? %>
|
32
|
+
<%= prop :vga %>
|
33
|
+
<% end %>
|
34
|
+
<%= prop :cpus %>
|
35
|
+
<%= prop :uptime %>
|
36
|
+
<%= prop :vmid %>
|
37
|
+
<%= prop :description %>
|
38
|
+
<%= prop :disks %>
|
39
|
+
<%= prop :nics %>
|
40
|
+
<% end %>
|
41
|
+
</table>
|
42
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
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
|
+
<% data = ForemanFogProxmox::NodeDashboard::Data.new() %>
|
19
|
+
<% node_id = data.node_id rescue nil %>
|
20
|
+
<h4 class="header ca"><%= N_("Proxmox Node Statistics: %s") % node_id %></h4>
|
21
|
+
<%= render_node_statistics(data.statistics, :class => 'statistics-bar') rescue nil %>
|
@@ -0,0 +1,21 @@
|
|
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
|
+
<%= text_f f, :username, :placeholder => "root", :help_inline => _("The user that is used to ssh into the instance, normally cloud-user, ubuntu, root etc") %>
|
19
|
+
<%= password_f f, :password, :help_inline => _("Password to authenticate with - used for SSH finish step.") %>
|
20
|
+
<%= checkbox_f f, :user_data, :help_inline => _("Does this image support user data input (e.g. via cloud-init)?") %>
|
21
|
+
<%= image_field(f, :label => _("Image VMID"), :help_inline => _("vmid of template vm.")) %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
Rails.application.routes.draw do
|
21
|
+
namespace :foreman_fog_proxmox do
|
22
|
+
match 'isos/:node_id/:storage', :to => 'compute_resources#isos_by_node_and_storage', :via => 'get'
|
23
|
+
match 'ostemplates/:node_id/:storage', :to => 'compute_resources#ostemplates_by_node_and_storage', :via => 'get'
|
24
|
+
match 'isos/:node_id', :to => 'compute_resources#isos_by_node', :via => 'get'
|
25
|
+
match 'ostemplates/:node_id', :to => 'compute_resources#ostemplates_by_node', :via => 'get'
|
26
|
+
match 'storages/:node_id', :to => 'compute_resources#storages_by_node', :via => 'get'
|
27
|
+
match 'isostorages/:node_id', :to => 'compute_resources#iso_storages_by_node', :via => 'get'
|
28
|
+
match 'bridges/:node_id', :to => 'compute_resources#bridges_by_node', :via => 'get'
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'foreman_fog_proxmox/engine'
|
21
|
+
|
22
|
+
module ForemanFogProxmox
|
23
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'deface'
|
21
|
+
|
22
|
+
module ForemanFogProxmox
|
23
|
+
class Engine < ::Rails::Engine
|
24
|
+
engine_name 'foreman_fog_proxmox'
|
25
|
+
|
26
|
+
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
27
|
+
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
28
|
+
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
29
|
+
config.autoload_paths += Dir["#{config.root}/app/overrides"]
|
30
|
+
config.autoload_paths += Dir["#{config.root}/app/services"]
|
31
|
+
|
32
|
+
# Add any db migrations
|
33
|
+
initializer 'foreman_fog_proxmox.load_app_instance_data' do |app|
|
34
|
+
ForemanFogProxmox::Engine.paths['db/migrate'].existent.each do |path|
|
35
|
+
app.config.paths['db/migrate'] << path
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
initializer 'foreman_fog_proxmox.register_plugin', :before => :finisher_hook do |_app|
|
40
|
+
Foreman::Plugin.register :foreman_fog_proxmox do
|
41
|
+
requires_foreman '>= 1.22.0'
|
42
|
+
# Register Proxmox VE compute resource in foreman
|
43
|
+
compute_resource ForemanFogProxmox::Proxmox
|
44
|
+
parameter_filter(ComputeResource, :uuid)
|
45
|
+
# add dashboard widget
|
46
|
+
widget 'foreman_fog_proxmox_widget', name: N_('Foreman Fog Proxmox widget'), sizex: 8, sizey: 1
|
47
|
+
security_block :foreman_fog_proxmox do
|
48
|
+
permission :view_compute_resource, 'foreman_fog_proxmox/compute_resources' =>
|
49
|
+
[:ostemplates_by_node_and_storage, :isos_by_node_and_storage, :ostemplates_by_node, :isos_by_node, :storages_by_node, :iso_storages_by_node, :bridges_by_node]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Precompile any JS or CSS files under app/assets/
|
55
|
+
# If requiring files from each other, list them explicitly here to avoid precompiling the same
|
56
|
+
# content twice.
|
57
|
+
assets_to_precompile =
|
58
|
+
Dir.chdir(root) do
|
59
|
+
Dir['app/assets/javascripts/foreman_fog_proxmox/**/*', 'app/assets/stylesheets/foreman_fog_proxmox/**/*'].map do |f|
|
60
|
+
f.split(File::SEPARATOR, 4).last
|
61
|
+
end
|
62
|
+
end
|
63
|
+
initializer 'foreman_fog_proxmox.assets.precompile' do |app|
|
64
|
+
app.config.assets.precompile += assets_to_precompile
|
65
|
+
end
|
66
|
+
initializer 'foreman_fog_proxmox.configure_assets', group: :assets do
|
67
|
+
SETTINGS[:foreman_fog_proxmox] = {
|
68
|
+
assets: {
|
69
|
+
precompile: assets_to_precompile
|
70
|
+
}
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
rake_tasks do
|
75
|
+
Rake::Task['db:seed'].enhance do
|
76
|
+
ForemanFogProxmox::Engine.load_seed
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
initializer 'foreman_fog_proxmox.register_gettext', after: :load_config_initializers do |_app|
|
81
|
+
locale_dir = File.join(File.expand_path('../..', __dir__), 'locale')
|
82
|
+
locale_domain = 'foreman_fog_proxmox'
|
83
|
+
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
|
84
|
+
end
|
85
|
+
|
86
|
+
config.to_prepare do
|
87
|
+
require 'fog/compute/proxmox/models/server'
|
88
|
+
require 'fog/compute/proxmox/models/server_config'
|
89
|
+
require 'fog/compute/proxmox/models/disk'
|
90
|
+
require 'fog/compute/proxmox/models/interface'
|
91
|
+
require 'fog/compute/proxmox/models/volume'
|
92
|
+
require 'fog/compute/proxmox/models/node'
|
93
|
+
|
94
|
+
Fog::Proxmox::Compute::Server.include FogExtensions::Proxmox::Server
|
95
|
+
Fog::Proxmox::Compute::ServerConfig.include FogExtensions::Proxmox::ServerConfig
|
96
|
+
Fog::Proxmox::Compute::Disk.include FogExtensions::Proxmox::Disk
|
97
|
+
Fog::Proxmox::Compute::Interface.include FogExtensions::Proxmox::Interface
|
98
|
+
Fog::Proxmox::Compute::Volume.include FogExtensions::Proxmox::Volume
|
99
|
+
::ComputeResourcesController.include ForemanFogProxmox::Controller::Parameters::ComputeResource
|
100
|
+
Fog::Proxmox::Compute::Node.include FogExtensions::Proxmox::Node
|
101
|
+
::Host::Managed.include Orchestration::Proxmox::Compute
|
102
|
+
::Host::Managed.include HostExt::Proxmox::Interfaces
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|