ironic_python_agent.raid_utils module

ironic_python_agent.raid_utils.calc_raid_partition_sectors(psize, start)[source]

Calculates end sector and converts start and end sectors including

the unit of measure, compatible with parted. :param psize: size of the raid partition :param start: start sector of the raid partition in integer format :return: start and end sector in parted compatible format, end sector

as integer

ironic_python_agent.raid_utils.calculate_raid_start(target_boot_mode, partition_table_type, dev_name)[source]

Define the start sector for the raid partition.

Parameters:
  • target_boot_mode – the node boot mode.

  • partition_table_type – the node partition label, gpt or msdos.

  • dev_name – block device in the raid configuration.

Returns:

The start sector for the raid partition.

ironic_python_agent.raid_utils.create_raid_device(index, logical_disk)[source]

Create a raid device.

Parameters:
  • index – the index of the resulting md device.

  • logical_disk – the logical disk containing the devices used to crete the raid.

Raise:

errors.SoftwareRAIDError if not able to create the raid device or fails to re-add a device to a raid.

ironic_python_agent.raid_utils.create_raid_partition_tables(block_devices, partition_table_type, target_boot_mode)[source]

Creates partition tables in all disks in a RAID configuration and

reports the starting sector for each partition on each disk. :param block_devices: disks where we want to create the partition tables. :param partition_table_type: type of partition table to create, for example

gpt or msdos.

Parameters:

target_boot_mode – the node selected boot mode, for example uefi or bios.

Returns:

a dictionary of devices and the start of the corresponding partition.

ironic_python_agent.raid_utils.find_esp_raid()[source]

Find the ESP md device in case of a rebuild.

ironic_python_agent.raid_utils.get_block_devices_for_raid(block_devices, logical_disks)[source]

Get block devices that are involved in the RAID configuration.

This call does two things: * Collect all block devices that are involved in RAID. * Update each logical disks with suitable block devices.

ironic_python_agent.raid_utils.get_next_free_raid_device()[source]

Get a device name that is still free.

ironic_python_agent.raid_utils.get_volume_name_of_raid_device(raid_device)[source]

Get the volume name of a RAID device

Parameters:

raid_device – A Software RAID block device name.

Returns:

volume name of the device, or None

ironic_python_agent.raid_utils.prepare_boot_partitions_for_softraid(device, holders, efi_part, target_boot_mode)[source]

Prepare boot partitions when relevant.

Create either a RAIDed EFI partition or bios boot partitions for software RAID, according to both target boot mode and disk holders partition table types.

Parameters:
  • device – the softraid device path

  • holders – the softraid drive members

  • efi_part – when relevant the efi partition coming from the image deployed on softraid device, can be/is often None

  • target_boot_mode – target boot mode can be bios/uefi/None or anything else for unspecified

Returns:

the path to the ESP md device when target boot mode is uefi, nothing otherwise.