ACC SHELL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>
Bootloader installation and configuration
</title>
<style type="text/css">body { background-color: #c8c8c8 }
h1 { color: #e00000 }
table { width: 100%/ border: none }
img { border: 0px }
.sigbox { background-color: #ffc080; border: solid thin #f96500 }
.sig { font: larger monospace }
.padtbl { background-color: #ffc080; padding: 10px; margin: 10px }
/* arrow */
.a { color: #606060 }
/* type, parameter */
.t, .p { color: #c05000 }
.pbox { width: 20% }
.descbox { }
.right { align: right }
.header {}
.footer { clear: both}
.menu { width: 10%; float: left }
.main { width: 90%; float: left }
</style>
</head>
<body>
<div class="header">
<i>YaST2 Developers Documentation:</i>
<a href="index.html">
<b>
Bootloader installation and configuration
</b>
</a>
<img class="right" alt="" src="/usr/share/doc/packages/yast2-devtools/images/yast2-mini.png" />
<hr />
</div>
<div class="menu">
<img alt="YaST" src="/usr/share/doc/packages/yast2-devtools/images/yast2-half.png" />
<br />
<br />
<a href="index.html">functions</a>
<br />
<a href="files.html">files</a>
<br />
<a href="intro.html">intro</a>
</div>
<div class="main">
<div class="sigbox">
<table class="padtbl">
<tr>
<td>
<h1>
Bootloader installation and configuration
</h1>
</td>
<td class="filecell">
modules/BootStorage.ycp
</td>
</tr>
<tr>
<td>
Module includes specific functions for handling storage data.
The idea is handling all storage data necessary for bootloader
in one module.
</td>
</tr>
<tr>
<td>
<ul>
<li> Jozef Uhliarik <juhliarik@suse.cz></li>
</ul>
</td>
</tr>
<tr>
<td>
<p>This module has an unstable interface.</p>
</td>
</tr>
</table>
<table class="padtbl">
<tr>
<td>
<h1>Imports</h1>
<ul>
<li>Arch</li>
<li>Mode</li>
<li>Storage</li>
<li>StorageDevices</li>
</ul>
<h1>Global Variables</h1>
<ul>
<li>
<a href="#BootPartitionDevice">BootPartitionDevice</a>
</li>
<li>
<a href="#ExtendedPartitionDevice">ExtendedPartitionDevice</a>
</li>
<li>
<a href="#RootPartitionDevice">RootPartitionDevice</a>
</li>
<li>
<a href="#all_devices">all_devices</a>
</li>
<li>
<a href="#all_partitions">all_partitions</a>
</li>
<li>
<a href="#bois_id_missing">bois_id_missing</a>
</li>
<li>
<a href="#device_mapping">device_mapping</a>
</li>
<li>
<a href="#disk_change_time_InitBootloader">disk_change_time_InitBootloader</a>
</li>
<li>
<a href="#disk_change_time_MapAllPartitions">disk_change_time_MapAllPartitions</a>
</li>
<li>
<a href="#disk_change_time_checkCallingDiskInfo">disk_change_time_checkCallingDiskInfo</a>
</li>
<li>
<a href="#floppy_devices">floppy_devices</a>
</li>
<li>
<a href="#md_info">md_info</a>
</li>
<li>
<a href="#mountpoints">mountpoints</a>
</li>
<li>
<a href="#multipath_mapping">multipath_mapping</a>
</li>
<li>
<a href="#partinfo">partinfo</a>
</li>
</ul>
<h1>Global Functions</h1>
<ul>
<li>
<a href="#DisksOrder">DisksOrder ()</a>
</li>
<li>
<a href="#InitDiskInfo">InitDiskInfo ()</a>
</li>
<li>
<a href="#InitMapDevices">InitMapDevices ()</a>
</li>
<li>
<a href="#getFloppyDevices">getFloppyDevices ()</a>
</li>
<li>
<a href="#getHintedPartitionList">getHintedPartitionList (list<string> parts_to_get)</a>
</li>
<li>
<a href="#getPartitionList">getPartitionList (symbol type, string bl)</a>
</li>
<li>
<a href="#remapDeviceMap">remapDeviceMap (map<string,string> device_map)</a>
</li>
</ul>
<h1>Local Variables</h1>
<ul>
<li>
<a href="#storage_initialized">storage_initialized</a>
</li>
<li>
<a href="#target_map">target_map</a>
</li>
</ul>
<h1>Local Functions</h1>
<ul>
<li>
<a href="#MapAllPartitions">MapAllPartitions ()</a>
</li>
<li>
<a href="#changeOrderInDeviceMapping">changeOrderInDeviceMapping (list<string> bad_devices)</a>
</li>
<li>
<a href="#checkCallingDiskInfo">checkCallingDiskInfo ()</a>
</li>
<li>
<a href="#checkMDRaidDevices">checkMDRaidDevices (list<string> devices, map<string,map> tm)</a>
</li>
<li>
<a href="#getKey">getKey (string value, map<string, string> mapping)</a>
</li>
<li>
<a href="#isDiskInList">isDiskInList (string disk, list<string> devices)</a>
</li>
<li>
<a href="#isDiskInMDRaid">isDiskInMDRaid (string disk, map<string,map> tm)</a>
</li>
<li>
<a href="#isHd0">isHd0 (list<string> devices)</a>
</li>
</ul>
</td>
</tr>
</table>
</div>
<p />
<div class="sigbox">
<span class="sig" id="disk_change_time_InitBootloader">global
<b>disk_change_time_InitBootloader
<span class="a"> -> </span>
<span class="t">integer</span>
</b>
</span>
</div>
<p>
Saved change time from target map - only for MapAllPartitions()</p>
<div class="sigbox">
<span class="sig" id="disk_change_time_MapAllPartitions">global
<b>disk_change_time_MapAllPartitions
<span class="a"> -> </span>
<span class="t">integer</span>
</b>
</span>
</div>
<p>
Saved change time from target map - only for MapAllPartitions()</p>
<div class="sigbox">
<span class="sig" id="disk_change_time_checkCallingDiskInfo">global
<b>disk_change_time_checkCallingDiskInfo
<span class="a"> -> </span>
<span class="t">integer</span>
</b>
</span>
</div>
<p>
Saved change time from target map - only for checkCallingDiskInfo()</p>
<div class="sigbox">
<span class="sig" id="all_partitions">global
<b>all_partitions
<span class="a"> -> </span>
<span class="t">map<string,map></span>
</b>
</span>
</div>
<p>
bnc #468922 - problem with longtime running the parsing a huge number of disks
map<string,map> the map of all partitions with info about it ->
necessary for Dev2MountByDev() in routines/misc.ycp </p>
<div class="sigbox">
<span class="sig" id="target_map">local
<b>target_map
<span class="a"> -> </span>
<span class="t">map<string,map></span>
</b>
</span>
</div>
<p>
bnc #468922 - problem with longtime running the parsing a huge number of disks
map<string,map> target map try to minimalize calling Storage::GetTargetMap()</p>
<div class="sigbox">
<span class="sig" id="all_devices">global
<b>all_devices
<span class="a"> -> </span>
<span class="t">map<string, string></span>
</b>
</span>
</div>
<p>
mapping all devices udev-name to kernel name
importnat for init fucntion of perl-Bootloader</p>
<div class="sigbox">
<span class="sig" id="storage_initialized">local
<b>storage_initialized
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Storage locked</p>
<div class="sigbox">
<span class="sig" id="multipath_mapping">global
<b>multipath_mapping
<span class="a"> -> </span>
<span class="t">map<string,string></span>
</b>
</span>
</div>
<p>
device mapping between real devices and multipath</p>
<div class="sigbox">
<span class="sig" id="mountpoints">global
<b>mountpoints
<span class="a"> -> </span>
<span class="t">map<string,any></span>
</b>
</span>
</div>
<p>
mountpoints for perl-Bootloader</p>
<div class="sigbox">
<span class="sig" id="partinfo">global
<b>partinfo
<span class="a"> -> </span>
<span class="t">list<list></span>
</b>
</span>
</div>
<p>
list of all partitions for perl-Bootloader</p>
<div class="sigbox">
<span class="sig" id="md_info">global
<b>md_info
<span class="a"> -> </span>
<span class="t">map<string,list<string> ></span>
</b>
</span>
</div>
<p>
information about MD arrays for perl-Bootloader</p>
<div class="sigbox">
<span class="sig" id="bois_id_missing">global
<b>bois_id_missing
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Flag indicates that bios_id_missing in disk
true if missing false if at least one disk has bios_id</p>
<div class="sigbox">
<span class="sig" id="device_mapping">global
<b>device_mapping
<span class="a"> -> </span>
<span class="t">map<string,string></span>
</b>
</span>
</div>
<p>
device mapping between Linux and firmware</p>
<div class="sigbox">
<span class="sig" id="BootPartitionDevice">global
<b>BootPartitionDevice
<span class="a"> -> </span>
<span class="t">string</span>
</b>
</span>
</div>
<p>
string sepresenting device name of /boot partition
same as RootPartitionDevice if no separate /boot partition</p>
<div class="sigbox">
<span class="sig" id="RootPartitionDevice">global
<b>RootPartitionDevice
<span class="a"> -> </span>
<span class="t">string</span>
</b>
</span>
</div>
<p>
string representing device name of / partition</p>
<div class="sigbox">
<span class="sig" id="ExtendedPartitionDevice">global
<b>ExtendedPartitionDevice
<span class="a"> -> </span>
<span class="t">string</span>
</b>
</span>
</div>
<p>
string representing device name of extended partition</p>
<div class="sigbox">
<span class="sig" id="floppy_devices">global
<b>floppy_devices
<span class="a"> -> </span>
<span class="t">list<string></span>
</b>
</span>
</div>
<p>
list of installed floppy devices</p>
<div class="sigbox">
<span class="sig" id="InitMapDevices">global
<b>InitMapDevices ()
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Init and fullfil internal data for perl-Bootloader</p>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">true if init reset/fullfil data or false and used cached data</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="MapAllPartitions">local
<b>MapAllPartitions ()
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
bnc #468922 - problem with longtime running the parsing a huge number of disks
Function initialize all_partitions only if storage change
partitioning of disk
true if init all_partitions</p>
<div class="sigbox">
<span class="sig" id="checkCallingDiskInfo">local
<b>checkCallingDiskInfo ()
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Check if function was called or storage change
partitionig of disk. It is usefull fo using cached data
about disk. Data is send to perl-Bootloader and it includes
info about partitions, multi path and md-raid</p>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">false if it is posible use cached data</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="InitDiskInfo">global
<b>InitDiskInfo ()
<span class="a"> -> </span>
<span class="t">void</span>
</b>
</span>
</div>
<p>
Function init data for perl-Bootloader about disk
It means fullfil md_info, multipath_mapping, partinfo
and mountpoints</p>
<div class="sigbox">
<span class="sig" id="isHd0">local
<b>isHd0 (list<string> devices)
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Returns true if any device from list devices is in device_mapping
marked as hd0.</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">devices</span>
</td>
<td class="descbox"></td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="getKey">local
<b>getKey (string value, map<string, string> mapping)
<span class="a"> -> </span>
<span class="t">string</span>
</b>
</span>
</div>
<p>
Returns first key from mapping associated with value.
Example:
map = $[ "a" : "1",
"b" : "2",
"c" : "3",
"d" : "2"];
getDeviceFromMapping("1", map) -> "a"
getDeviceFromMapping("2", map) -> "b"</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">value</span>
</td>
<td class="descbox"></td>
</tr>
<tr>
<td class="pbox">
<span class="p">mapping</span>
</td>
<td class="descbox"></td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="changeOrderInDeviceMapping">local
<b>changeOrderInDeviceMapping (list<string> bad_devices)
<span class="a"> -> </span>
<span class="t">void</span>
</b>
</span>
</div>
<p>
This function changes order of devices in device_mapping.
All devices listed in bad_devices are maped to "hdN" are moved to the end
(with changed number N). And second step is putting device with boot partition
on top (i.e. device_mapping[dev_with_boot] = "hd0").</p>
<p>
Example:
device_mapping = $[ "/dev/sda" : "hd0",
"/dev/sdb" : "hd1",
"/dev/sdc" : "hd2",
"/dev/sdd" : "hd3",
"/dev/sde" : "hd4" ];
bad_devices = [ "/dev/sda", "/dev/sdc" ];</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">bad_devices</span>
</td>
<td class="descbox"></td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="checkMDRaidDevices">local
<b>checkMDRaidDevices (list<string> devices, map<string,map> tm)
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Check if MD raid is build on disks not on paritions</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">devices</span>
</td>
<td class="descbox">- list of devices from MD raid</td>
</tr>
<tr>
<td class="pbox">
<span class="p">tm</span>
</td>
<td class="descbox">- unfiltered target map</td>
</tr>
</table>
</dd>
</dl>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">- true if MD RAID is build on disks (not on partitions) </td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="isDiskInList">local
<b>isDiskInList (string disk, list<string> devices)
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Function check if disk is in list of devices</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">disk</span>
</td>
<td class="descbox"></td>
</tr>
<tr>
<td class="pbox">
<span class="p">devices</span>
</td>
<td class="descbox"></td>
</tr>
</table>
</dd>
</dl>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">true if success</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="isDiskInMDRaid">local
<b>isDiskInMDRaid (string disk, map<string,map> tm)
<span class="a"> -> </span>
<span class="t">boolean</span>
</b>
</span>
</div>
<p>
Check if disk is in MDRaid it means completed disk is used in RAID</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">disk</span>
</td>
<td class="descbox">(/dev/sda)</td>
</tr>
<tr>
<td class="pbox">
<span class="p">tm</span>
</td>
<td class="descbox">- target map</td>
</tr>
</table>
</dd>
</dl>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">- true if disk (not only part of disk) is in MDRAID </td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">Info:</div>
<p>
Generate device map proposal, store it in internal variables.</p>
<p>
FATE #302075:
When user is installing from USB media or any non IDE disk or bios simply
set any non IDE disk as first and user is not installing on this removable
(non IDE) disk, the order of disks proposed by bios must be changed because
of future remove of USB disk.
This function must find right place for bootloader (which is most probably
boot sector of boot partition (where /boot dir is located)) and change the
order of disks in device map.
This method is only heuristic because order of disks after remove of usb
disk can't be determined by any method.</p>
<div class="sigbox">
<span class="sig" id="DisksOrder">global
<b>DisksOrder ()
<span class="a"> -> </span>
<span class="t">list<string></span>
</b>
</span>
</div>
<p>
Get the order of disks according to BIOS mapping</p>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">a list of all disks in the order BIOS sees them</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="remapDeviceMap">global
<b>remapDeviceMap (map<string,string> device_map)
<span class="a"> -> </span>
<span class="t">map<string,string></span>
</b>
</span>
</div>
<p>
Function remap device map to device name (/dev/sda)
or to label (ufo_disk)</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">device_map</span>
</td>
<td class="descbox"></td>
</tr>
</table>
</dd>
</dl>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">new device map</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="getFloppyDevices">global
<b>getFloppyDevices ()
<span class="a"> -> </span>
<span class="t">list<string></span>
</b>
</span>
</div>
<p>
Get the list of installed floppy drives</p>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">a list of floppy devices</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="getHintedPartitionList">global
<b>getHintedPartitionList (list<string> parts_to_get)
<span class="a"> -> </span>
<span class="t">list<string></span>
</b>
</span>
</div>
<p>
Returns list of partitions with "mount by" hints. Goes through the list
of partitions passed as a parameter and creates a list of partitions with
hints according to the current partitioning requested from
yast2-storage. To be used in a combobox or menu.</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">parts_to_get</span>
</td>
<td class="descbox">list<string> partitions to list</td>
</tr>
</table>
</dd>
</dl>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">a list of strings containing a partition name and a hint (if applicable)</td>
</tr>
</table>
</dd>
</dl>
<div class="sigbox">
<span class="sig" id="getPartitionList">global
<b>getPartitionList (symbol type, string bl)
<span class="a"> -> </span>
<span class="t">list<string></span>
</b>
</span>
</div>
<p>
Returns list of partitions. Requests current partitioning from
yast2-storage and creates list of partition for combobox, menu or other
purpose.</p>
<dl>
<dt>
<b>Parameters:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="p">type</span>
</td>
<td class="descbox">symbol
`boot - for bootloader installation
`root - for kernel root
`boot_other - for bootable partitions of other systems
`all - all partitions
`parts_old - all partitions, except those what will be created
during isntallation
`deleted - all partitions deleted in current proposal
`kept - all partitions that won't be deleted, new created or formatted
`destroyed - all partition which are new, deleted or formatted</td>
</tr>
<tr>
<td class="pbox">
<span class="p">bl</span>
</td>
<td class="descbox"></td>
</tr>
</table>
</dd>
</dl>
<dl>
<dt>
<b>Return value:</b>
</dt>
<dd>
<table>
<tr>
<td class="pbox">
<span class="t" />
</td>
<td class="descbox">a list of strings</td>
</tr>
</table>
</dd>
</dl>
</div>
<div class="footer">
<hr />
<i>YaST2 Developers Documentation</i>
<img class="right" alt="" src="/usr/share/doc/packages/yast2-devtools/images/yast2-mini.png" />
</div>
</body>
</html>
ACC SHELL 2018