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

Attributes

  • mountpoint
    root mountpoint for volumes
  • device_provider
    Instance of class based on DeviceProvider
  • root_dir
    root directory path name
  • volumes
    list of volumes from XMLState::get_volumes()
  • volume_group
    volume group name
  • volume_map
    map volume name to device node
  • mount_list
    list of volume MountManager’s
  • device
    storage device node name
  • custom_args
    custom volume manager arguments for all volume manager and filesystem specific tasks
  • custom_filesystem_args
    custom filesystem creation and mount arguments, subset of the custom_args information suitable to be passed to a FileSystem instance
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 (string) – 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 (string) – unused
  • filesystem_name (string) – unused
Return type:

list

get_volume_mbsize(mbsize, size_type, realpath, filesystem_name, image_type=None)[source]

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

Parameters:
  • mbsize (int) – configured volume size
  • size_type (string) – relative or absolute size setup
  • realpath (string) – volume real path name
  • filesystem_name (string) – 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

Return type:dict
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

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 (string) – 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

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
Return type:

list

get_volumes()[source]

Return dict of volumes

Return type:dict
mount_volumes()[source]

Mount btrfs subvolumes

post_init(custom_args)[source]

Post initialization method

Store custom btrfs initialization arguments

Attributes

  • subvol_mount_list
    list of mounted btrfs subvolumes
  • toplevel_mount
    MountManager for root mountpoint
Parameters:custom_args (list) – custom btrfs volume manager arguments
set_property_readonly_root()[source]
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

umount_volumes()[source]

Umount btrfs subvolumes

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 (string) – 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 (string) – unused
  • filesystem_name (string) – volumes filesystem name
Return type:

list

get_volumes()[source]

Return dict of volumes

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 (string) – volume group name
umount_volumes()[source]

Umount lvm volumes

Module Contents

class kiwi.volume_manager.VolumeManager[source]

Bases: object

VolumeManager factory

Attributes

  • name
    volume management name
  • device_provider
    Instance of a class based on DeviceProvider
  • root_dir
    root directory path name
  • volumes
    list of volumes from XMLState::get_volumes()
  • custom_args
    dictionary of custom volume manager arguments