254. Storage

254.1. Authors

  • Johannes Buchhold (jbuch@suse.de)

  • Purpose: These module contains all settings/information which

  • are needed to partitioning the harddisk. Futhermore it contains a interface

  • to * access and modify the partitioning settings.

  • Todo: Translate

  • Diese Modul enthält alle Informationen die für die Partitionierung der

  • Festplatten erforderlich sind. Diese Informationen bestehen aus der

  • Beschreibung, der vor der Partitionierung vorhandenen Platteneinstellungen,

  • und der Art und Weise wie diese verändert werden soll.

  • Alle nötigen Zugriffsfunktionen auf diese Datenstruktur sind ebenfalls in

  • diesem Modul enthalten. Der Zugriff auf die Speicherung der

  • Partitionseinstellungen läuft also nur über dieses Modul.

  • Der Zugriff und die Rückgabe von Teilen der Partitionsdatenstruktur

  • wurde versucht "intelligent" zu gestallten und ist im einzelen bei den

  • entspechenden Funktionen näher erklärt.

254.2. Summary of Module Globals

List of Global Functions

List of Global Variables

    254.3. Global Functions

    254.3.1. AddFstabEntry

    Adds an entry into the fstab

    Function parameters

    • map e

    Return value

    • integer - (0 and higher == OK, otherwise error)

    254.3.2. AddMountPointInfo

    Adds mountpoint info to the target map and returns the changed map

    Function parameters

    • map<string,map> target

    Return value

    • map<string,map> - target

    254.3.3. AddSwapMp

    mark swap-partitions with pseudo Mountpoint swap in targetMap

    Function parameters

    • map<string,map> target

    Return value

    • map<string,map> - modified target

    254.3.4. AddWinInfo

    Adds ... and returns the changed map

    Function parameters

    • map<string,map> targets

    Return value

    • map<string,map> - targets

    254.3.5. CheckForLvmRootFs

    CheckForLvmRootFs --------------------------------------------------------------------- check if the root filesystem is a lvm logical volume

    Return value

    • boolean

    254.3.6. CheckSwapOn

    Check if swap paritition is availbe on a disk

    Function parameters

    • string disk

    Return value

    • boolean - true if swap available.

    254.3.7. CommitChanges

    Apply storage changes

    Return value

    • integer

    254.3.8. CreatePartition

    Creates a new partition

    Function parameters

    • string disk

    • string device

    • symbol ptype

    • integer id

    • integer start

    • integer len

    • symbol mby

    Return value

    • boolean - if successful

    254.3.9. DeletePartitionTable

    Delete the partition table and disk label of device

    Function parameters

    • string disk

    • integer size_k

    Return value

    • boolean

    254.3.10. DetectFs

    Detects a filesystem on a device

    Function parameters

    • string device

    Return value

    • symbol - filesystem

    254.3.11. GetDeviceName

    Returns Device Name

    Function parameters

    • string disk

    • any partition

    Return value

    • string - device name

    Example 87. 

     Storage::GetDeviceName ("/dev/md", 1)


    254.3.12. GetDisk

    Returns disk identified by 'device' taken from the 'tg' (target) map

    Function parameters

    • map<string,map> tg

    • string device

    Return value

    • map<string,any>

    254.3.13. GetDiskPartition

    Returns map describing the disk partition

    Function parameters

    • string device

    Return value

    • map - DiskPartition Examples: "/dev/sda" -> $[ "disk" : "/dev/sda", "nr" : "" ] "/dev/sda2" -> $[ "disk" : "/dev/sda", "nr" : 2 ] "/dev/system" -> $[ "disk" : "/dev/system", "nr" : "" ] "/dev/system/abuild" -> $[ "disk" : "/dev/system", "nr" : "abuild" ]

    254.3.14. GetFreeSpace

    Returns map of free space per partition

    Function parameters

    • string device

    • integer testsize

    • symbol used_fs

    • boolean verbose

    Return value

    • map

    254.3.15. GetMountPoints

    GetMountPoints() collect mountpoint:device as map to get a sorted list

    Return value

    • map - of lists, the map key is the mount point, usually starting with a "/". Exception is "swap" For directory mount points (key starting with /) the value is a list [partitionName, fsid, targetdevice, raid_type] For swap mount points, the value is a list of lists: [[partitionName, fsid, targetdevice, raid_type], ...]

    254.3.16. GetOndiskTarget

    Returns map describing the disk target

    Return value

    • map< string, map >

    254.3.17. GetOtherLinuxPartitions

    Get list of all Linux Partitions on all real disks

    Return value

    • list - Partition list

    254.3.18. GetPrimPartitions

    Returns list of primary partitions found

    Function parameters

    • map<string,map> targets

    • boolean foreign_os

    Return value

    • list - of primary partitions

    254.3.19. GetTargetMap

    Returns a system target map.

    Return value

    • map<string, map> - target map

     $[
        ... ?
     ]

    254.3.20. HandleProposalPackages

    Takes care of selecting packages needed by storage in installation (replacement for HandlePackages in *_proposal clients)

    Return value

    • void

    254.3.21. HumanStringToKByteWithRangeCheck

    Converts a string into a integer and checks the allowed range for the integer. The range check is a bit sloppy to compensate rounding issues but it's guaranteed that the result lies within the allowed range.

    Function parameters

    • string str

    • integer& bytes_k

    • integer min_k

    • integer max_k

    Return value

    • boolean

    254.3.22. InitializeDisk

    Set the flag if a disk needs to be initialized

    Function parameters

    • string disk

    • boolean value

    Return value

    • boolean

    254.3.23. IsPartitionable

    Checks if a container is partitionable

    Function parameters

    • map entry

    Return value

    • boolean - true if partitionable

    entry ~ $[ "type" : ... ? ]

    254.3.24. IsRealDisk

    Check if a disk is a real disk and not RAID or LVM

    Function parameters

    • map entry

    Return value

    • boolean - true if real disk

    entry ~ $[
       "type":`CT_DISK,
       "driver" : "?",
       "readonly" : false / true,
     ]

    254.3.25. IsResizable

    Returns whether a partition is resizable

    Function parameters

    • map part

    Return value

    • map - resizable ?

    254.3.26. Mount

    Mounts a device

    Function parameters

    • string dev

    • string mp

    Return value

    • boolean - if successful

    See also:

    • Umount()

    254.3.27. MountOpt

    Mounts a device

    Function parameters

    • string dev

    • string mp

    • string fstopt

    Return value

    • boolean - if successful

    See also:

    • Umount()

    254.3.28. ReReadTargetMap

    Rereads the system target map and returns it

    Return value

    • map<string, map> - target map

    See also:

    • GetTargetMap();

    254.3.29. ReadFstab

    Reads and returns fstab from directory

    Function parameters

    • string dir

    Return value

    • list

    254.3.30. RemoveDmMapsTo

    Removes ... maps to ...

    Function parameters

    • string device

    Return value

    • void

    254.3.31. ResizePartition

    Sets a new size for volume

    Function parameters

    • string device

    • string disk

    • integer new_cyls

    Return value

    • boolean - if successfull

    254.3.32. ResizeVolume

    Sets a new size for volume

    Function parameters

    • string device

    • string disk

    • integer new_size_k

    Return value

    • boolean - if successfull

    254.3.33. SetPartitionData

    Set <key> in partition <device> to the given <value> and return changed map <tg>

    Function parameters

    • map<string,map> tg

    • string device

    • string key

    • any value

    Return value

    • map<string,map> - changed target map

    254.3.34. SetPartitionFormat

    Sets whether a partition should be formatted

    Function parameters

    • string device

    • boolean format

    • symbol fs

    Return value

    • boolean - if successful

    254.3.35. SetPartitionId

    Sets partition ID

    Function parameters

    • string device

    • integer id

    Return value

    • boolean - if successful

    See also:

    • UnchangePartitionId()

    254.3.36. SetPartitionMount

    Sets a mountpoint for partition

    Function parameters

    • string device

    • string mp

    Return value

    • boolean - if successful

    254.3.37. SwappingPartitions

    Get List of swap partitions

    Return value

    • list - List of swap partitions

    254.3.38. Umount

    Umounts a device

    Function parameters

    • string dev

    Return value

    • boolean - if successful

    See also:

    • Mount()

    254.3.39. UnchangePartitionId

    Restores the original partition ID

    Function parameters

    • string device

    Return value

    • boolean - if succesful

    See also:

    • SetPartitionId()

    254.3.40. Update

    Updates fstab on disk

    Function parameters

    • map oldv

    • map newv

    Return value

    • void

    version $[
       // This means version 9.1
       "major" : 9,
       "minor" : 1,
     ]

    254.3.41. UpdateTargetMap

    Updates target map

    Return value

    • void

    See also:

    • GetTargetMap()

    254.3.42. WriteFstab

    Writes fstab to the disk

    Return value

    • void

    254.3.43. getDiskInfo

    Returns map with disk info

    Function parameters

    • string device

    • map disk

    Return value

    • map - disk info

    254.4. Global Variables

    254.5. Module Requirements

    254.5.1. Module Imports

    • Arch
    • AsciiFile
    • Directory
    • Encoding
    • FileSystems
    • FileUtils
    • HTML
    • Hotplug
    • Installation
    • Label
    • LibStorage
    • LibStorage::CommitInfo
    • LibStorage::ContainerInfo
    • LibStorage::DiskInfo
    • LibStorage::DmInfo
    • LibStorage::DmPartCoInfo
    • LibStorage::DmPartInfo
    • LibStorage::DmmultipathCoInfo
    • LibStorage::DmmultipathInfo
    • LibStorage::DmraidCoInfo
    • LibStorage::DmraidInfo
    • LibStorage::LoopInfo
    • LibStorage::LvmLvInfo
    • LibStorage::LvmVgInfo
    • LibStorage::MdInfo
    • LibStorage::NfsInfo
    • LibStorage::PartitionAddInfo
    • LibStorage::PartitionInfo
    • LibStorage::PartitionSlotInfo
    • LibStorage::StorageInterface
    • LibStorage::VolumeInfo
    • Misc
    • Mode
    • PackagesProposal
    • Partitions
    • Popup
    • ProductFeatures
    • Region
    • Stage
    • StorageClients
    • StorageDevices
    • String

    254.5.2. Module Includes