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
  • AsciiFile
  • Directory
  • Encoding
  • FileSystems
  • FileUtils
  • HTML
  • Hotplug
  • Installation
  • Label
  • LibStorage
  • LibStorage::ContainerInfo
  • LibStorage::DiskInfo
  • LibStorage::DmInfo
  • LibStorage::DmPartCoInfo
  • LibStorage::DmPartInfo
  • LibStorage::DmraidCoInfo
  • LibStorage::DmraidInfo
  • LibStorage::EvmsCoInfo
  • LibStorage::EvmsInfo
  • LibStorage::LoopInfo
  • LibStorage::LvmLvInfo
  • LibStorage::LvmVgInfo
  • LibStorage::MdInfo
  • LibStorage::NfsInfo
  • LibStorage::PartitionAddInfo
  • LibStorage::PartitionInfo
  • LibStorage::StorageInterface
  • LibStorage::VolumeInfo
  • Misc
  • Mode
  • Partitions
  • Popup
  • ProductFeatures
  • Stage
  • StorageClients
  • StorageDevices
  • String

Includes

  • storage/routines.ycp

Structures

Global Functions

Local Functions

global GetDeviceName (string disk, any partition) -> string

Returns Device Name

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

Returns ...

Parameters:
dev
Return value:
EvmsDevDisk
local GetDiskPartitionTg (string device, map<string,map> tg) -> list<map>

Parameters:
device
tg
global GetDiskPartition (string device) -> map

Returns map describing the disk partition

Parameters:
device
Return value:
DiskPartition
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 SetPartition (map<string,map> tg, map part) -> map<string,map>

Sets partition 'part' into the 'tg' map and returns changed 'tg' map

Parameters:
tg
part
Return value:
changed tg
global GetLoopDev (integer start) -> string

Find next free loop device.

Parameters:
start
Return value:
loop_dev ( e.g.: /dev/loop1 )
global SwappingPartitions () -> list

Get List of swap partitions

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

Returns map of free space per partition

Parameters:
device
testsize
used_fs
verbose
global AddWinInfo (map<string,map> targets) -> map<string,map>

Adds ... and returns the changed map

Parameters:
targets
Return value:
targets
global AddMountPointInfo (map<string,map> target) -> map<string,map>

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

Parameters:
target
Return value:
target
global UpdateTargetMap () -> void

Updates target map

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

Returns map with disk info

Parameters:
device
disk
Return value:
disk info
global FindFstabEntry (map fstab, string mount, string device, string uuid, string label) -> map

Finds and returns fstab entry

Structure

 $[
   "spec" : "...",
   "file" : "...",
   "vfstype" : "...",
   "mntops" : "...",
   "freq" : ...,
   "passno" : ...,
 ]
Parameters:
fstab
mount
device
uuid
label
Return value:
fstab entry
Example

   FindFstabEntry ($[], "", "", "", "")
global GetOndiskTarget () -> map< string, map >

Returns map describing the disk target

global Record () -> void

global Rollback () -> boolean

global Commit () -> boolean

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 ResizeVolume (string device, string disk, integer new_size) -> boolean

Sets a new size for partition

Parameters:
device
disk
new_size
Return value:
if successfull
global DeletePartitionTable (string disk, integer size_k) -> boolean

Delete the partition table and disk label of device

Parameters:
disk
size_k
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
global 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

Reads and returns fstab from directory

Parameters:
dir
global GetMountPoints () -> map

GetMountPoints() collect mountpoint:device as map to get a sorted list 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], ...]

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 GetPartitionList () -> list

Get list of all Partitions on all real disks

Return value:
Partition list
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.
global GetPrimPartitions (map<string,map> targets, boolean foreign_os) -> list

Returns list of primary partitions found

Parameters:
targets
foreign_os
Return value:
of primary partitions
global IsResizable (map part) -> map

Returns whether a partition is resizable

Parameters:
part
Return value:
resizable ?
global 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
global Update (map oldv, map newv) -> void

Updates fstab on disk

Structure version $[

   // This means version 9.1
   "major" : 9,
   "minor" : 1,
 ]
Parameters:
oldv
newv
global GetUsedRealDisksNew (map<string,map> tg, boolean ignore_boot) -> list<string>

Get used real disks

Parameters:
tg
ignore_boot
Return value:
disks List of disks
global CheckForLvmRootFs () -> boolean

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

global CheckForEvmsRootFs () -> boolean

CheckForEvmsRootFs --------------------------------------------------------------------- check if the root filesystem is a evms volume