YaST2 Developers Documentation: Storage.ycp

Storage.ycp

  • 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.

This module has an unstable interface.

Imports

  • Arch
  • Directory
  • FileSystems
  • FileUtils
  • HTML
  • Hotplug
  • Icon
  • Installation
  • Label
  • LibStorage
  • LibStorage::CommitInfo
  • LibStorage::ContVolInfo
  • LibStorage::ContainerInfo
  • LibStorage::ContentInfo
  • LibStorage::DiskInfo
  • LibStorage::DlabelCapabilities
  • LibStorage::DmInfo
  • LibStorage::DmPartCoInfo
  • LibStorage::DmPartInfo
  • LibStorage::DmmultipathCoInfo
  • LibStorage::DmmultipathInfo
  • LibStorage::DmraidCoInfo
  • LibStorage::DmraidInfo
  • LibStorage::Environment
  • LibStorage::LoopInfo
  • LibStorage::LvmLvInfo
  • LibStorage::LvmVgInfo
  • LibStorage::MdInfo
  • LibStorage::MdPartCoInfo
  • LibStorage::MdPartInfo
  • LibStorage::NfsInfo
  • LibStorage::PartitionAddInfo
  • LibStorage::PartitionInfo
  • LibStorage::PartitionSlotInfo
  • LibStorage::ResizeInfo
  • LibStorage::StorageInterface
  • LibStorage::VolumeInfo
  • Misc
  • Mode
  • PackagesProposal
  • Partitions
  • Popup
  • Report
  • Stage
  • StorageClients
  • StorageDevices
  • String

Structures

Global Functions

Local Functions

global HumanStringToKByteWithRangeCheck (string str, integer& bytes_k, integer min_k, integer max_k) -> boolean

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.

Parameters:
str
bytes_k
min_k
max_k
global GetDeviceName (string disk, any partition) -> string

Returns Device Name

Parameters:
disk
partition
Return value:
device name
Example
 Storage::GetDeviceName("/dev/md", 1)
 Storage::GetDeviceName("/dev/system", "root")
global GetDiskPartition (string device) -> map

Returns map describing the disk partition

Parameters:
device
Return value:
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" ]
global GetDisk (map<string,map> tg, string device) -> map<string,any>

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

Parameters:
tg
device
global SwappingPartitions () -> list<string>

Get List of swap partitions

Return value:
List of swap partitions
global GetFreeSpace (string device, symbol used_fs, boolean verbose) -> map

Returns map of free space per partition

Parameters:
device
used_fs
verbose
local UpdateTargetMap () -> void

Updates target map

See
GetTargetMap()
local getDiskInfo (string device, map disk) -> map

Returns map with disk info

Parameters:
device
disk
Return value:
disk info
global GetOndiskTarget () -> map<string, map>

Returns map describing the disk target

global CreatePartition (string disk, string device, symbol ptype, integer id, integer start, integer len, symbol mby) -> boolean

Creates a new partition

Parameters:
disk
device
ptype
id
start
len
mby
Return value:
if successful
global SetPartitionMount (string device, string mp) -> boolean

Sets a mountpoint for partition

Parameters:
device
mp
Return value:
if successful
global SetPartitionFormat (string device, boolean format, symbol fs) -> boolean

Sets whether a partition should be formatted

Parameters:
device
format
fs
Return value:
if successful
global SetPartitionId (string device, integer id) -> boolean

Sets partition ID

Parameters:
device
id
Return value:
if successful
See
UnchangePartitionId()
global UnchangePartitionId (string device) -> boolean

Restores the original partition ID

Parameters:
device
Return value:
if succesful
See
SetPartitionId()
global ResizePartition (string device, string disk, integer new_cyls) -> boolean

Sets a new size for volume

Parameters:
device
disk
new_cyls
Return value:
if successful
global ResizeVolume (string device, string disk, integer new_size_k) -> boolean

Sets a new size for volume

Parameters:
device
disk
new_size_k
Return value:
if successful
global DeletePartitionTable (string disk) -> boolean

Delete the partition table and disk label of device

Parameters:
disk
global InitializeDisk (string disk, boolean value) -> boolean

Set the flag if a disk needs to be initialized

Parameters:
disk
value
local AddMountPointsForWinParts (list<map> partitions, boolean primary, integer max_prim, integer& foreign_nr) -> void

Search in the list partitions for windows partitions and add the key "mount" to the found windows partitions.

Parameters:
partitions
primary
max_prim
foreign_nr
Return value:
new partitions with windows mountpoints
global RemoveDmMapsTo (string device) -> void

Removes ... maps to ...

Parameters:
device
local AddSwapMp (map<string, map> target) -> map<string, map>

mark swap-partitions with pseudo Mountpoint swap in targetMap

Parameters:
target Disk map
Return value:
modified target
global GetTargetMap () -> map<string, map>

Returns a system target map.

Structure

 $[
    ... ?
 ]
Return value:
target map
global ReReadTargetMap () -> map<string, map>

Rereads the system target map and returns it

Return value:
target map
See
GetTargetMap();
global CommitChanges () -> integer

Apply storage changes

global Umount (string dev) -> boolean

Umounts a device

Parameters:
dev
Return value:
if successful
See
Mount()
global MountOpt (string dev, string mp, string fstopt) -> boolean

Mounts a device

Parameters:
dev
mp
fstopt mount options
Return value:
if successful
See
Umount()
global Mount (string dev, string mp) -> boolean

Mounts a device

Parameters:
dev
mp
Return value:
if successful
See
Umount()
global ReadFstab (string dir) -> list<map>

Reads and returns fstab from directory

FIXME: please, add description of the list that is returned by this function.

Structure [...unknown...]


   
Parameters:
dir
Return value:
fstab?
global GetCommitInfos () -> list<map>

FIXME: please, add description of the list that is returned by this function.

global GetMountPoints () -> map

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

Structure $[ [...], [...], ... ]


   
Return value:
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], ...] FIXME: please, add more detailed description of the 'map of lists' with examples if possible.
global SetPartitionData (map<string,map> tg, string device, string key, any value) -> map<string,map>

Set in partition to the given and return changed map

Parameters:
tg
device
key
value
Return value:
changed target map
global IsRealDisk (map entry) -> boolean

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

Structure entry ~ $[

   "type":`CT_DISK,
   "driver" : "?",
   "readonly" : false / true,
 ]
Parameters:
entry
Return value:
true if real disk
global IsPartitionable (map entry) -> boolean

Checks if a container is partitionable

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


   
Parameters:
entry
Return value:
true if partitionable
global GetOtherLinuxPartitions () -> list

Get list of all Linux Partitions on all real disks

Return value:
Partition list
global CheckSwapOn (string disk) -> boolean

Check if swap paritition is availbe on a disk

Parameters:
disk Disk to be checked
Return value:
true if swap available.
local GetPrimPartitions (map<string, map> targets, boolean foreign_os) -> list<map>

Returns list of primary partitions found

Parameters:
targets
foreign_os
Return value:
of primary partitions
global HandleProposalPackages () -> void

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

global IsResizable (map part) -> map

Returns whether a partition is resizable

Parameters:
part
Return value:
resizable ?
local AddFstabEntry (map e) -> integer

Adds an entry into the fstab

Parameters:
e
Return value:
(0 and higher == OK, otherwise error)
global WriteFstab () -> void

Writes fstab to the disk

global DetectFs (string device) -> symbol

Detects a filesystem on a device

Parameters:
device name
Return value:
filesystem