Class: Fog::Hyperv::Compute::Firmware
- Defined in:
- lib/fog/hyperv/compute/models/firmware.rb
Overview
UEFI firmware settings for a VM
Instance Attribute Summary collapse
-
#boot_order ⇒ Array<String>
readonly
The boot order of the VM.
-
#computer_name ⇒ String
readonly
The name of the computer running the VM that this UEFI configuration is attached to.
-
#console_mode ⇒ :Default, ...
Where the console output should be directed.
-
#pause_after_boot_failure ⇒ :On, :Off
If the VM should pause after failing boot.
-
#preferred_network_boot_protocol ⇒ :IPv4, :IPv6
The preferred IP protocol for PXE.
-
#secure_boot ⇒ :On, :Off
If secure boot should be enabled.
-
#secure_boot_template ⇒ String
The template to use for the secure boot configuration.
-
#secure_boot_template_id ⇒ String
readonly
The template id to use for the secure boot configuration.
-
#vm_id ⇒ String
readonly
The GUID of the VM this UEFI configuration is attached to.
Instance Method Summary collapse
-
#reload ⇒ Object
Reload attributes from Hyper-V.
-
#update ⇒ Object
Save any modifications to Hyper-V.
Methods inherited from Model
#initialize, #merge_attributes
Methods included from ModelExtends
Methods included from ModelIncludes
#cluster, #computer, #dirty, #dirty?, #vm
Constructor Details
This class inherits a constructor from Fog::Hyperv::Model
Instance Attribute Details
#boot_order ⇒ Array<String> (readonly)
should be mapped to VM models; HDD/NIC/DVD, needs additional work
Returns the boot order of the VM.
18 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 18 attribute :boot_order |
#computer_name ⇒ String (readonly)
Returns the name of the computer running the VM that this UEFI configuration is attached to.
13 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 13 attribute :computer_name |
#console_mode ⇒ :Default, ...
Returns where the console output should be directed.
21 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 21 attribute :console_mode, type: :hypervenum, values: %i[Default COM1 COM2 None] |
#pause_after_boot_failure ⇒ :On, :Off
Returns if the VM should pause after failing boot.
38 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 38 attribute :pause_after_boot_failure, type: :hypervenum, values: Fog::Hyperv::ON_OFF_STATE_ENUM_VALUES |
#preferred_network_boot_protocol ⇒ :IPv4, :IPv6
Returns the preferred IP protocol for PXE.
24 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 24 attribute :preferred_network_boot_protocol, type: :hypervenum, values: %i[IPv4 IPv6] |
#secure_boot ⇒ :On, :Off
Returns if secure boot should be enabled.
27 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 27 attribute :secure_boot, type: :hypervenum, values: Fog::Hyperv::ON_OFF_STATE_ENUM_VALUES |
#secure_boot_template ⇒ String
Returns the template to use for the secure boot configuration.
31 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 31 attribute :secure_boot_template |
#secure_boot_template_id ⇒ String (readonly)
Returns the template id to use for the secure boot configuration.
35 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 35 attribute :secure_boot_template_id |
#vm_id ⇒ String (readonly)
Returns the GUID of the VM this UEFI configuration is attached to.
10 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 10 identity :vm_id |
Instance Method Details
#reload ⇒ Object
Reload attributes from Hyper-V
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 64 def reload requires :vm_id data = service.get_vm_firmware( computer_name:, vm_id:, _return_fields: self.class.attributes ) return unless data merge_attributes(data) end |
#update ⇒ Object
Save any modifications to Hyper-V
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fog/hyperv/compute/models/firmware.rb', line 41 def update requires :vm_id changes = { enable_secure_boot: changed!(:secure_boot), secure_boot_template: changed!(:secure_boot_template), preferred_network_boot_protocol: changed!(:preferred_network_boot_protocol), console_mode: changed!(:console_mode), pause_after_boot_failure: changed!(:pause_after_boot_failure) }.compact return self unless changes.any? merge_attributes( service.set_vm_firmware( computer_name:, vm_id:, _return_fields: self.class.attributes ) ) end |