ironic_python_agent.efi_utils module

ironic_python_agent.efi_utils.add_boot_record(device, efi_partition, loader, label)[source]

Add an EFI boot record with efibootmgr.

Parameters
  • device – the device to be used

  • efi_partition – the number of the EFI partition on the device

  • loader – path to the EFI boot loader

  • label – the record label

ironic_python_agent.efi_utils.get_boot_records()[source]

Executes efibootmgr and returns boot records.

Returns

an iterator yielding pairs (boot number, boot record).

ironic_python_agent.efi_utils.get_partition_path_by_number(device, part_num)[source]

Get partition path (/dev/something) by a partition number on device.

Only works for GPT partition table.

ironic_python_agent.efi_utils.manage_uefi(device, efi_system_part_uuid=None)[source]

Manage the device looking for valid efi bootloaders to update the nvram.

This method checks for valid efi bootloaders in the device, if they exists it updates the nvram using the efibootmgr.

Parameters
  • device – the device to be checked.

  • efi_system_part_uuid – efi partition uuid.

Raises

DeviceNotFound if the efi partition cannot be found.

Returns

True - if it founds any efi bootloader and the nvram was updated using the efibootmgr. False - if no efi bootloader is found.

ironic_python_agent.efi_utils.remove_boot_record(boot_num)[source]

Remove an EFI boot record with efibootmgr.

Parameters

boot_num – the number of the boot record