foreman_fog_proxmox 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +54 -33
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +25 -5
- data/app/assets/stylesheets/foreman_fog_proxmox/accordion.css +21 -0
- data/app/helpers/proxmox_compute_resources_helper.rb +1 -1
- data/app/helpers/proxmox_form_helper.rb +2 -2
- data/app/helpers/proxmox_vm_attrs_helper.rb +131 -0
- data/app/helpers/proxmox_vm_cloudinit_helper.rb +1 -1
- data/app/helpers/proxmox_vm_interfaces_helper.rb +3 -3
- data/app/helpers/proxmox_vm_volumes_helper.rb +3 -3
- data/app/models/concerns/fog_extensions/proxmox/node.rb +1 -1
- data/app/models/foreman_fog_proxmox/proxmox.rb +1 -1
- data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +3 -3
- data/app/models/foreman_fog_proxmox/proxmox_console.rb +1 -1
- data/app/models/foreman_fog_proxmox/proxmox_images.rb +5 -0
- data/app/models/foreman_fog_proxmox/proxmox_version.rb +1 -1
- data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +5 -2
- data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +1 -1
- data/app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb +8 -0
- data/app/overrides/compute_resources_vms/form/add_react_component_to_host.rb +25 -0
- data/app/overrides/compute_resources_vms/form/update_react_component_to_host_form.rb +25 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_react_component_to_host_form.html.erb +5 -0
- data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +21 -21
- data/app/views/compute_resources_vms/form/proxmox/_update_react_component_to_host_form.html.erb +26 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +17 -13
- data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +20 -20
- data/app/views/compute_resources_vms/form/proxmox/server/_volume_hard_disk.html.erb +4 -1
- data/config/routes.rb +3 -3
- data/lib/foreman_fog_proxmox/version.rb +1 -1
- data/package.json +42 -0
- data/test/factories/proxmox_factory.rb +7 -7
- data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +1 -1
- data/test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb +6 -6
- data/webpack/components/GeneralTabContent.js +107 -0
- data/webpack/components/ProxmoxComputeSelectors.js +141 -0
- data/webpack/components/ProxmoxContainer/MountPoint.js +91 -0
- data/webpack/components/ProxmoxContainer/ProxmoxContainerHardware.js +85 -0
- data/webpack/components/ProxmoxContainer/ProxmoxContainerNetwork.js +179 -0
- data/webpack/components/ProxmoxContainer/ProxmoxContainerOptions.js +104 -0
- data/webpack/components/ProxmoxContainer/ProxmoxContainerStorage.js +194 -0
- data/webpack/components/ProxmoxContainer/components/NetworkInterface.js +193 -0
- data/webpack/components/ProxmoxServer/ProxmoxServerHardware.js +204 -0
- data/webpack/components/ProxmoxServer/ProxmoxServerNetwork.js +161 -0
- data/webpack/components/ProxmoxServer/ProxmoxServerOptions.js +105 -0
- data/webpack/components/ProxmoxServer/ProxmoxServerStorage.js +272 -0
- data/webpack/components/ProxmoxServer/components/CDRom.js +149 -0
- data/webpack/components/ProxmoxServer/components/CPUFlagsModal.js +88 -0
- data/webpack/components/ProxmoxServer/components/HardDisk.js +143 -0
- data/webpack/components/ProxmoxServer/components/NetworkInterface.js +150 -0
- data/webpack/components/ProxmoxStoragesUtils.js +50 -0
- data/webpack/components/ProxmoxVmType.js +256 -0
- data/webpack/components/ProxmoxVmUtils.js +62 -0
- data/webpack/components/common/FormInputs.js +143 -0
- data/webpack/global_index.js +15 -0
- data/webpack/index.js +7 -0
- metadata +50 -21
@@ -14,25 +14,25 @@ GNU General Public License for more details.
|
|
14
14
|
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
17
|
+
<% nodes = compute_resource.nodes %>
|
18
|
+
<% unless local_assigns[:hide_image] && !new_vm %>
|
19
|
+
<%
|
20
|
+
arch ||= nil ; os ||= nil
|
21
|
+
images = possible_images(compute_resource, arch, os)
|
22
|
+
-%>
|
23
|
+
<div id='image_selection'>
|
24
|
+
<%= select_f f, :image_id, images, :uuid, :name, { :include_blank => true },
|
25
|
+
:disabled => true,
|
26
|
+
:help_inline => :indicator,
|
27
|
+
:class => ('hide' if from_profile),
|
28
|
+
:label => _('Image'),
|
29
|
+
:no_label => from_profile,
|
30
|
+
:label_size => "col-md-2" %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
<% untemplatable = new_vm || f.object.templated? %>
|
34
|
+
<% checked = params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:start_after_create] || '1' %>
|
35
|
+
<% content_for(:javascripts) do %>
|
36
|
+
<%= webpacked_plugins_js_for :foreman_fog_proxmox %>
|
35
37
|
<% end %>
|
36
|
-
<%= f.
|
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, :node_id => f.object.node_id } %>
|
38
|
-
<% end %>
|
38
|
+
<%= react_component('ProxmoxVmType', { vmAttrs: object_to_attributes_hash(f.object, from_profile, checked), nodes: nodes.as_json, images: images.as_json, pools: compute_resource.pools.as_json, storages: compute_resource.storages.as_json, fromProfile: from_profile, newVm: new_vm, bridges: compute_resource.bridges.as_json, untemplatable: untemplatable }) %>
|
data/app/views/compute_resources_vms/form/proxmox/_update_react_component_to_host_form.html.erb
ADDED
@@ -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
|
+
<% if compute_resource.class == ForemanFogProxmox::Proxmox %>
|
19
|
+
<%= render :partial => provider_partial(compute_resource, 'base'),
|
20
|
+
locals: { f: compute, host: host, compute_resource: compute_resource, new_host: host.new_record?, new_vm: !compute.object.persisted?,
|
21
|
+
arch: host.architecture_id, os: host.operatingsystem_id, from_profile: false } %>
|
22
|
+
<% else %>
|
23
|
+
<%= render :partial => provider_partial(compute_resource, 'base'),
|
24
|
+
locals: { f: compute, host: host, compute_resource: compute_resource, new_host: host.new_record?, new_vm: !compute.object.persisted?,
|
25
|
+
arch: host.architecture_id, os: host.operatingsystem_id } %>
|
26
|
+
<% end %>
|
@@ -16,33 +16,37 @@ 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
18
|
<%= javascript_include_tag 'foreman_fog_proxmox/proxmox_vm_container', "data-turbolinks-track" => true %>
|
19
|
+
<%= stylesheet_link_tag 'foreman_fog_proxmox/accordion' %>
|
19
20
|
<% container = type == 'lxc' %>
|
20
|
-
<%=
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
21
|
+
<%= field_set_tag n_("Main option", "Main options", 2), :id => "container_config_options", :class => 'accordion-section', :disabled => !container do %>
|
22
|
+
<div class="accordion-content">
|
23
|
+
<%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
|
24
|
+
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
25
25
|
</div>
|
26
|
-
|
27
|
-
|
26
|
+
<% end %>
|
27
|
+
<%= field_set_tag _("CPU"), :id => "container_config_cpu", :class => 'accordion-section', :disabled => !container do %>
|
28
|
+
<div class="accordion-content">
|
28
29
|
<%= select_f f, :arch, proxmox_archs_map, :id, :name, { }, :label => _('Architecture'), :label_size => "col-md-2" %>
|
29
30
|
<%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
|
30
31
|
<%= counter_f f, :cpulimit, :class => "input-mini", :label => _('CPU limit'), :label_size => "col-md-2" %>
|
31
32
|
<%= counter_f f, :cpuunits, :class => "input-mini", :label => _('CPU units'), :label_size => "col-md-2" %>
|
32
33
|
</div>
|
33
|
-
|
34
|
-
|
34
|
+
<% end %>
|
35
|
+
<%= field_set_tag _("Memory"), :id => "container_config_memory", :class => 'accordion-section', :disabled => !container do %>
|
36
|
+
<div class="accordion-content">
|
35
37
|
<%= text_f f, :memory, :class => "input-mini", :label => _('Memory (MB)'), :label_size => "col-md-2" %>
|
36
38
|
<%= text_f f, :swap, :class => "input-mini", :label => _('Swap (MB)'), :label_size => "col-md-2" %>
|
37
39
|
</div>
|
38
|
-
|
39
|
-
|
40
|
+
<% end %>
|
41
|
+
<%= field_set_tag _("DNS"), :id => "container_config_dns", :class => 'accordion-section', :disabled => !container do %>
|
42
|
+
<div class="accordion-content">
|
40
43
|
<%= text_f f, :hostname, :label => _('Hostname'), :label_size => "col-md-2", :disabled => true %>
|
41
44
|
<%= text_f f, :nameserver, :label => _('DNS server'), :label_size => "col-md-2" %>
|
42
45
|
<%= text_f f, :searchdomain, :label => _('Search domain'), :label_size => "col-md-2" %>
|
43
46
|
</div>
|
44
|
-
|
45
|
-
|
47
|
+
<% end %>
|
48
|
+
<%= field_set_tag _("Operating System"), :id => "container_config_os", :class => 'accordion-section', :disabled => !container do %>
|
49
|
+
<div class="accordion-content">
|
46
50
|
<%= select_f f, :ostype, proxmox_ostypes_map, :id, :name, { }, :label => _('OS type'), :label_size => "col-md-2" %>
|
47
51
|
</div>
|
48
52
|
<% end %>
|
@@ -16,25 +16,23 @@ 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
18
|
<%= javascript_include_tag 'foreman_fog_proxmox/proxmox_vm_server', "data-turbolinks-track" => true %>
|
19
|
-
|
19
|
+
<%= stylesheet_link_tag 'foreman_fog_proxmox/accordion' %>
|
20
20
|
<% server = type == 'qemu' %>
|
21
21
|
<% logger.debug("_config.html.erb server_config=#{f.object.inspect}") %>
|
22
|
-
|
23
|
-
|
24
|
-
<%=
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<%= select_f f, :scsihw, proxmox_scsi_controllers_map, :id, :name, { }, :label => _('SCSI Controller'), :label_size => "col-md-2" %>
|
33
|
-
<%= select_f f, :bios, proxmox_bios_map, :id, :name, { }, :label => _('BIOS'), :label_size => "col-md-2" %>
|
22
|
+
<%= field_set_tag n_("Main option", "Main options", 2), :id => "server_config_options", :class => 'accordion-section', :disabled => !server do %>
|
23
|
+
<div class="accordion-content">
|
24
|
+
<%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
|
25
|
+
<%= text_f f, :boot, :label => _('Boot device order'), :label_size => "col-md-2", :label_help => _('Order your devices, e.g. order=net0;ide2;scsi0. Default empty (any)') %>
|
26
|
+
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
27
|
+
<%= checkbox_f f, :agent, :label => _('Qemu Agent') %>
|
28
|
+
<%= checkbox_f f, :kvm, :label => _('KVM'), :label_help => _('Enable/disable KVM hardware virtualization') %>
|
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" %>
|
34
32
|
</div>
|
35
|
-
|
36
|
-
|
37
|
-
<div>
|
33
|
+
<% end %>
|
34
|
+
<%= field_set_tag _("CPUs"), :id => "server_config_cpu", :class => 'accordion-section', :disabled => !server do %>
|
35
|
+
<div class="accordion-content">
|
38
36
|
<%= select_f f, :cpu_type, proxmox_cpus_map, :id, :name, { }, :label => _('Type'), :label_size => "col-md-2" %>
|
39
37
|
<%= counter_f f, :sockets, :class => "input-mini", :label => _('Sockets'), :label_size => "col-md-2" %>
|
40
38
|
<%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
|
@@ -48,14 +46,16 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
48
46
|
<% end %>
|
49
47
|
<% end %>
|
50
48
|
</div>
|
51
|
-
|
52
|
-
|
49
|
+
<% end %>
|
50
|
+
<%= field_set_tag _("Memory"), :id => "server_config_memory", :class => 'accordion-section', :disabled => !server do %>
|
51
|
+
<div class="accordion-content">
|
53
52
|
<%= text_f f, :memory, :class => "input-mini", :label => _('Memory (MB)'), :label_size => "col-md-2" %>
|
54
53
|
<%= text_f f, :balloon, :class => "input-mini", :label => _('Minimum memory (MB)'), :label_size => "col-md-2" %>
|
55
54
|
<%= text_f f, :shares, :class => "input-mini", :label => _('Shares (MB)'), :label_size => "col-md-2" %>
|
56
55
|
</div>
|
57
|
-
|
58
|
-
|
56
|
+
<% end %>
|
57
|
+
<%= field_set_tag _("Operating System"), :id => "server_config_os", :class => 'accordion-section', :disabled => !server do %>
|
58
|
+
<div class="accordion-content">
|
59
59
|
<%= select_f f, :ostype, proxmox_operating_systems_map, :id, :name, { :include_blank => true }, :label => _('OS type'), :label_size => "col-md-2" %>
|
60
60
|
</div>
|
61
61
|
<% end %>
|
@@ -26,7 +26,10 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
26
26
|
<%= f.hidden_field :storage_type %>
|
27
27
|
<%= select_f f, :storage, compute_resource.storages(node_id), :storage, :storage, { }, :label => _('Storage'), :label_size => "col-md-2" %>
|
28
28
|
<%= select_f f, :controller, proxmox_controllers_map, :id, :name, { }, :label => _('Controller'), :label_size => "col-md-2", :disabled => !new_volume, :onchange => 'controllerSelected(this)' %>
|
29
|
-
|
29
|
+
<div>
|
30
|
+
<%= text_f f, :device, :label => _('Device'), :label_size => "col-md-2", :disabled => !new_volume, :onchange => 'deviceSelected(this)' %>
|
31
|
+
<span class="warning-container"></span>
|
32
|
+
</div>
|
30
33
|
<%= select_f f, :cache, proxmox_caches_map, :id, :name, { include_blank: true }, :label => _('Cache'), :label_size => "col-md-2" %>
|
31
34
|
<%= text_f f, :size, :class => "input-mini", :label => _("Size (GB)"), :label_size => "col-md-2", :disabled => !hard_disk %>
|
32
35
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -20,15 +20,15 @@
|
|
20
20
|
Rails.application.routes.draw do
|
21
21
|
namespace :foreman_fog_proxmox do
|
22
22
|
match 'isos/:compute_resource_id/:node_id/:storage', :to => 'compute_resources#isos_by_id_and_node_and_storage',
|
23
|
-
:via => 'get'
|
23
|
+
:via => 'get'
|
24
24
|
match 'ostemplates/:compute_resource_id/:node_id/:storage',
|
25
25
|
:to => 'compute_resources#ostemplates_by_id_and_node_and_storage', :via => 'get'
|
26
26
|
match 'isos/:compute_resource_id/:node_id', :to => 'compute_resources#isos_by_id_and_node', :via => 'get'
|
27
27
|
match 'ostemplates/:compute_resource_id/:node_id', :to => 'compute_resources#ostemplates_by_id_and_node',
|
28
|
-
:via => 'get'
|
28
|
+
:via => 'get'
|
29
29
|
match 'storages/:compute_resource_id/:node_id', :to => 'compute_resources#storages_by_id_and_node', :via => 'get'
|
30
30
|
match 'isostorages/:compute_resource_id/:node_id', :to => 'compute_resources#iso_storages_by_id_and_node',
|
31
|
-
:via => 'get'
|
31
|
+
:via => 'get'
|
32
32
|
match 'bridges/:compute_resource_id/:node_id', :to => 'compute_resources#bridges_by_id_and_node', :via => 'get'
|
33
33
|
end
|
34
34
|
end
|
data/package.json
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"name": "foreman_fog_proxmox",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "DESCRIPTION",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"lint": "tfm-lint --plugin -d webpack",
|
8
|
+
"test": "tfm-test --config jest.config.js",
|
9
|
+
"test:watch": "tfm-test --plugin --watchAll",
|
10
|
+
"test:current": "tfm-test --plugin --watch",
|
11
|
+
"publish-coverage": "tfm-publish-coverage",
|
12
|
+
"stories": "tfm-stories --plugin",
|
13
|
+
"stories:build": "tfm-build-stories --plugin",
|
14
|
+
"create-react-component": "yo react-domain"
|
15
|
+
},
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "git+https://github.com/theforeman/foreman_fog_proxmox.git"
|
19
|
+
},
|
20
|
+
"bugs": {
|
21
|
+
"url": "http://projects.theforeman.org/projects/foreman_fog_proxmox/issues"
|
22
|
+
},
|
23
|
+
"peerDependencies": {
|
24
|
+
"@theforeman/vendor": "^12.0.1"
|
25
|
+
},
|
26
|
+
"dependencies": {
|
27
|
+
"react-intl": "^2.8.0"
|
28
|
+
},
|
29
|
+
"devDependencies": {
|
30
|
+
"@babel/core": "^7.7.0",
|
31
|
+
"@testing-library/react": "^10.4.9",
|
32
|
+
"@theforeman/builder": ">=12.0.1",
|
33
|
+
"@theforeman/eslint-plugin-foreman": ">=12.0.1",
|
34
|
+
"@theforeman/find-foreman": ">=12.0.1",
|
35
|
+
"@theforeman/test": ">=12.0.1",
|
36
|
+
"@theforeman/vendor-dev": ">=12.0.1",
|
37
|
+
"babel-eslint": "^10.0.3",
|
38
|
+
"eslint": "^6.7.2",
|
39
|
+
"prettier": "^1.19.1",
|
40
|
+
"react-redux-test-utils": "^0.2.0"
|
41
|
+
}
|
42
|
+
}
|
@@ -20,7 +20,7 @@
|
|
20
20
|
require 'fog/proxmox/compute/models/node'
|
21
21
|
|
22
22
|
FactoryBot.define do
|
23
|
-
factory :proxmox_resource, :class => ComputeResource do
|
23
|
+
factory :proxmox_resource, :class => 'ComputeResource' do
|
24
24
|
sequence(:name) { |n| "compute_resource#{n}" }
|
25
25
|
organizations { [Organization.find_by(name: 'Organization 1')] }
|
26
26
|
locations { [Location.find_by(name: 'Location 1')] }
|
@@ -32,10 +32,10 @@ FactoryBot.define do
|
|
32
32
|
url { 'https://192.168.56.101:8006/api2/json' }
|
33
33
|
end
|
34
34
|
|
35
|
-
factory :proxmox_cr, :class => ForemanFogProxmox::Proxmox, :traits => [:proxmox]
|
35
|
+
factory :proxmox_cr, :class => 'ForemanFogProxmox::Proxmox', :traits => [:proxmox]
|
36
36
|
end
|
37
37
|
|
38
|
-
factory :node, :class => Fog::Proxmox::Compute::Node do
|
38
|
+
factory :node, :class => 'Fog::Proxmox::Compute::Node' do
|
39
39
|
sequence(:identity) { |n| "node#{n}" }
|
40
40
|
trait :proxmox do
|
41
41
|
identity { 'proxmox' }
|
@@ -43,7 +43,7 @@ FactoryBot.define do
|
|
43
43
|
trait :service do
|
44
44
|
service { :proxmox_cr }
|
45
45
|
end
|
46
|
-
factory :proxmox_node, :class => Fog::Proxmox::Compute::Node, :traits => [:proxmox, :service]
|
46
|
+
factory :proxmox_node, :class => 'Fog::Proxmox::Compute::Node', :traits => [:proxmox, :service]
|
47
47
|
end
|
48
48
|
|
49
49
|
def deferred_nic_attrs
|
@@ -59,16 +59,16 @@ FactoryBot.define do
|
|
59
59
|
host
|
60
60
|
end
|
61
61
|
|
62
|
-
factory :nic_base_empty, :class => Nic::Base do
|
62
|
+
factory :nic_base_empty, :class => 'Nic::Base' do
|
63
63
|
type { 'Nic::Base' }
|
64
64
|
end
|
65
65
|
|
66
|
-
factory :nic_managed_empty, :class => Nic::Managed, :parent => :nic_base_empty do
|
66
|
+
factory :nic_managed_empty, :class => 'Nic::Managed', :parent => :nic_base_empty do
|
67
67
|
type { 'Nic::Managed' }
|
68
68
|
identifier { 'net0' }
|
69
69
|
end
|
70
70
|
|
71
|
-
factory :host_empty, :class => Host do
|
71
|
+
factory :host_empty, :class => 'Host' do
|
72
72
|
sequence(:name) { |n| "host#{n}" }
|
73
73
|
sequence(:hostname) { |n| "host#{n}" }
|
74
74
|
trait :compute_attributes do
|
@@ -62,7 +62,7 @@ module ForemanFogProxmox
|
|
62
62
|
|
63
63
|
it 'sets container hostname with host name' do
|
64
64
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'net0', :primary => true,
|
65
|
-
:compute_attributes => { 'dhcp' => '1', 'dhcp6' => '1' })
|
65
|
+
:compute_attributes => { 'dhcp' => '1', 'dhcp6' => '1' })
|
66
66
|
host = FactoryBot.build(
|
67
67
|
:host_empty,
|
68
68
|
:interfaces => [physical_nic],
|
@@ -40,7 +40,7 @@ module ForemanFogProxmox
|
|
40
40
|
it 'raises Foreman::Exception when server proxmox NIC id does not match net[k] with k integer' do
|
41
41
|
compute_attributes = ActiveSupport::HashWithIndifferentAccess.new({ 'id' => 'dsfqsfqzef' })
|
42
42
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'eth0',
|
43
|
-
:compute_attributes => compute_attributes)
|
43
|
+
:compute_attributes => compute_attributes)
|
44
44
|
host = FactoryBot.build(
|
45
45
|
:host_empty,
|
46
46
|
:interfaces => [physical_nic],
|
@@ -58,7 +58,7 @@ module ForemanFogProxmox
|
|
58
58
|
ip6 = Array.new(4) { format('%<x>s', x: rand(16**4)) }.join(':') + '::1'
|
59
59
|
compute_attributes = ActiveSupport::HashWithIndifferentAccess.new({ 'id' => 'net0' })
|
60
60
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'net0', :ip => ip, :ip6 => ip6,
|
61
|
-
:mac => mac_address, :compute_attributes => compute_attributes)
|
61
|
+
:mac => mac_address, :compute_attributes => compute_attributes)
|
62
62
|
host = FactoryBot.build(
|
63
63
|
:host_empty,
|
64
64
|
:interfaces => [physical_nic],
|
@@ -75,7 +75,7 @@ module ForemanFogProxmox
|
|
75
75
|
it 'raises Foreman::Exception when container proxmox NIC id does not match net[k] with k integer' do
|
76
76
|
compute_attributes = ActiveSupport::HashWithIndifferentAccess.new({ 'id' => 'dsfqsfqzef' })
|
77
77
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'eth0',
|
78
|
-
:compute_attributes => compute_attributes)
|
78
|
+
:compute_attributes => compute_attributes)
|
79
79
|
host = FactoryBot.build(
|
80
80
|
:host_empty,
|
81
81
|
:interfaces => [physical_nic],
|
@@ -94,7 +94,7 @@ module ForemanFogProxmox
|
|
94
94
|
compute_attributes = ActiveSupport::HashWithIndifferentAccess.new({ 'id' => 'net0', 'cidr' => cidr, 'gw' => ip,
|
95
95
|
'ip' => ip, 'dhcp6' => '1' })
|
96
96
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'net0', :ip => ip, :ip6 => ip6,
|
97
|
-
:compute_attributes => compute_attributes)
|
97
|
+
:compute_attributes => compute_attributes)
|
98
98
|
host = FactoryBot.build(
|
99
99
|
:host_empty,
|
100
100
|
:interfaces => [physical_nic],
|
@@ -115,7 +115,7 @@ module ForemanFogProxmox
|
|
115
115
|
compute_attributes = ActiveSupport::HashWithIndifferentAccess.new({ 'id' => 'net0', 'cidr6' => cidr6,
|
116
116
|
'dhcp' => '1', 'gw6' => ip6 })
|
117
117
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'net0', :ip => ip, :ip6 => ip6,
|
118
|
-
:compute_attributes => compute_attributes)
|
118
|
+
:compute_attributes => compute_attributes)
|
119
119
|
host = FactoryBot.build(
|
120
120
|
:host_empty,
|
121
121
|
:interfaces => [physical_nic],
|
@@ -137,7 +137,7 @@ module ForemanFogProxmox
|
|
137
137
|
compute_attributes = ActiveSupport::HashWithIndifferentAccess.new({ 'id' => 'net0', 'dhcp' => '1',
|
138
138
|
'ip6' => ip6, 'firewall' => firewall })
|
139
139
|
physical_nic = FactoryBot.build(:nic_base_empty, :identifier => 'net0', :ip => ip, :ip6 => ip6,
|
140
|
-
:mac => mac_address, :compute_attributes => compute_attributes)
|
140
|
+
:mac => mac_address, :compute_attributes => compute_attributes)
|
141
141
|
host = FactoryBot.build(
|
142
142
|
:host_empty,
|
143
143
|
:interfaces => [physical_nic],
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { PageSection, Divider } from '@patternfly/react-core';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
import InputField from './common/FormInputs';
|
6
|
+
|
7
|
+
const GeneralTabContent = ({
|
8
|
+
general,
|
9
|
+
fromProfile,
|
10
|
+
newVm,
|
11
|
+
nodesMap,
|
12
|
+
poolsMap,
|
13
|
+
imagesMap,
|
14
|
+
handleChange,
|
15
|
+
untemplatable,
|
16
|
+
}) => (
|
17
|
+
<PageSection padding={{ default: 'noPadding' }}>
|
18
|
+
<Divider component="li" style={{ marginBottom: '2rem' }} />
|
19
|
+
<InputField
|
20
|
+
name={general?.vmid?.name}
|
21
|
+
label={__('VM ID')}
|
22
|
+
required
|
23
|
+
type="number"
|
24
|
+
value={general?.vmid?.value}
|
25
|
+
disabled={fromProfile}
|
26
|
+
onChange={handleChange}
|
27
|
+
/>
|
28
|
+
<InputField
|
29
|
+
name={general?.nodeId?.name}
|
30
|
+
label={__('Node')}
|
31
|
+
required
|
32
|
+
type="select"
|
33
|
+
value={general?.nodeId?.value}
|
34
|
+
options={nodesMap}
|
35
|
+
onChange={handleChange}
|
36
|
+
/>
|
37
|
+
<InputField
|
38
|
+
name={general?.pool?.name}
|
39
|
+
label={__('Pool')}
|
40
|
+
type="select"
|
41
|
+
value={general?.pool?.value}
|
42
|
+
options={poolsMap}
|
43
|
+
onChange={handleChange}
|
44
|
+
/>
|
45
|
+
{newVm && !fromProfile && (
|
46
|
+
<InputField
|
47
|
+
name={general?.startAfterCreate?.name}
|
48
|
+
label={__('Start after creation?')}
|
49
|
+
type="checkbox"
|
50
|
+
value={general?.startAfterCreate?.value}
|
51
|
+
checked={general?.startAfterCreate?.value === '1'}
|
52
|
+
onChange={handleChange}
|
53
|
+
/>
|
54
|
+
)}
|
55
|
+
{!fromProfile && !untemplatable && (
|
56
|
+
<InputField
|
57
|
+
name={general?.templated?.name}
|
58
|
+
label={__('Create image?')}
|
59
|
+
type="checkbox"
|
60
|
+
value={general?.templated?.value}
|
61
|
+
checked={general?.templated?.value === '1'}
|
62
|
+
disabled={untemplatable}
|
63
|
+
onChange={handleChange}
|
64
|
+
/>
|
65
|
+
)}
|
66
|
+
{fromProfile && (
|
67
|
+
<InputField
|
68
|
+
name={general?.imageId?.name}
|
69
|
+
label={__('Image')}
|
70
|
+
type="select"
|
71
|
+
value={general?.imageId?.value}
|
72
|
+
disabled={imagesMap.length === 0}
|
73
|
+
options={imagesMap}
|
74
|
+
onChange={handleChange}
|
75
|
+
/>
|
76
|
+
)}
|
77
|
+
<InputField
|
78
|
+
name={general?.description?.name}
|
79
|
+
label={__('Description')}
|
80
|
+
type="textarea"
|
81
|
+
value={general?.description?.value}
|
82
|
+
onChange={handleChange}
|
83
|
+
/>
|
84
|
+
</PageSection>
|
85
|
+
);
|
86
|
+
|
87
|
+
GeneralTabContent.propTypes = {
|
88
|
+
general: PropTypes.object.isRequired,
|
89
|
+
fromProfile: PropTypes.bool,
|
90
|
+
newVm: PropTypes.bool,
|
91
|
+
nodesMap: PropTypes.array,
|
92
|
+
poolsMap: PropTypes.array,
|
93
|
+
imagesMap: PropTypes.array,
|
94
|
+
handleChange: PropTypes.func.isRequired,
|
95
|
+
untemplatable: PropTypes.bool,
|
96
|
+
};
|
97
|
+
|
98
|
+
GeneralTabContent.defaultProps = {
|
99
|
+
fromProfile: false,
|
100
|
+
newVm: false,
|
101
|
+
nodesMap: [],
|
102
|
+
poolsMap: [],
|
103
|
+
imagesMap: [],
|
104
|
+
untemplatable: false,
|
105
|
+
};
|
106
|
+
|
107
|
+
export default GeneralTabContent;
|
@@ -0,0 +1,141 @@
|
|
1
|
+
const ProxmoxComputeSelectors = {
|
2
|
+
proxmoxTypesMap: [
|
3
|
+
{ value: 'qemu', label: 'KVM/Qemu server' },
|
4
|
+
{ value: 'lxc', label: 'LXC container' },
|
5
|
+
],
|
6
|
+
|
7
|
+
proxmoxControllersCloudinitMap: [
|
8
|
+
{ value: 'ide', label: 'IDE' },
|
9
|
+
{ value: 'sata', label: 'SATA' },
|
10
|
+
{ value: 'scsi', label: 'SCSI' },
|
11
|
+
],
|
12
|
+
|
13
|
+
proxmoxScsiControllersMap: [
|
14
|
+
{ value: 'lsi', label: 'LSI 53C895A (Default)' },
|
15
|
+
{ value: 'lsi53c810', label: 'LSI 53C810' },
|
16
|
+
{ value: 'virtio-scsi-pci', label: 'VirtIO SCSI' },
|
17
|
+
{ value: 'virtio-scsi-single', label: 'VirtIO SCSI Single' },
|
18
|
+
{ value: 'megasas', label: 'MegaRAID SAS 8708EM2' },
|
19
|
+
{ value: 'pvscsi', label: 'VMware PVSCSI' },
|
20
|
+
],
|
21
|
+
|
22
|
+
proxmoxArchsMap: [
|
23
|
+
{ value: 'amd64', label: '64 bits' },
|
24
|
+
{ value: 'i386', label: '32 bits' },
|
25
|
+
],
|
26
|
+
|
27
|
+
proxmoxOstypesMap: [
|
28
|
+
{ value: 'debian', label: 'Debian' },
|
29
|
+
{ value: 'ubuntu', label: 'Ubuntu' },
|
30
|
+
{ value: 'centos', label: 'CentOS' },
|
31
|
+
{ value: 'fedora', label: 'Fedora' },
|
32
|
+
{ value: 'opensuse', label: 'OpenSuse' },
|
33
|
+
{ value: 'archlinux', label: 'ArchLinux' },
|
34
|
+
{ value: 'gentoo', label: 'Gentoo' },
|
35
|
+
{ value: 'alpine', label: 'Alpine' },
|
36
|
+
{ value: 'unmanaged', label: 'Unmanaged' },
|
37
|
+
],
|
38
|
+
|
39
|
+
proxmoxOperatingSystemsMap: [
|
40
|
+
{ value: 'other', label: 'Unspecified OS' },
|
41
|
+
{ value: 'wxp', label: 'Microsoft Windows XP' },
|
42
|
+
{ value: 'w2k', label: 'Microsoft Windows 2000' },
|
43
|
+
{ value: 'w2k3', label: 'Microsoft Windows 2003' },
|
44
|
+
{ value: 'w2k8', label: 'Microsoft Windows 2008' },
|
45
|
+
{ value: 'wvista', label: 'Microsoft Windows Vista' },
|
46
|
+
{ value: 'win7', label: 'Microsoft Windows 7' },
|
47
|
+
{ value: 'win8', label: 'Microsoft Windows 8/2012/2012r2' },
|
48
|
+
{ value: 'win10', label: 'Microsoft Windows 10/2016' },
|
49
|
+
{ value: 'l24', label: 'Linux 2.4 Kernel' },
|
50
|
+
{ value: 'l26', label: 'Linux 2.6/3.X + Kernel' },
|
51
|
+
{ value: 'solaris', label: 'Solaris/OpenSolaris/OpenIndiania kernel' },
|
52
|
+
],
|
53
|
+
|
54
|
+
proxmoxVgasMap: [
|
55
|
+
{ value: 'std', label: 'Standard VGA' },
|
56
|
+
{ value: 'vmware', label: 'Vmware compatible' },
|
57
|
+
{ value: 'qxl', label: 'SPICE' },
|
58
|
+
{ value: 'qxl2', label: 'SPICE 2 monitors' },
|
59
|
+
{ value: 'qxl3', label: 'SPICE 3 monitors' },
|
60
|
+
{ value: 'qxl4', label: 'SPICE 4 monitors' },
|
61
|
+
{ value: 'serial0', label: 'Serial terminal 0' },
|
62
|
+
{ value: 'serial1', label: 'Serial terminal 1' },
|
63
|
+
{ value: 'serial2', label: 'Serial terminal 2' },
|
64
|
+
{ value: 'serial3', label: 'Serial terminal 3' },
|
65
|
+
],
|
66
|
+
|
67
|
+
proxmoxCachesMap: [
|
68
|
+
{ value: '', labal: '' },
|
69
|
+
{ value: 'directsync', label: 'Direct sync' },
|
70
|
+
{ value: 'writethrough', label: 'Write through' },
|
71
|
+
{ value: 'writeback', label: 'Write back' },
|
72
|
+
{ value: 'unsafe', label: 'Write back unsafe' },
|
73
|
+
{ value: 'none', label: 'No cache' },
|
74
|
+
],
|
75
|
+
|
76
|
+
proxmoxCpusMap: [
|
77
|
+
{ value: '486', label: '486' },
|
78
|
+
{ value: 'athlon', label: 'athlon' },
|
79
|
+
{ value: 'core2duo', label: 'core2duo' },
|
80
|
+
{ value: 'coreduo', label: 'coreduo' },
|
81
|
+
{ value: 'kvm32', label: 'kvm32' },
|
82
|
+
{ value: 'kvm64', label: '(Default) kvm64' },
|
83
|
+
{ value: 'pentium', label: 'pentium' },
|
84
|
+
{ value: 'pentium2', label: 'pentium2' },
|
85
|
+
{ value: 'pentium3', label: 'pentium3' },
|
86
|
+
{ value: 'phenom', label: 'phenom' },
|
87
|
+
{ value: 'qemu32', label: 'qemu32' },
|
88
|
+
{ value: 'qemu64', label: 'qemu64' },
|
89
|
+
{ value: 'Conroe', label: 'Conroe' },
|
90
|
+
{ value: 'Penryn', label: 'Penryn' },
|
91
|
+
{ value: 'Nehalem', label: 'Nehalem' },
|
92
|
+
{ value: 'Westmere', label: 'Westmere' },
|
93
|
+
{ value: 'SandyBridge', label: 'SandyBridge' },
|
94
|
+
{ value: 'IvyBridge', label: 'IvyBridge' },
|
95
|
+
{ value: 'Haswell', label: 'Haswell' },
|
96
|
+
{ value: 'Haswell-noTSX', label: 'Haswell-noTSX' },
|
97
|
+
{ value: 'Broadwell', label: 'Broadwell' },
|
98
|
+
{ value: 'Broadwell-noTSX', label: 'Broadwell-noTSX' },
|
99
|
+
{ value: 'Skylake-Client', label: 'Skylake-Client' },
|
100
|
+
{ value: 'Opteron_G1', label: 'Opteron_G1' },
|
101
|
+
{ value: 'Opteron_G2', label: 'Opteron_G2' },
|
102
|
+
{ value: 'Opteron_G3', label: 'Opteron_G3' },
|
103
|
+
{ value: 'Opteron_G4', label: 'Opteron_G4' },
|
104
|
+
{ value: 'Opteron_G5', label: 'Opteron_G5' },
|
105
|
+
{ value: 'host', label: 'host' },
|
106
|
+
],
|
107
|
+
|
108
|
+
proxmoxCpuFlagsMap: [
|
109
|
+
{ value: '-1', label: 'Off' },
|
110
|
+
{ value: '0', label: 'Default' },
|
111
|
+
{ value: '+1', label: 'On' },
|
112
|
+
],
|
113
|
+
|
114
|
+
proxmoxScsihwMap: [
|
115
|
+
{ value: 'lsi', label: 'lsi' },
|
116
|
+
{ value: 'lsi53c810', label: 'lsi53c810' },
|
117
|
+
{ value: 'megasas', label: 'megasas' },
|
118
|
+
{ value: 'virtio-scsi-pci', label: 'virtio-scsi-pci' },
|
119
|
+
{ value: 'virtio-scsi-single', label: 'virtio-scsi-single' },
|
120
|
+
{ value: 'pvscsi', label: 'pvscsi' },
|
121
|
+
],
|
122
|
+
|
123
|
+
proxmoxNetworkcardsMap: [
|
124
|
+
{ value: 'e1000', label: 'Intel E1000' },
|
125
|
+
{ value: 'virtio', label: 'VirtIO (paravirtualized)' },
|
126
|
+
{ value: 'rtl8139', label: 'Realtek RTL8139' },
|
127
|
+
{ value: 'vmxnet3', label: 'VMware vmxnet3' },
|
128
|
+
],
|
129
|
+
|
130
|
+
proxmoxBiosMap: [
|
131
|
+
{ value: 'seabios', label: '(Default) Seabios' },
|
132
|
+
{ value: 'ovmf', label: 'OVMF (UEFI)' },
|
133
|
+
],
|
134
|
+
};
|
135
|
+
|
136
|
+
ProxmoxComputeSelectors.proxmoxControllersHDDMap = [
|
137
|
+
...ProxmoxComputeSelectors.proxmoxControllersCloudinitMap,
|
138
|
+
{ value: 'virtio', label: 'VirtIO Block' },
|
139
|
+
];
|
140
|
+
|
141
|
+
export default ProxmoxComputeSelectors;
|