kiwi.partitioner Package

Submodules

kiwi.partitioner.base Module

class kiwi.partitioner.base.PartitionerBase(disk_provider: DeviceProvider, start_sector: Optional[int] = None, extended_layout: bool = False)[source]

Bases: object

Base class for partitioners

create(name: str, mbsize: int, type_name: str, flags: List[str] = [])[source]

Create partition

Implementation in specialized partitioner class

Parameters
  • name (string) – unused

  • mbsize (int) – unused

  • type_name (string) – unused

  • flags (list) – unused

get_id() int[source]

Current partition number

Zero indicates no partition has been created so far

Returns

partition number

Return type

int

post_init() None[source]

Post initialization method

Implementation in specialized partitioner class

resize_table(entries: int = 0)[source]

Resize partition table

Parameters

entries (int) – unused

set_flag(partition_id: int, flag_name: str)[source]

Set partition flag

Implementation in specialized partitioner class

Parameters
  • partition_id (int) – unused

  • flag_name (string) – unused

set_hybrid_mbr()[source]

Turn partition table into hybrid table if supported

Implementation in specialized partitioner class

set_mbr()[source]

Turn partition table into MBR (msdos table)

Implementation in specialized partitioner class

set_start_sector(start_sector: int)[source]

Set start sector of first partition as configured

Parameters

start_sector (int) – unused

Does nothing by default

kiwi.partitioner.dasd Module

class kiwi.partitioner.dasd.PartitionerDasd(disk_provider: DeviceProvider, start_sector: Optional[int] = None, extended_layout: bool = False)[source]

Bases: PartitionerBase

Implements DASD partition setup

create(name: str, mbsize: int, type_name: str, flags: Optional[List[str]] = None) None[source]

Create DASD partition

Parameters
  • name (string) – partition name

  • mbsize (int) – partition size

  • type_name (string) – unused

  • flags (list) – unused

post_init() None[source]

Post initialization method

Setup fdasd partition type/flag map

resize_table(entries: Optional[int] = None) None[source]

Resize partition table

Nothing to be done here for DASD devices

Parameters

entries (int) – unused

kiwi.partitioner.gpt Module

class kiwi.partitioner.gpt.PartitionerGpt(disk_provider: DeviceProvider, start_sector: Optional[int] = None, extended_layout: bool = False)[source]

Bases: PartitionerBase

Implements GPT partition setup

create(name: str, mbsize: int, type_name: str, flags: Optional[List[str]] = None) None[source]

Create GPT partition

Parameters
  • name (string) – partition name

  • mbsize (int) – partition size

  • type_name (string) – partition type

  • flags (list) – additional flags

post_init() None[source]

Post initialization method

Setup gdisk partition type/flag map

resize_table(entries: int = 128) None[source]

Resize partition table

Parameters

entries (int) – number of default entries

set_flag(partition_id: int, flag_name: str) None[source]

Set GPT partition flag

Parameters
  • partition_id (int) – partition number

  • flag_name (string) – name from flag map

set_hybrid_mbr() None[source]

Turn partition table into hybrid GPT/MBR table

set_mbr() None[source]

Turn partition table into MBR (msdos table)

kiwi.partitioner.msdos Module

class kiwi.partitioner.msdos.PartitionerMsDos(disk_provider: DeviceProvider, start_sector: Optional[int] = None, extended_layout: bool = False)[source]

Bases: PartitionerBase

Implement old style msdos partition setup

create(name: str, mbsize: int, type_name: str, flags: List[str] = []) None[source]

Create msdos partition

Parameters
  • name (string) – partition name

  • mbsize (int) – partition size

  • type_name (string) – partition type

  • flags (list) – additional flags

post_init() None[source]

Post initialization method

Setup sfdisk partition type/flag map

resize_table(entries: Optional[int] = None) None[source]

Resize partition table

Nothing to be done here for msdos table

Parameters

entries (int) – unused

set_flag(partition_id: int, flag_name: str) None[source]

Set msdos partition flag

Parameters
  • partition_id (int) – partition number

  • flag_name (string) – name from flag map

set_start_sector(start_sector: int)[source]

Set start sector of first partition as configured. fdisk and friends are not able to work correctly if the start sector of the first partition is any different from 2048.

Parameters

start_sector (int) – sector size

Module Contents

class kiwi.partitioner.Partitioner[source]

Bases: object

Partitioner factory

Parameters
  • table_type (string) – Table type name

  • storage_provider (object) – Instance of class based on DeviceProvider

  • start_sector (int) – sector number

  • extended_layout (bool) – support extended layout for msdos table

static new(table_type: str, storage_provider: object, start_sector: Optional[int] = None, extended_layout: bool = False)[source]