foreman_nutanix 0.0.3 → 0.0.5
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 +9 -1
- data/app/models/foreman_nutanix/nutanix.rb +7 -7
- data/app/models/foreman_nutanix/nutanix_compute.rb +19 -4
- data/app/views/compute_resources/show/_nutanix.html.erb +0 -3
- data/app/views/compute_resources_vms/form/nutanix/_base.html.erb +37 -10
- 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 +4 -5
- data/app/views/compute_resources_vms/form/nutanix/_volume.html.erb +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f2fe33e8b9f7999fbd374d6dfa10f3c52005004299dfe6b7003c297d46e46d3a
|
|
4
|
+
data.tar.gz: ca98e7a92c0a5867d1c637d41e825df7c840e515098f75246a6d2fe7cc57a5fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48bd46610653b7629b1c28c1cd3fceb44bd65e3131d36964c1b6f9376db1810d116a935072f31aa074faaefbcf8d94cd6d27baaabf1dc4035719bc66b2a0686e
|
|
7
|
+
data.tar.gz: 45a9ee8ce535a062ed664264533ecb17e28e24c5b8eec1956d27dfd9dbbfa82d288e0b0b1bfcb24d5d4458b84fa800d335eb47ecf47c9290f25b5997da18a2f0
|
|
@@ -23,6 +23,10 @@ module ForemanNutanix
|
|
|
23
23
|
NutanixCompute.new(@cluster, attrs)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
def each(&block)
|
|
27
|
+
all.each(&block)
|
|
28
|
+
end
|
|
29
|
+
|
|
26
30
|
def get(uuid)
|
|
27
31
|
Rails.logger.info "=== NUTANIX: ServersCollection::get called with uuid: #{uuid} ==="
|
|
28
32
|
|
|
@@ -43,12 +47,16 @@ module ForemanNutanix
|
|
|
43
47
|
vm = NutanixCompute.new(@cluster, {
|
|
44
48
|
identity: data['ext_id'],
|
|
45
49
|
name: data['name'],
|
|
50
|
+
description: data['description'],
|
|
46
51
|
cpus: total_cpus,
|
|
47
52
|
memory: memory_gb,
|
|
48
53
|
power_state: data['power_state'],
|
|
49
54
|
mac_address: data['mac_address'],
|
|
50
55
|
ip_addresses: data['ip_addresses'] || [],
|
|
51
56
|
create_time: data['create_time'],
|
|
57
|
+
boot_method: data['boot_method'],
|
|
58
|
+
secure_boot: data['secure_boot'],
|
|
59
|
+
gpus: data['gpus'],
|
|
52
60
|
})
|
|
53
61
|
vm.instance_variable_set(:@persisted, true)
|
|
54
62
|
vm
|
|
@@ -85,6 +93,7 @@ module ForemanNutanix
|
|
|
85
93
|
vm = NutanixCompute.new(@cluster, {
|
|
86
94
|
identity: vm_data['ext_id'],
|
|
87
95
|
name: vm_data['name'],
|
|
96
|
+
description: vm_data['description'],
|
|
88
97
|
cpus: total_cpus,
|
|
89
98
|
memory: memory_gb,
|
|
90
99
|
power_state: vm_data['power_state'],
|
|
@@ -102,4 +111,3 @@ module ForemanNutanix
|
|
|
102
111
|
end
|
|
103
112
|
end
|
|
104
113
|
end
|
|
105
|
-
|
|
@@ -70,6 +70,13 @@ module ForemanNutanix
|
|
|
70
70
|
[]
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
def available_boot_methods
|
|
74
|
+
[
|
|
75
|
+
OpenStruct.new({ id: 'uefi', name: 'UEFI' }),
|
|
76
|
+
OpenStruct.new({ id: 'bios', name: 'BIOS' }),
|
|
77
|
+
]
|
|
78
|
+
end
|
|
79
|
+
|
|
73
80
|
# Available networks for VMs
|
|
74
81
|
def available_networks
|
|
75
82
|
Rails.logger.info '=== NUTANIX: Fetching available networks from shim server ==='
|
|
@@ -149,13 +156,6 @@ module ForemanNutanix
|
|
|
149
156
|
nil
|
|
150
157
|
end
|
|
151
158
|
|
|
152
|
-
# Available machine types/flavors
|
|
153
|
-
def available_flavors
|
|
154
|
-
Rails.logger.info '=== NUTANIX: Returning available flavors ==='
|
|
155
|
-
[OpenStruct.new({ id: 'small', name: 'Small (2 CPU, 4GB RAM)' })]
|
|
156
|
-
end
|
|
157
|
-
alias_method :machine_types, :available_flavors
|
|
158
|
-
|
|
159
159
|
# Available images
|
|
160
160
|
def available_images(_opts = {})
|
|
161
161
|
Rails.logger.info '=== NUTANIX: Fetching available images from shim server ==='
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
module ForemanNutanix
|
|
2
2
|
class NutanixCompute
|
|
3
3
|
attr_reader :identity, :name, :hostname, :cluster, :args
|
|
4
|
-
attr_accessor :zone, :machine_type,
|
|
4
|
+
attr_accessor :zone, :machine_type,
|
|
5
|
+
:network, :image_id, :associate_external_ip,
|
|
6
|
+
:cpus, :memory, :power_state, :subnet_ext_id,
|
|
7
|
+
:storage_container_ext_id, :num_sockets, :num_cores_per_socket,
|
|
8
|
+
:disk_size_bytes, :description, :network_id, :storage_container,
|
|
9
|
+
:disk_size_gb, :power_on, :mac_address, :vm_ip_addresses, :create_time,
|
|
10
|
+
:boot_method, :secure_boot, :gpus
|
|
5
11
|
|
|
6
12
|
def initialize(cluster = nil, args = {})
|
|
7
13
|
Rails.logger.info "=== NUTANIX: NutanixCompute::initialize cluster=#{cluster} args=#{args} ==="
|
|
@@ -36,6 +42,13 @@ module ForemanNutanix
|
|
|
36
42
|
@mac_address = args[:mac_address]
|
|
37
43
|
@vm_ip_addresses = args[:ip_addresses] || []
|
|
38
44
|
@create_time = args[:create_time]
|
|
45
|
+
|
|
46
|
+
# Boot config
|
|
47
|
+
@boot_method = args[:boot_method]
|
|
48
|
+
@secure_boot = args[:secure_boot]
|
|
49
|
+
|
|
50
|
+
# GPUs
|
|
51
|
+
@gpus = args[:gpus]
|
|
39
52
|
end
|
|
40
53
|
|
|
41
54
|
# Required by Foreman - indicates if VM exists
|
|
@@ -77,6 +90,8 @@ module ForemanNutanix
|
|
|
77
90
|
disk_size_bytes: actual_disk_bytes.to_i,
|
|
78
91
|
description: @description || '',
|
|
79
92
|
power_on: @power_on.nil? || @power_on, # Default to true if not set
|
|
93
|
+
secure_boot: @secure_boot,
|
|
94
|
+
boot_method: @boot_method,
|
|
80
95
|
}
|
|
81
96
|
|
|
82
97
|
Rails.logger.info "=== NUTANIX: Provisioning VM with request: #{provision_request} ==="
|
|
@@ -308,13 +323,14 @@ module ForemanNutanix
|
|
|
308
323
|
# Required by Foreman - pretty machine type
|
|
309
324
|
def pretty_machine_type
|
|
310
325
|
Rails.logger.info '=== NUTANIX: NutanixCompute::pretty_machine_type called ==='
|
|
311
|
-
"#{@cpus} CPUs
|
|
326
|
+
"#{@cpus} CPUs \t|\t #{memory}GB RAM \t|\t #{disk_size_gb}GB Disk"
|
|
312
327
|
end
|
|
313
328
|
|
|
314
329
|
# Required by Foreman - volumes/disks
|
|
315
330
|
def volumes
|
|
316
331
|
Rails.logger.info '=== NUTANIX: NutanixCompute::volumes called ==='
|
|
317
|
-
[OpenStruct.new({ name: 'disk-1', size_gb: 20 })]
|
|
332
|
+
# [OpenStruct.new({ name: 'disk-1', size_gb: 20 })]
|
|
333
|
+
[]
|
|
318
334
|
end
|
|
319
335
|
|
|
320
336
|
# Required by Foreman - volumes_attributes setter
|
|
@@ -367,4 +383,3 @@ module ForemanNutanix
|
|
|
367
383
|
end
|
|
368
384
|
end
|
|
369
385
|
end
|
|
370
|
-
|
|
@@ -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,
|
|
@@ -31,14 +36,6 @@ compute_resource.available_storage_containers,
|
|
|
31
36
|
help_inline: _("Storage container for VM disks"),
|
|
32
37
|
} %>
|
|
33
38
|
|
|
34
|
-
<%= select_f f,
|
|
35
|
-
:machine_type,
|
|
36
|
-
compute_resource.available_flavors,
|
|
37
|
-
:id,
|
|
38
|
-
:name,
|
|
39
|
-
{ include_blank: _("Select Flavor") },
|
|
40
|
-
{ label: _("Machine Type"), help_inline: _("VM size template (optional)") } %>
|
|
41
|
-
|
|
42
39
|
<%= counter_f f,
|
|
43
40
|
:cpus,
|
|
44
41
|
{ label: _("CPUs"), help_inline: _("Number of CPU cores"), min: 1, max: 32 } %>
|
|
@@ -52,12 +49,13 @@ compute_resource.available_flavors,
|
|
|
52
49
|
max: 64,
|
|
53
50
|
} %>
|
|
54
51
|
|
|
55
|
-
<%=
|
|
52
|
+
<%= counter_f f,
|
|
56
53
|
:disk_size_gb,
|
|
57
54
|
{
|
|
58
55
|
label: _("Disk Size (GB)"),
|
|
59
56
|
help_inline: _("Size of the boot disk in GB"),
|
|
60
|
-
|
|
57
|
+
min: 2,
|
|
58
|
+
max: 10_000,
|
|
61
59
|
} %>
|
|
62
60
|
|
|
63
61
|
<%= checkbox_f f,
|
|
@@ -70,3 +68,32 @@ compute_resource.available_flavors,
|
|
|
70
68
|
),
|
|
71
69
|
checked: true,
|
|
72
70
|
} %>
|
|
71
|
+
|
|
72
|
+
<%= select_f f,
|
|
73
|
+
:boot_method,
|
|
74
|
+
compute_resource.available_boot_methods,
|
|
75
|
+
:id,
|
|
76
|
+
:name,
|
|
77
|
+
{ include_blank: _("Select boot method") },
|
|
78
|
+
{
|
|
79
|
+
label: _("Boot method"),
|
|
80
|
+
help_inline: _("Select boot method"),
|
|
81
|
+
id: "boot-method-select",
|
|
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.5
|
|
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-
|
|
11
|
+
date: 2025-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rdoc
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
version: '0'
|
|
27
27
|
description: Nutanix compute resource plugin for Foreman
|
|
28
28
|
email:
|
|
29
|
-
-
|
|
29
|
+
- mgra@norceresearch.no
|
|
30
30
|
executables: []
|
|
31
31
|
extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
|
@@ -48,7 +48,6 @@ files:
|
|
|
48
48
|
- app/views/compute_resources/form/_nutanix.html.erb
|
|
49
49
|
- app/views/compute_resources/show/_nutanix.html.erb
|
|
50
50
|
- app/views/compute_resources_vms/form/nutanix/_base.html.erb
|
|
51
|
-
- app/views/compute_resources_vms/form/nutanix/_volume.html.erb
|
|
52
51
|
- app/views/compute_resources_vms/index/_nutanix.html.erb
|
|
53
52
|
- app/views/compute_resources_vms/show/_nutanix.html.erb
|
|
54
53
|
- config/initializers/zeitwerk.rb
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= text_f f, :size_gb, class: "col-md-2", label: _("Size (GB)"), label_size: "col-md-2", onchange: 'tfm.computeResource.capacityEdit(this)' %>
|