foreman_fog_proxmox 0.14.3 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +56 -9
- 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_vms_helper.rb +6 -1
- data/app/helpers/proxmox_vm_cloudinit_helper.rb +99 -0
- data/app/models/foreman_fog_proxmox/proxmox.rb +1 -1
- data/app/models/foreman_fog_proxmox/proxmox_console.rb +1 -1
- data/app/models/foreman_fog_proxmox/proxmox_interfaces.rb +0 -2
- data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +6 -2
- data/app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb +1 -11
- data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +17 -6
- data/app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb +1 -9
- data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +14 -7
- data/app/views/compute_resources_vms/form/proxmox/server/_volume_hard_disk.html.erb +4 -1
- data/app/views/compute_resources_vms/index/_proxmox.html.erb +1 -0
- data/lib/foreman_fog_proxmox/version.rb +1 -1
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb26099667e555c1234f7a330cf9914f6efc3c874b22cd2dbff180f1e544ebc
|
4
|
+
data.tar.gz: 4c7dc234f8e677f91c898cd9bb1fa52bd5d074998481aeeee7fde0c64a6ef4d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c1585871bc12fd7b7d6a806dc42c1ae975e4c79765d0a753a9823a2a7c0919e3e7a5b4997217b441f98b208d025166a0ce7f25411c9b058bc874dfd2786a4cb
|
7
|
+
data.tar.gz: 0b6d569fb3dfb400f65caf1fedf74e03d7044a3158c98ad9daee258860b9080362431e250ddd49fa79d2e75f7a852ab0dd972029a45e54bcfc20b59eb8dacd19
|
@@ -23,18 +23,21 @@ function vmTypeSelected() {
|
|
23
23
|
var host_uuid = $("input[id='host_uuid']").val();
|
24
24
|
var new_vm = host_uuid == undefined;
|
25
25
|
var fieldsets = [];
|
26
|
+
var fieldconfig = [];
|
26
27
|
fieldsets.push({id: 'config_advanced_options', toggle: true, new_vm: new_vm, selected: selected});
|
27
28
|
fieldsets.push({id: 'config_ext', toggle: true, new_vm: new_vm, selected: selected});
|
28
29
|
fieldsets.push({id: 'volume', toggle: true, new_vm: new_vm, selected: selected});
|
29
30
|
fieldsets.push({id: 'network', toggle: true, new_vm: true, selected: selected});
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
fieldconfig.push({id: 'config_options', new_vm: new_vm, selected: selected});
|
32
|
+
fieldconfig.push({id: 'config_cpu', new_vm: new_vm, selected: selected});
|
33
|
+
fieldconfig.push({id: 'config_memory', new_vm: new_vm, selected: selected});
|
34
|
+
fieldconfig.push({id: 'config_cdrom', new_vm: new_vm, selected: selected});
|
35
|
+
fieldconfig.push({id: 'config_os', new_vm: new_vm, selected: selected});
|
36
|
+
fieldconfig.push({id: 'config_dns', new_vm: new_vm, selected: selected});
|
36
37
|
fieldsets.forEach(toggleFieldsets);
|
37
38
|
toggleVolumes(selected);
|
39
|
+
fieldconfig.forEach(toggleConfigs);
|
40
|
+
toggleAccordions();
|
38
41
|
return false;
|
39
42
|
}
|
40
43
|
|
@@ -134,7 +137,7 @@ function enableFieldset(fieldsetId, fieldset) {
|
|
134
137
|
input_hidden_id(fieldsetId).removeAttr('disabled');
|
135
138
|
}
|
136
139
|
|
137
|
-
function disableFieldset(fieldsetId, fieldset) {
|
140
|
+
function disableFieldset(fieldsetId, fieldset) {
|
138
141
|
if (fieldset.toggle && fieldset.new_vm){
|
139
142
|
fieldset_id(fieldsetId, fieldset).hide();
|
140
143
|
}
|
@@ -142,7 +145,7 @@ function disableFieldset(fieldsetId, fieldset) {
|
|
142
145
|
input_hidden_id(fieldsetId).attr('disabled','disabled');
|
143
146
|
}
|
144
147
|
|
145
|
-
function toggleFieldset(fieldsetId, fieldset, type1, type2) {
|
148
|
+
function toggleFieldset(fieldsetId, fieldset, type1, type2) {
|
146
149
|
type1 === type2 ? enableFieldset(fieldsetId, fieldset) : disableFieldset(fieldsetId, fieldset);
|
147
150
|
}
|
148
151
|
|
@@ -160,7 +163,7 @@ function fieldsets(type){
|
|
160
163
|
|
161
164
|
function toggleFieldsets(fieldset){
|
162
165
|
var removable_input_hidden = $("div.removable-item[style='display: none;']" + " + input:hidden");
|
163
|
-
removable_input_hidden.attr('disabled','disabled');
|
166
|
+
removable_input_hidden.attr('disabled','disabled');
|
164
167
|
['qemu', 'lxc'].forEach(function(type){
|
165
168
|
fieldsets(type).forEach(function(fieldsetId){
|
166
169
|
toggleFieldset(fieldsetId, fieldset, fieldset.selected, type);
|
@@ -168,6 +171,50 @@ function toggleFieldsets(fieldset){
|
|
168
171
|
});
|
169
172
|
}
|
170
173
|
|
174
|
+
function toggleAccordions() {
|
175
|
+
$('.accordion-content').hide();
|
176
|
+
$('.accordion-section').off('click').on('click', function(event) {
|
177
|
+
var $content = $(this).find('.accordion-content');
|
178
|
+
$content.slideToggle();
|
179
|
+
$(this).toggleClass('active');
|
180
|
+
$('.accordion-content').not($content).slideUp();
|
181
|
+
$('.accordion-section').not($(this)).removeClass('active');
|
182
|
+
event.stopPropagation();
|
183
|
+
});
|
184
|
+
$('.accordion-content').on('click', function(event) {
|
185
|
+
event.stopPropagation();
|
186
|
+
});
|
187
|
+
}
|
188
|
+
|
189
|
+
function enableConfig(fieldsetId, fieldset) {
|
190
|
+
fieldset_id(fieldsetId, fieldset).removeClass('hide');
|
191
|
+
fieldset_id(fieldsetId, fieldset).removeAttr('disabled');
|
192
|
+
input_hidden_id(fieldsetId).removeAttr('disabled');
|
193
|
+
|
194
|
+
}
|
195
|
+
|
196
|
+
function disableConfig(fieldsetId, fieldset) {
|
197
|
+
fieldset_id(fieldsetId, fieldset).addClass('hide');
|
198
|
+
fieldset_id(fieldsetId, fieldset).attr('disabled','disabled');
|
199
|
+
input_hidden_id(fieldsetId).attr('disabled','disabled');
|
200
|
+
}
|
201
|
+
|
202
|
+
function toggleConfig(fieldsetId, fieldset, type1, type2) {
|
203
|
+
if (type1 === type2) {
|
204
|
+
enableConfig(fieldsetId, fieldset);
|
205
|
+
} else {
|
206
|
+
disableConfig(fieldsetId, fieldset);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
function toggleConfigs(fieldset){
|
211
|
+
['qemu', 'lxc'].forEach(function(type){
|
212
|
+
fieldsets(type).forEach(function(fieldsetId){
|
213
|
+
toggleConfig(fieldsetId, fieldset, fieldset.selected, type);
|
214
|
+
});
|
215
|
+
});
|
216
|
+
}
|
217
|
+
|
171
218
|
function nodeSelected(item) {
|
172
219
|
var node_id = $(item).val();
|
173
220
|
var type = $("#host_compute_attributes_type").val();
|
@@ -32,7 +32,7 @@ function getIndex(item) {
|
|
32
32
|
}
|
33
33
|
|
34
34
|
function isProfile() {
|
35
|
-
return $(volumesAttributesSelector(true,0,'id')) !== undefined;
|
35
|
+
return $(volumesAttributesSelector(true,0,'id')).val() !== undefined;
|
36
36
|
}
|
37
37
|
|
38
38
|
function controllerSelected(item) {
|
@@ -42,23 +42,43 @@ function controllerSelected(item) {
|
|
42
42
|
var profile = isProfile();
|
43
43
|
var device_selector = volumesAttributesSelector(profile,index,'device');
|
44
44
|
var id_selector = volumesAttributesSelector(profile,index,'id');
|
45
|
-
$(device_selector).
|
46
|
-
var device = $(device_selector).limitedSpinner('value');
|
45
|
+
var device = $(device_selector).val();
|
47
46
|
var id = controller + device;
|
47
|
+
validateDeviceLimit(device_selector, max);
|
48
48
|
$(id_selector).val(id);
|
49
49
|
}
|
50
50
|
|
51
51
|
function deviceSelected(item) {
|
52
|
-
var device = $(item).
|
52
|
+
var device = $(item).val();
|
53
53
|
var index = getIndex(item);
|
54
54
|
var profile = isProfile();
|
55
55
|
var controller_selector = volumesAttributesSelector(profile,index,'controller');
|
56
56
|
var id_selector = volumesAttributesSelector(profile,index,'id');
|
57
57
|
var controller = $(controller_selector).val();
|
58
58
|
var id = controller + device;
|
59
|
+
var max = computeControllerMaxDevice(controller);
|
60
|
+
validateDeviceLimit(item, max);
|
59
61
|
$(id_selector).val(id);
|
60
62
|
}
|
61
63
|
|
64
|
+
function validateDeviceLimit(item, maxLimit) {
|
65
|
+
var warningContainer = $(item).closest('form').find('.warning-container');
|
66
|
+
var deviceNumber = $(item).val();
|
67
|
+
var submitButton = $(item).closest('form').find('[data-disable-with]');
|
68
|
+
if (!isNaN(maxLimit) && !isNaN(deviceNumber) && deviceNumber > maxLimit) {
|
69
|
+
if (warningContainer.length === 0) {
|
70
|
+
warningContainer = $('<div class="warning-container" style="color: red;"><span style="color: red;">⚠</span> Warning: Value exceeds the maximum limit of ' + maxLimit + '.</div>');
|
71
|
+
$(item).closest('.col-md-4').append(warningContainer);
|
72
|
+
}
|
73
|
+
warningContainer.show();
|
74
|
+
submitButton.prop('disabled', true);
|
75
|
+
} else {
|
76
|
+
warningContainer.hide();
|
77
|
+
warningContainer.remove();
|
78
|
+
submitButton.prop('disabled', false);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
62
82
|
function computeControllerMaxDevice(controller) {
|
63
83
|
switch (controller) {
|
64
84
|
case 'ide':
|
@@ -72,4 +92,4 @@ function computeControllerMaxDevice(controller) {
|
|
72
92
|
default:
|
73
93
|
return 1;
|
74
94
|
}
|
75
|
-
}
|
95
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.accordion-section {
|
2
|
+
cursor: pointer;
|
3
|
+
}
|
4
|
+
|
5
|
+
.accordion-section > legend::before {
|
6
|
+
content: "\f054";
|
7
|
+
font-family: "Font Awesome 5 Free";
|
8
|
+
position: relative;
|
9
|
+
left: -1em;
|
10
|
+
top: 50%;
|
11
|
+
transform: translateY(-50%);
|
12
|
+
}
|
13
|
+
|
14
|
+
.accordion-section.active > legend::before {
|
15
|
+
content: "\f078";
|
16
|
+
font-family: "Font Awesome 5 Free";
|
17
|
+
position: relative;
|
18
|
+
left: -1em;
|
19
|
+
top: 50%;
|
20
|
+
transform: translateY(-50%);
|
21
|
+
}
|
@@ -41,6 +41,11 @@ module ProxmoxComputeResourcesVmsHelper
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def vm_associate_action(vm)
|
44
|
+
vm_associate_link(vm, link_class: "btn btn-default")
|
45
|
+
end
|
46
|
+
|
47
|
+
def vm_associate_link(vm, link_class: "")
|
48
|
+
return unless @compute_resource.supports_host_association?
|
44
49
|
display_link_if_authorized(
|
45
50
|
_('Associate VM'),
|
46
51
|
hash_for_associate_compute_resource_vm_path(
|
@@ -52,7 +57,7 @@ module ProxmoxComputeResourcesVmsHelper
|
|
52
57
|
),
|
53
58
|
:title => _('Associate VM to a Foreman host'),
|
54
59
|
:method => :put,
|
55
|
-
:class =>
|
60
|
+
:class => link_class
|
56
61
|
)
|
57
62
|
end
|
58
63
|
|
@@ -41,4 +41,103 @@ module ProxmoxVmCloudinitHelper
|
|
41
41
|
end
|
42
42
|
cloudinit_h
|
43
43
|
end
|
44
|
+
|
45
|
+
def create_cloudinit_iso(vm_name, configs, ssh)
|
46
|
+
iso = File.join(default_iso_path, "#{vm_name.tr('.', '_')}_cloudinit.iso")
|
47
|
+
files = []
|
48
|
+
wd = create_temp_directory(ssh)
|
49
|
+
|
50
|
+
configs.each do |config|
|
51
|
+
config_file = ssh.run(%(echo '#{config[1]}' >> "#{wd}/#{config[0]}"))
|
52
|
+
unless config_file.first.status.zero?
|
53
|
+
delete_temp_dir(ssh, wd)
|
54
|
+
raise ::Foreman::Exception, "Failed to create file #{config[0]}: #{config_file.first.stdout}"
|
55
|
+
end
|
56
|
+
files.append(File.join(wd, config[0]))
|
57
|
+
end
|
58
|
+
generated_iso = ssh.run(generate_iso_command(iso, files))
|
59
|
+
unless generated_iso.first.status.zero?
|
60
|
+
delete_temp_dir(ssh, wd)
|
61
|
+
raise Foreman::Exception, N_("ISO build failed: #{generated_iso.first.stdout}")
|
62
|
+
end
|
63
|
+
delete_temp_dir(ssh, wd)
|
64
|
+
iso
|
65
|
+
end
|
66
|
+
|
67
|
+
def generate_iso_command(iso_file, config_files)
|
68
|
+
arguments = ["genisoimage", "-output #{iso_file}", '-volid', 'cidata', '-joliet', '-rock']
|
69
|
+
iso_command = arguments.concat(config_files).join(' ')
|
70
|
+
logger.debug("iso image generation args: #{iso_command}")
|
71
|
+
iso_command
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_temp_directory(ssh)
|
75
|
+
res = ssh.run("mktemp -d")
|
76
|
+
raise ::Foreman::Exception, "Could not create working directory to store cloudinit config data: #{res.first.stdout}." unless res.first.status.zero?
|
77
|
+
res.first.stdout.chomp
|
78
|
+
end
|
79
|
+
|
80
|
+
def delete_temp_dir(ssh, working_dir)
|
81
|
+
ssh.run("rm -rf #{working_dir}")
|
82
|
+
rescue Foreman::Exception => e
|
83
|
+
logger.warn("Could not delete directory for config files: #{e}. Please delete it manually at #{working_dir}")
|
84
|
+
end
|
85
|
+
|
86
|
+
def parse_cloudinit_config(args)
|
87
|
+
filenames = ["meta-data"]
|
88
|
+
config_data = ["instance-id: #{args[:name]}"]
|
89
|
+
user_data = args.delete(:user_data)
|
90
|
+
return args if user_data == ''
|
91
|
+
check_template_format(user_data)
|
92
|
+
ssh = vm_ssh
|
93
|
+
|
94
|
+
if user_data.include?('#network-config') && user_data.include?('#cloud-config')
|
95
|
+
config_data.concat(user_data.split('#network-config'))
|
96
|
+
filenames.concat(['user-data', 'network-config'])
|
97
|
+
elsif user_data.include?('#network-config') && !user_data.include?('#cloud-config')
|
98
|
+
config_data.append(user_data.split('#network-config')[1])
|
99
|
+
filenames.append("network-config")
|
100
|
+
elsif !user_data.include?('#network-config') && user_data.include?('#cloud-config')
|
101
|
+
config_data.append(user_data)
|
102
|
+
filenames.append("user-data")
|
103
|
+
end
|
104
|
+
|
105
|
+
return args if config_data.length == 1
|
106
|
+
configs = filenames.zip(config_data).to_h
|
107
|
+
|
108
|
+
iso = create_cloudinit_iso(args[:name], configs, ssh)
|
109
|
+
args[:config_attributes]&.merge!(update_boot_order(args[:image_id]))
|
110
|
+
args.merge!(attach_cloudinit_iso(args[:node_id], iso))
|
111
|
+
end
|
112
|
+
|
113
|
+
def attach_cloudinit_iso(node, iso)
|
114
|
+
storage = storages(node, 'iso')[0]
|
115
|
+
volume = storage.volumes.detect { |v| v.volid.include? File.basename(iso) }
|
116
|
+
{ ide2: "#{volume.volid},media=cdrom" }
|
117
|
+
end
|
118
|
+
|
119
|
+
def default_iso_path
|
120
|
+
"/var/lib/vz/template/iso"
|
121
|
+
end
|
122
|
+
|
123
|
+
def update_boot_order(image_id)
|
124
|
+
vm = find_vm_by_uuid(image_id)
|
125
|
+
return if vm.disks.nil?
|
126
|
+
disks = vm.disks.map { |disk| disk.split(":")[0] }.join(";")
|
127
|
+
{ boot: "order=" + disks }
|
128
|
+
end
|
129
|
+
|
130
|
+
def vm_ssh
|
131
|
+
ssh = Fog::SSH.new(URI.parse(fog_credentials[:proxmox_url]).host, fog_credentials[:proxmox_username].split('@')[0], { password: fog_credentials[:proxmox_password] })
|
132
|
+
ssh.run('ls') # test if ssh is successful
|
133
|
+
ssh
|
134
|
+
rescue StandardError => e
|
135
|
+
raise ::Foreman::Exception, "Unable to ssh into proxmox server: #{e}"
|
136
|
+
end
|
137
|
+
|
138
|
+
def check_template_format(user_data)
|
139
|
+
YAML.safe_load(user_data)
|
140
|
+
rescue StandardError => e
|
141
|
+
raise ::Foreman::Exception, "'User data kind' template provided could not be loaded, please check the format: #{e}"
|
142
|
+
end
|
44
143
|
end
|
@@ -33,7 +33,7 @@ module ForemanFogProxmox
|
|
33
33
|
vnc_console = vm.start_console(options)
|
34
34
|
vmid = extract_vmid(uuid).to_i
|
35
35
|
vnc_host_port = vnc_console['port'].to_i + vmid
|
36
|
-
WsProxy.start(:host =>
|
36
|
+
WsProxy.start(:host => proxmox_host, :host_port => vnc_host_port, :password => vnc_console['ticket']).merge(
|
37
37
|
:name => vm.name, :type => type_console
|
38
38
|
)
|
39
39
|
rescue StandardError => e
|
@@ -32,10 +32,9 @@ module ForemanFogProxmox
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def create_vm(args = {})
|
35
|
-
vmid = args[:vmid].to_i
|
36
35
|
type = args[:type]
|
37
36
|
node = client.nodes.get(args[:node_id])
|
38
|
-
vmid =
|
37
|
+
vmid = args[:vmid] = assign_vmid(args[:vmid].to_i, node)
|
39
38
|
raise ::Foreman::Exception, format(N_('invalid vmid=%<vmid>s'), vmid: vmid) unless node.servers.id_valid?(vmid)
|
40
39
|
|
41
40
|
image_id = args[:image_id]
|
@@ -55,7 +54,12 @@ module ForemanFogProxmox
|
|
55
54
|
raise e
|
56
55
|
end
|
57
56
|
|
57
|
+
def assign_vmid(vmid, node)
|
58
|
+
vmid < 1 ? node.servers.next_id : vmid
|
59
|
+
end
|
60
|
+
|
58
61
|
def compute_clone_attributes(args, container, type)
|
62
|
+
args = parse_cloudinit_config(args) if args[:user_data]
|
59
63
|
parsed_args = parse_typed_vm(args, type)
|
60
64
|
if container
|
61
65
|
options = { :hostname => args[:name] }
|
@@ -18,14 +18,4 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
18
18
|
<% container = f.object.type == 'lxc' %>
|
19
19
|
|
20
20
|
<%= field_set_tag _("Advanced"), :id => "container_config_advanced_options", :class => ('hide' unless container) do %>
|
21
|
-
|
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 %>
|
21
|
+
<% end %>
|
@@ -16,26 +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
|
-
<%= field_set_tag n_("Main option", "Main options", 2), :id => "container_config_options", :class => '
|
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">
|
21
23
|
<%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
|
22
24
|
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
25
|
+
</div>
|
23
26
|
<% end %>
|
24
|
-
<%= field_set_tag _("CPU"), :id => "container_config_cpu", :class => '
|
27
|
+
<%= field_set_tag _("CPU"), :id => "container_config_cpu", :class => 'accordion-section', :disabled => !container do %>
|
28
|
+
<div class="accordion-content">
|
25
29
|
<%= select_f f, :arch, proxmox_archs_map, :id, :name, { }, :label => _('Architecture'), :label_size => "col-md-2" %>
|
26
30
|
<%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
|
27
31
|
<%= counter_f f, :cpulimit, :class => "input-mini", :label => _('CPU limit'), :label_size => "col-md-2" %>
|
28
32
|
<%= counter_f f, :cpuunits, :class => "input-mini", :label => _('CPU units'), :label_size => "col-md-2" %>
|
33
|
+
</div>
|
29
34
|
<% end %>
|
30
|
-
<%= field_set_tag _("Memory"), :id => "container_config_memory", :class => '
|
35
|
+
<%= field_set_tag _("Memory"), :id => "container_config_memory", :class => 'accordion-section', :disabled => !container do %>
|
36
|
+
<div class="accordion-content">
|
31
37
|
<%= text_f f, :memory, :class => "input-mini", :label => _('Memory (MB)'), :label_size => "col-md-2" %>
|
32
38
|
<%= text_f f, :swap, :class => "input-mini", :label => _('Swap (MB)'), :label_size => "col-md-2" %>
|
39
|
+
</div>
|
33
40
|
<% end %>
|
34
|
-
<%= field_set_tag _("DNS"), :id => "container_config_dns", :class => '
|
41
|
+
<%= field_set_tag _("DNS"), :id => "container_config_dns", :class => 'accordion-section', :disabled => !container do %>
|
42
|
+
<div class="accordion-content">
|
35
43
|
<%= text_f f, :hostname, :label => _('Hostname'), :label_size => "col-md-2", :disabled => true %>
|
36
44
|
<%= text_f f, :nameserver, :label => _('DNS server'), :label_size => "col-md-2" %>
|
37
45
|
<%= text_f f, :searchdomain, :label => _('Search domain'), :label_size => "col-md-2" %>
|
46
|
+
</div>
|
38
47
|
<% end %>
|
39
|
-
<%= field_set_tag _("Operating System"), :id => "container_config_os", :class => '
|
48
|
+
<%= field_set_tag _("Operating System"), :id => "container_config_os", :class => 'accordion-section', :disabled => !container do %>
|
49
|
+
<div class="accordion-content">
|
40
50
|
<%= select_f f, :ostype, proxmox_ostypes_map, :id, :name, { }, :label => _('OS type'), :label_size => "col-md-2" %>
|
41
|
-
|
51
|
+
</div>
|
52
|
+
<% end %>
|
@@ -18,12 +18,4 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
18
18
|
<% server = f.object.type == 'qemu' %>
|
19
19
|
|
20
20
|
<%= field_set_tag _("Advanced"), :id => "server_config_advanced_options", :class => ('hide' unless server) do %>
|
21
|
-
|
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_os', _("OS") %>
|
28
|
-
<%= check_box_tag 'show_server_config_os', '1', false, :onclick => "$('#server_config_os').toggle()" %>
|
29
|
-
<% end %>
|
21
|
+
<% end %>
|
@@ -16,11 +16,11 @@ 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
|
-
|
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
24
|
<%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
|
25
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
26
|
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
@@ -29,8 +29,10 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
29
29
|
<%= select_f f, :vga, proxmox_vgas_map, :id, :name, { :include_blank => true }, :label => _('VGA'), :label_size => "col-md-2" %>
|
30
30
|
<%= select_f f, :scsihw, proxmox_scsi_controllers_map, :id, :name, { }, :label => _('SCSI Controller'), :label_size => "col-md-2" %>
|
31
31
|
<%= select_f f, :bios, proxmox_bios_map, :id, :name, { }, :label => _('BIOS'), :label_size => "col-md-2" %>
|
32
|
+
</div>
|
32
33
|
<% end %>
|
33
|
-
<%= field_set_tag _("CPUs"), :id => "server_config_cpu", :class => '
|
34
|
+
<%= field_set_tag _("CPUs"), :id => "server_config_cpu", :class => 'accordion-section', :disabled => !server do %>
|
35
|
+
<div class="accordion-content">
|
34
36
|
<%= select_f f, :cpu_type, proxmox_cpus_map, :id, :name, { }, :label => _('Type'), :label_size => "col-md-2" %>
|
35
37
|
<%= counter_f f, :sockets, :class => "input-mini", :label => _('Sockets'), :label_size => "col-md-2" %>
|
36
38
|
<%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
|
@@ -43,14 +45,19 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
43
45
|
<%= select_f f, flag_key, proxmox_cpu_flags_map, :id, :name, { }, :label => _(flag_value) %>
|
44
46
|
<% end %>
|
45
47
|
<% end %>
|
48
|
+
</div>
|
46
49
|
<% end %>
|
47
|
-
<%= field_set_tag _("Memory"), :id => "server_config_memory", :class => '
|
50
|
+
<%= field_set_tag _("Memory"), :id => "server_config_memory", :class => 'accordion-section', :disabled => !server do %>
|
51
|
+
<div class="accordion-content">
|
48
52
|
<%= text_f f, :memory, :class => "input-mini", :label => _('Memory (MB)'), :label_size => "col-md-2" %>
|
49
53
|
<%= text_f f, :balloon, :class => "input-mini", :label => _('Minimum memory (MB)'), :label_size => "col-md-2" %>
|
50
54
|
<%= text_f f, :shares, :class => "input-mini", :label => _('Shares (MB)'), :label_size => "col-md-2" %>
|
55
|
+
</div>
|
51
56
|
<% end %>
|
52
|
-
<%= field_set_tag _("Operating System"), :id => "server_config_os", :class => '
|
57
|
+
<%= field_set_tag _("Operating System"), :id => "server_config_os", :class => 'accordion-section', :disabled => !server do %>
|
58
|
+
<div class="accordion-content">
|
53
59
|
<%= select_f f, :ostype, proxmox_operating_systems_map, :id, :name, { :include_blank => true }, :label => _('OS type'), :label_size => "col-md-2" %>
|
60
|
+
</div>
|
54
61
|
<% end %>
|
55
62
|
<%= field_set_tag _("Cloud-init"), :id => "server_config_cloud_init", :class => ('hide' unless cloudinit), :disabled => (!cloudinit) do %>
|
56
63
|
<%= text_f f, :ciuser, :label => _('User'), :label_size => "col-md-2" %>
|
@@ -58,4 +65,4 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
58
65
|
<%= text_f f, :searchdomain, :label => _('DNS domain'), :label_size => "col-md-2" %>
|
59
66
|
<%= text_f f, :nameserver, :label => _('DNS servers'), :label_size => "col-md-2" %>
|
60
67
|
<%= textarea_f f, :sshkeys, :label => _("SSH public key"), :size => "col-md-4" %>
|
61
|
-
<% end %>
|
68
|
+
<% 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 %>
|
@@ -41,6 +41,7 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
|
41
41
|
<td>
|
42
42
|
<%= action_buttons(
|
43
43
|
vm_power_action(vm, authorizer),
|
44
|
+
vm_associate_link(vm),
|
44
45
|
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.unique_cluster_identity(@compute_resource)).merge(:auth_object => @compute_resource, :authorizer => authorizer))) %>
|
45
46
|
</td>
|
46
47
|
</tr>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_fog_proxmox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Robert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: deface
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- app/assets/javascripts/foreman_fog_proxmox/proxmox_volume.js
|
115
115
|
- app/assets/javascripts/foreman_fog_proxmox/proxmox_volume_cdrom.js
|
116
116
|
- app/assets/javascripts/foreman_fog_proxmox/proxmox_volume_cloudinit.js
|
117
|
+
- app/assets/stylesheets/foreman_fog_proxmox/accordion.css
|
117
118
|
- app/controllers/concerns/foreman_fog_proxmox/compute_resources_vms_controller.rb
|
118
119
|
- app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb
|
119
120
|
- app/controllers/concerns/foreman_fog_proxmox/hosts_controller.rb
|
@@ -262,29 +263,29 @@ signing_key:
|
|
262
263
|
specification_version: 4
|
263
264
|
summary: Foreman plugin that adds Proxmox VE compute resource using fog-proxmox
|
264
265
|
test_files:
|
265
|
-
- test/
|
266
|
+
- test/test_plugin_helper.rb
|
266
267
|
- test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
|
267
268
|
- test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
|
269
|
+
- test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
|
268
270
|
- test/factories/proxmox_factory.rb
|
269
|
-
- test/unit/foreman_fog_proxmox/proxmox_test.rb
|
270
271
|
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
|
271
|
-
- test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
|
272
|
-
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_uuid_helper_test.rb
|
273
|
-
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
|
274
|
-
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_volumes_helper_test.rb
|
275
|
-
- test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
|
276
|
-
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
|
277
|
-
- test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
|
278
|
-
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_hard_disk_test.rb
|
279
272
|
- test/unit/foreman_fog_proxmox/proxmox_images_test.rb
|
280
|
-
- test/unit/foreman_fog_proxmox/
|
273
|
+
- test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
|
281
274
|
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb
|
282
|
-
- test/unit/foreman_fog_proxmox/proxmox_version_test.rb
|
283
275
|
- test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb
|
284
276
|
- test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb
|
285
|
-
- test/unit/foreman_fog_proxmox/
|
277
|
+
- test/unit/foreman_fog_proxmox/proxmox_test.rb
|
278
|
+
- test/unit/foreman_fog_proxmox/semver_test.rb
|
279
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cdrom_test.rb
|
280
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_hard_disk_test.rb
|
286
281
|
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb
|
282
|
+
- test/unit/foreman_fog_proxmox/proxmox_version_test.rb
|
283
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_cloudinit_test.rb
|
287
284
|
- test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb
|
288
|
-
- test/unit/foreman_fog_proxmox/
|
285
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
|
286
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_volumes_helper_test.rb
|
287
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
|
288
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
|
289
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
|
290
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_uuid_helper_test.rb
|
289
291
|
- test/functional/compute_resources_controller_test.rb
|
290
|
-
- test/test_plugin_helper.rb
|