ironic_python_agent.disk_partitioner module

Code for creating partitions on a disk.

Imported from ironic-lib’s disk_utils as of the following commit: https://opendev.org/openstack/ironic-lib/commit/42fa5d63861ba0f04b9a4f67212173d7013a1332

class ironic_python_agent.disk_partitioner.DiskPartitioner(device, disk_label='msdos', alignment='optimal')[source]

Bases: object

add_partition(size, part_type='primary', fs_type='', boot_flag=None, extra_flags=None)[source]

Add a partition.

Parameters:
  • size – The size of the partition in MiB.

  • part_type – The type of the partition. Valid values are: primary, logical, or extended.

  • fs_type – The filesystem type. Valid types are: ext2, fat32, fat16, HFS, linux-swap, NTFS, reiserfs, ufs. If blank (‘’), it will create a Linux native partition (83).

  • boot_flag – Boot flag that needs to be configured on the partition. Ignored if None. It can take values ‘bios_grub’, ‘boot’.

  • extra_flags – List of flags to set on the partition. Ignored if None.

Returns:

The partition number.

commit()[source]

Write to the disk.

get_partitions()[source]

Get the partitioning layout.

Returns:

An iterator with the partition number and the partition layout.