foreman_nutanix 0.0.4 → 0.0.6
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/lib/foreman_nutanix/nutanix_adapter.rb +7 -0
- data/app/models/foreman_nutanix/nutanix.rb +2 -1
- data/app/models/foreman_nutanix/nutanix_compute.rb +5 -2
- data/app/views/compute_resources_vms/form/nutanix/_base.html.erb +25 -6
- data/app/views/compute_resources_vms/index/_nutanix.html.erb +16 -2
- data/app/views/compute_resources_vms/show/_nutanix.html.erb +16 -0
- data/lib/foreman_nutanix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 649b828adcd2f71eb4948c2a005a5fd3e21c251588d16e55160d34b34436e7a4
|
|
4
|
+
data.tar.gz: '0729eac7438b5956415018a158a3097f190952f308986f64be2a69a63081cdb1'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d29846a1f3416fd5a96567d438a77baa6310ba3afedc00aee27edf2e5bcf1a4f419aca4c3b08deb03df49612d9a2298f074a3d80ad5600a4adbfc8c5f40e098
|
|
7
|
+
data.tar.gz: 72c26e9df3cceb9678a20214f545acca131ba732757a10daf6ac6bc2fce1479bdfc49f8030295623c6555a76d6b7aa2e485bf8f131caec36b204416104dfaec3
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
module ForemanNutanix
|
|
2
2
|
class NutanixAdapter
|
|
3
|
+
include Enumerable
|
|
4
|
+
|
|
3
5
|
def initialize(cluster)
|
|
4
6
|
Rails.logger.info "=== NUTANIX: NutanixAdapter::initialize cluster=#{cluster} ==="
|
|
5
7
|
@cluster = cluster
|
|
@@ -47,12 +49,16 @@ module ForemanNutanix
|
|
|
47
49
|
vm = NutanixCompute.new(@cluster, {
|
|
48
50
|
identity: data['ext_id'],
|
|
49
51
|
name: data['name'],
|
|
52
|
+
description: data['description'],
|
|
50
53
|
cpus: total_cpus,
|
|
51
54
|
memory: memory_gb,
|
|
52
55
|
power_state: data['power_state'],
|
|
53
56
|
mac_address: data['mac_address'],
|
|
54
57
|
ip_addresses: data['ip_addresses'] || [],
|
|
55
58
|
create_time: data['create_time'],
|
|
59
|
+
boot_method: data['boot_method'],
|
|
60
|
+
secure_boot: data['secure_boot'],
|
|
61
|
+
gpus: data['gpus'],
|
|
56
62
|
})
|
|
57
63
|
vm.instance_variable_set(:@persisted, true)
|
|
58
64
|
vm
|
|
@@ -89,6 +95,7 @@ module ForemanNutanix
|
|
|
89
95
|
vm = NutanixCompute.new(@cluster, {
|
|
90
96
|
identity: vm_data['ext_id'],
|
|
91
97
|
name: vm_data['name'],
|
|
98
|
+
description: vm_data['description'],
|
|
92
99
|
cpus: total_cpus,
|
|
93
100
|
memory: memory_gb,
|
|
94
101
|
power_state: vm_data['power_state'],
|
|
@@ -425,7 +425,8 @@ module ForemanNutanix
|
|
|
425
425
|
# Associate host with VM
|
|
426
426
|
def associated_host(vm)
|
|
427
427
|
Rails.logger.info "=== NUTANIX: ASSOCIATED_HOST CALLED for vm: #{vm.name} ==="
|
|
428
|
-
|
|
428
|
+
macs = vm.interfaces.map(&:mac)
|
|
429
|
+
associate_by('mac', macs)
|
|
429
430
|
end
|
|
430
431
|
|
|
431
432
|
# User data support
|
|
@@ -7,7 +7,7 @@ module ForemanNutanix
|
|
|
7
7
|
:storage_container_ext_id, :num_sockets, :num_cores_per_socket,
|
|
8
8
|
:disk_size_bytes, :description, :network_id, :storage_container,
|
|
9
9
|
:disk_size_gb, :power_on, :mac_address, :vm_ip_addresses, :create_time,
|
|
10
|
-
:boot_method, :secure_boot
|
|
10
|
+
:boot_method, :secure_boot, :gpus
|
|
11
11
|
|
|
12
12
|
def initialize(cluster = nil, args = {})
|
|
13
13
|
Rails.logger.info "=== NUTANIX: NutanixCompute::initialize cluster=#{cluster} args=#{args} ==="
|
|
@@ -46,6 +46,9 @@ module ForemanNutanix
|
|
|
46
46
|
# Boot config
|
|
47
47
|
@boot_method = args[:boot_method]
|
|
48
48
|
@secure_boot = args[:secure_boot]
|
|
49
|
+
|
|
50
|
+
# GPUs
|
|
51
|
+
@gpus = args[:gpus]
|
|
49
52
|
end
|
|
50
53
|
|
|
51
54
|
# Required by Foreman - indicates if VM exists
|
|
@@ -320,7 +323,7 @@ module ForemanNutanix
|
|
|
320
323
|
# Required by Foreman - pretty machine type
|
|
321
324
|
def pretty_machine_type
|
|
322
325
|
Rails.logger.info '=== NUTANIX: NutanixCompute::pretty_machine_type called ==='
|
|
323
|
-
"#{@cpus} CPUs
|
|
326
|
+
"#{@cpus} CPUs \t|\t #{memory}GB RAM \t|\t #{disk_size_gb}GB Disk"
|
|
324
327
|
end
|
|
325
328
|
|
|
326
329
|
# Required by Foreman - volumes/disks
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<%= compute_specific_js(compute_resource, "host_edit") %>
|
|
2
2
|
<%= javascript "hosts", "host_edit", "host_edit_interfaces" %>
|
|
3
3
|
|
|
4
|
+
<%= text_f f,
|
|
5
|
+
:description,
|
|
6
|
+
label: _("Description"),
|
|
7
|
+
help_inline: _("Description for VM in Nutanix") %>
|
|
8
|
+
|
|
4
9
|
<%= select_f f,
|
|
5
10
|
:image_id,
|
|
6
11
|
compute_resource.available_images,
|
|
@@ -70,11 +75,25 @@ compute_resource.available_boot_methods,
|
|
|
70
75
|
:id,
|
|
71
76
|
:name,
|
|
72
77
|
{ include_blank: _("Select boot method") },
|
|
73
|
-
{ label: _("Boot method"), help_inline: _("Select boot method") } %>
|
|
74
|
-
|
|
75
|
-
<%= checkbox_f f,
|
|
76
|
-
:secure_boot,
|
|
77
78
|
{
|
|
78
|
-
label: _("
|
|
79
|
-
help_inline: _("
|
|
79
|
+
label: _("Boot method"),
|
|
80
|
+
help_inline: _("Select boot method"),
|
|
81
|
+
id: "boot-method-select",
|
|
80
82
|
} %>
|
|
83
|
+
|
|
84
|
+
<div id="uefi-options" class="hidden">
|
|
85
|
+
<%= checkbox_f f,
|
|
86
|
+
:secure_boot,
|
|
87
|
+
{ label: _("Secure Boot"), help_inline: _("Enable secure boot") } %>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<script>
|
|
91
|
+
var $bootMethod = $('#boot-method-select');
|
|
92
|
+
|
|
93
|
+
function toggleUefiOptions() {
|
|
94
|
+
$('#uefi-options').toggleClass('hidden', $bootMethod.val() !== 'uefi');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
toggleUefiOptions();
|
|
98
|
+
$bootMethod.on('change', toggleUefiOptions);
|
|
99
|
+
</script>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<thead>
|
|
2
2
|
<tr>
|
|
3
3
|
<th><%= _("Name") %></th>
|
|
4
|
-
<th><%= _("
|
|
4
|
+
<th><%= _("Description") %></th>
|
|
5
|
+
<th><%= _("CPUs") %></th>
|
|
6
|
+
<th><%= _("Memory (GB)") %></th>
|
|
7
|
+
<th><%= _("Disk Size (GB)") %></th>
|
|
8
|
+
<th><%= _("GPUs") %></th>
|
|
5
9
|
<th><%= _("State") %></th>
|
|
6
10
|
<th><%= _("Actions") %></th>
|
|
7
11
|
</tr>
|
|
@@ -26,7 +30,17 @@
|
|
|
26
30
|
) %>
|
|
27
31
|
<tr>
|
|
28
32
|
<td><%= link_to_if_authorized vm.name, view_path %></td>
|
|
29
|
-
<td><%= vm.
|
|
33
|
+
<td><%= vm.description %></td>
|
|
34
|
+
<td><%= vm.cpus %></td>
|
|
35
|
+
<td><%= vm.memory %></td>
|
|
36
|
+
<td><%= vm.disk_size_gb %></td>
|
|
37
|
+
<td>
|
|
38
|
+
<% if vm.gpus.empty? %>
|
|
39
|
+
<input type="checkbox" disabled/>
|
|
40
|
+
<% else %>
|
|
41
|
+
<input type="checkbox" disabled checked/>
|
|
42
|
+
<% end %>
|
|
43
|
+
</td>
|
|
30
44
|
<td><%= vm.status.downcase %></td>
|
|
31
45
|
<td>
|
|
32
46
|
<%= action_buttons(
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
<td><%= _("Name") %></td>
|
|
7
7
|
<td><%= @vm.name %></td>
|
|
8
8
|
</tr>
|
|
9
|
+
<tr>
|
|
10
|
+
<td><%= _("Description") %></td>
|
|
11
|
+
<td><%= @vm.description %></td>
|
|
12
|
+
</tr>
|
|
9
13
|
<tr>
|
|
10
14
|
<td><%= _("Created") %></td>
|
|
11
15
|
<td><%= if @vm.creation_timestamp
|
|
@@ -39,6 +43,18 @@
|
|
|
39
43
|
<td><%= _("IP Addresses") %></td>
|
|
40
44
|
<td><%= @vm.ip_addresses.join(", ") if @vm.ip_addresses.any? %></td>
|
|
41
45
|
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td><%= _("Boot Method") %></td>
|
|
48
|
+
<td><%= @vm.boot_method %></td>
|
|
49
|
+
</tr>
|
|
50
|
+
<tr>
|
|
51
|
+
<td><%= _("Secure Boot Enabled (UEFI only)") %></td>
|
|
52
|
+
<td><%= @vm.secure_boot %></td>
|
|
53
|
+
</tr>
|
|
54
|
+
<tr>
|
|
55
|
+
<td><%= _("GPUs") %></td>
|
|
56
|
+
<td><%= @vm.gpus %></td>
|
|
57
|
+
</tr>
|
|
42
58
|
</tbody>
|
|
43
59
|
</table>
|
|
44
60
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_nutanix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Granger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-12-
|
|
11
|
+
date: 2025-12-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rdoc
|