Skip to content

Commit

Permalink
Optimize secure boot support and firmware handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nofaralfasi committed Jul 25, 2024
1 parent 97a27f0 commit 70a7347
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/fog/vsphere/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ module Shared
parent: 'parent',
hostname: 'summary.guest.hostName',
operatingsystem: 'summary.guest.guestFullName',
virtual_tpm: 'summary.config.tpmPresent',
ipaddress: 'guest.ipAddress',
power_state: 'runtime.powerState',
connection_state: 'runtime.connectionState',
Expand All @@ -170,6 +171,7 @@ module Shared
cpuHotAddEnabled: 'config.cpuHotAddEnabled',
memoryHotAddEnabled: 'config.memoryHotAddEnabled',
firmware: 'config.firmware',
secure_boot: 'config.bootOptions.efiSecureBootEnabled',
boot_order: 'config.bootOptions.bootOrder',
annotation: 'config.annotation',
extra_config: 'config.extraConfig'
Expand Down
6 changes: 2 additions & 4 deletions lib/fog/vsphere/requests/compute/create_vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_vm(attributes = {})
vm_cfg[:cpuHotAddEnabled] = attributes[:cpuHotAddEnabled] if attributes.key?(:cpuHotAddEnabled)
vm_cfg[:memoryHotAddEnabled] = attributes[:memoryHotAddEnabled] if attributes.key?(:memoryHotAddEnabled)
vm_cfg[:firmware] = attributes[:firmware] if attributes.key?(:firmware)
vm_cfg[:bootOptions] = boot_options(attributes, vm_cfg) if attributes.key?(:boot_order) || attributes.key?(:boot_retry)
vm_cfg[:bootOptions] = boot_options(attributes, vm_cfg)
resource_pool = if attributes[:resource_pool] && attributes[:resource_pool] != 'Resources'
get_raw_resource_pool(attributes[:resource_pool], attributes[:cluster], attributes[:datacenter])
else
Expand Down Expand Up @@ -169,9 +169,7 @@ def boot_options(attributes, vm_cfg)
options[:bootRetryDelay] = attributes[:boot_retry]
end

if attributes[:secure_boot]
options[:efiSecureBootEnabled] = true
end
options[:efiSecureBootEnabled] = attributes[:secure_boot] if attributes.key?(:secure_boot)

options.empty? ? nil : RbVmomi::VIM::VirtualMachineBootOptions.new(options)
end
Expand Down

0 comments on commit 70a7347

Please sign in to comment.