kiwi.volume_manager Package

Submodules

kiwi.volume_manager.base Module

class kiwi.volume_manager.base.VolumeManagerBase(device_provider, root_dir, volumes, custom_args=None)[source]

Bases: kiwi.storage.device_provider.DeviceProvider

Implements base class for volume management interface

Parameters
  • mountpoint (str) – root mountpoint for volumes

  • device_provider (object) – instance of a DeviceProvider subclass

  • root_dir (str) – root directory path name

  • volumes (list) – list of volumes from XMLState::get_volumes()

  • volume_group (str) – volume group name

  • volume_map (map) – map volume name to device node

  • mount_list (list) – list of volume MountManager’s

  • device (str) – storage device node name

  • custom_args (dict) – custom volume manager arguments for all volume manager and filesystem specific tasks

  • custom_filesystem_args (list) – custom filesystem creation and mount arguments, subset of the custom_args information suitable to be passed to a FileSystem instance

Raises

KiwiVolumeManagerSetupError – if the given root_dir doesn’t exist

apply_attributes_on_volume(toplevel, volume)[source]
create_volume_paths_in_root_dir()[source]

Implements creation of volume paths in the given root directory

create_volumes(filesystem_name)[source]

Implements creation of volumes

Implementation in specialized volume manager class required

Parameters

filesystem_name (str) – unused

get_canonical_volume_list()[source]

Implements hierarchical sorting of volumes according to their paths and provides information about the volume configured as the one eating all the rest space

Returns

list of canonical_volume_type tuples

Return type

list

get_device()[source]

Dictionary with instance of MappedDevice for the root device node

Returns

root device map

Return type

dict

get_fstab(persistency_type, filesystem_name)[source]

Implements setup of the fstab entries. The method should return a list of fstab compatible entries

Parameters
  • persistency_type (str) – unused

  • filesystem_name (str) – unused

get_volume_mbsize(volume, all_volumes, filesystem_name, image_type=None)[source]

Implements size lookup for the given path and desired filesystem according to the specified size type

Parameters
  • volume (tuple) – volume to check size for

  • all_volumes (list) – list of all volume tuples

  • filesystem_name (str) – filesystem name

  • image_type – build type name

Returns

mbsize

Return type

int

get_volumes()[source]

Implements return of dictionary of volumes and their mount options

is_loop()[source]

Check if storage provider is loop based

The information is taken from the storage provider. If the storage provider is loop based the volume manager is it too

Returns

True of False

Return type

bool

mount_volumes()[source]

Implements mounting of all volumes below one master directory

Implementation in specialized volume manager class required

post_init(custom_args)[source]

Post initialization method

Implementation in specialized volume manager class if required

Parameters

custom_args (dict) – unused

set_property_readonly_root()[source]

Implements setup of read-only root property

setup(name=None)[source]

Implements setup required prior to the creation of volumes

Implementation in specialized volume manager class required

Parameters

name (str) – unused

setup_mountpoint()[source]

Implements creation of a master directory holding the mounts of all volumes

sync_data(exclude=None)[source]

Implements sync of root directory to mounted volumes

Parameters

exclude (list) – file patterns to exclude

umount_volumes()[source]

Implements umounting of all volumes

Implementation in specialized volume manager class required

kiwi.volume_manager.btrfs Module

class kiwi.volume_manager.btrfs.VolumeManagerBtrfs(device_provider, root_dir, volumes, custom_args=None)[source]

Bases: kiwi.volume_manager.base.VolumeManagerBase

Implements btrfs sub-volume management

Parameters
  • subvol_mount_list (list) – list of mounted btrfs subvolumes

  • toplevel_mount (object) – MountManager for root mountpoint

create_volumes(filesystem_name)[source]

Create configured btrfs subvolumes

Any btrfs subvolume is of the same btrfs filesystem. There is no way to have different filesystems per btrfs subvolume. Thus the filesystem_name has no effect for btrfs

Parameters

filesystem_name (string) – unused

get_fstab(persistency_type='by-label', filesystem_name=None)[source]

Implements creation of the fstab entries. The method returns a list of fstab compatible entries

Parameters
  • persistency_type (string) – by-label | by-uuid

  • filesystem_name (string) – unused

Returns

list of fstab entries

Return type

list

get_volumes()[source]

Return dict of volumes

Returns

volumes dictionary

Return type

dict

mount_volumes()[source]

Mount btrfs subvolumes

post_init(custom_args)[source]

Post initialization method

Store custom btrfs initialization arguments

Parameters

custom_args (list) – custom btrfs volume manager arguments

set_property_readonly_root()[source]

Sets the root volume to be a readonly filesystem

setup(name=None)[source]

Setup btrfs volume management

In case of btrfs a toplevel(@) subvolume is created and marked as default volume. If snapshots are activated via the custom_args the setup method also created the @/.snapshots/1/snapshot subvolumes. There is no concept of a volume manager name, thus the name argument is not used for btrfs

Parameters

name (string) – unused

sync_data(exclude=None)[source]

Sync data into btrfs filesystem

If snapshots are activated the root filesystem is synced into the first snapshot

Parameters

exclude (list) – files to exclude from sync

umount_volumes()[source]

Umount btrfs subvolumes

Returns

True if all subvolumes are successfully unmounted

Return type

bool

kiwi.volume_manager.lvm Module

class kiwi.volume_manager.lvm.VolumeManagerLVM(device_provider, root_dir, volumes, custom_args=None)[source]

Bases: kiwi.volume_manager.base.VolumeManagerBase

Implements LVM volume management

create_volumes(filesystem_name)[source]

Create configured lvm volumes and filesystems

All volumes receive the same filesystem

Parameters

filesystem_name (str) – volumes filesystem name

get_device()[source]

Dictionary of MappedDevice instances per volume

Note: The mapping requires an explicit create_volumes() call

Returns

root plus volume device map

Return type

dict

get_fstab(persistency_type, filesystem_name)[source]

Implements creation of the fstab entries. The method returns a list of fstab compatible entries

Parameters
  • persistency_type (str) – unused

  • filesystem_name (str) – volumes filesystem name

Returns

fstab entries

Return type

list

get_volumes()[source]

Return dict of volumes

Returns

volumes dictionary

Return type

dict

mount_volumes()[source]

Mount lvm volumes

post_init(custom_args)[source]

Post initialization method

Store custom lvm initialization arguments

Parameters

custom_args (list) – custom lvm volume manager arguments

setup(volume_group_name='systemVG')[source]

Setup lvm volume management

In case of LVM a new volume group is created on a PV initialized storage device

Parameters

name (str) – volume group name

umount_volumes()[source]

Umount lvm volumes

Returns

True if all subvolumes are successfully unmounted

Return type

bool

Module Contents

class kiwi.volume_manager.VolumeManager[source]

Bases: object

VolumeManager factory

Parameters
  • name (str) – volume management name

  • device_provider (object) – instance of a class based on DeviceProvider

  • root_dir (str) – root directory path name

  • volumes (list) – list of volumes from XMLState::get_volumes()

  • custom_args (dict) – dictionary of custom volume manager arguments