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.
List of Global Functions
AddFstabEntry - Adds an entry into the fstab
AddMountPointInfo - Adds mountpoint info to the target map and returns the changed map
AddSwapMp - mark swap-partitions with pseudo Mountpoint swap in targetMap
AddWinInfo - Adds ... and returns the changed map
CheckForLvmRootFs - CheckForLvmRootFs --------------------------------------------------------------------- check if the root filesystem is a lvm logical volume
CheckSwapOn - Check if swap paritition is availbe on a disk
CommitChanges - Apply storage changes
CreatePartition - Creates a new partition
DeletePartitionTable - Delete the partition table and disk label of device
DetectFs - Detects a filesystem on a device
GetDeviceName - Returns Device Name
GetDisk - Returns disk identified by 'device' taken from the 'tg' (target) map
GetDiskPartition - Returns map describing the disk partition
GetFreeSpace - Returns map of free space per partition
GetMountPoints - GetMountPoints() collect mountpoint:device as map to get a sorted list
GetOndiskTarget - Returns map describing the disk target
GetOtherLinuxPartitions - Get list of all Linux Partitions on all real disks
GetPrimPartitions - Returns list of primary partitions found
GetTargetMap - Returns a system target map.
HandleProposalPackages - Takes care of selecting packages needed by storage in installation (replacement for HandlePackages in *_proposal clients)
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.
InitializeDisk - Set the flag if a disk needs to be initialized
IsPartitionable - Checks if a container is partitionable
IsRealDisk - Check if a disk is a real disk and not RAID or LVM
IsResizable - Returns whether a partition is resizable
Mount - Mounts a device
MountOpt - Mounts a device
ReReadTargetMap - Rereads the system target map and returns it
ReadFstab - Reads and returns fstab from directory
RemoveDmMapsTo - Removes ... maps to ...
ResizePartition - Sets a new size for volume
ResizeVolume - Sets a new size for volume
SetPartitionData - Set <key> in partition <device> to the given <value> and return changed map <tg>
SetPartitionFormat - Sets whether a partition should be formatted
SetPartitionId - Sets partition ID
SetPartitionMount - Sets a mountpoint for partition
SwappingPartitions - Get List of swap partitions
Umount - Umounts a device
UnchangePartitionId - Restores the original partition ID
Update - Updates fstab on disk
UpdateTargetMap - Updates target map
WriteFstab - Writes fstab to the disk
getDiskInfo - Returns map with disk info
List of Global Variables
Adds an entry into the fstab
Function parameters
map e
Return value
integer - (0 and higher == OK, otherwise error)
Adds mountpoint info to the target map and returns the changed map
Function parameters
map<string,map> target
Return value
map<string,map> - target
mark swap-partitions with pseudo Mountpoint swap in targetMap
Function parameters
map<string,map> target
Return value
map<string,map> - modified target
Adds ... and returns the changed map
Function parameters
map<string,map> targets
Return value
map<string,map> - targets
CheckForLvmRootFs --------------------------------------------------------------------- check if the root filesystem is a lvm logical volume
Return value
boolean
Check if swap paritition is availbe on a disk
Function parameters
string disk
Return value
boolean - true if swap available.
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
Delete the partition table and disk label of device
Function parameters
string disk
integer size_k
Return value
boolean
Detects a filesystem on a device
Function parameters
string device
Return value
symbol - filesystem
Returns Device Name
Function parameters
string disk
any partition
Return value
string - device name
Returns disk identified by 'device' taken from the 'tg' (target) map
Function parameters
map<string,map> tg
string device
Return value
map<string,any>
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" ]
Returns map of free space per partition
Function parameters
string device
integer testsize
symbol used_fs
boolean verbose
Return value
map
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], ...]
Get list of all Linux Partitions on all real disks
Return value
list - Partition list
Returns list of primary partitions found
Function parameters
map<string,map> targets
boolean foreign_os
Return value
list - of primary partitions
Returns a system target map.
Return value
map<string, map> - target map
$[ ... ? ]
Takes care of selecting packages needed by storage in installation (replacement for HandlePackages in *_proposal clients)
Return value
void
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
Set the flag if a disk needs to be initialized
Function parameters
string disk
boolean value
Return value
boolean
Checks if a container is partitionable
Function parameters
map entry
Return value
boolean - true if partitionable
entry ~ $[ "type" : ... ? ]
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, ]
Returns whether a partition is resizable
Function parameters
map part
Return value
map - resizable ?
Mounts a device
Function parameters
string dev
string mp
Return value
boolean - if successful
See also:
Umount()
Mounts a device
Function parameters
string dev
string mp
string fstopt
Return value
boolean - if successful
See also:
Umount()
Rereads the system target map and returns it
Return value
map<string, map> - target map
See also:
GetTargetMap();
Reads and returns fstab from directory
Function parameters
string dir
Return value
list
Sets a new size for volume
Function parameters
string device
string disk
integer new_cyls
Return value
boolean - if successfull
Sets a new size for volume
Function parameters
string device
string disk
integer new_size_k
Return value
boolean - if successfull
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
Sets whether a partition should be formatted
Function parameters
string device
boolean format
symbol fs
Return value
boolean - if successful
Sets partition ID
Function parameters
string device
integer id
Return value
boolean - if successful
See also:
UnchangePartitionId()
Sets a mountpoint for partition
Function parameters
string device
string mp
Return value
boolean - if successful
Umounts a device
Function parameters
string dev
Return value
boolean - if successful
See also:
Mount()
Restores the original partition ID
Function parameters
string device
Return value
boolean - if succesful
See also:
SetPartitionId()
Updates fstab on disk
Function parameters
map oldv
map newv
Return value
void
version $[ // This means version 9.1 "major" : 9, "minor" : 1, ]