Author: juhliarik
Date: Tue Aug 4 18:01:51 2009
New Revision: 58279
URL: http://svn.opensuse.org/viewcvs/yast?rev=58279&view=rev
Log:
added support for redundancy of md array
Modified:
trunk/bootloader/VERSION
trunk/bootloader/package/yast2-bootloader.changes
trunk/bootloader/src/grub/helps.ycp
trunk/bootloader/src/grub/misc.ycp
trunk/bootloader/src/grub/options.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/BootStorage.ycp
trunk/bootloader/yast2-bootloader.spec.in
Modified: trunk/bootloader/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/VERSION?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/VERSION (original)
+++ trunk/bootloader/VERSION Tue Aug 4 18:01:51 2009
@@ -1 +1 @@
-2.18.12
+2.18.13
Modified: trunk/bootloader/package/yast2-bootloader.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/package/yast2-bootloader.changes?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/package/yast2-bootloader.changes (original)
+++ trunk/bootloader/package/yast2-bootloader.changes Tue Aug 4 18:01:51 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Aug 4 16:52:57 CEST 2009 - juhliarik@suse.cz
+
+- added support for redundancy md array (fate#305008)
+- 2.18.13
+
+-------------------------------------------------------------------
Fri Jul 31 11:55:40 CEST 2009 - aschnell@suse.de
- adapted to changes in yast2-storage
Modified: trunk/bootloader/src/grub/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/helps.ycp?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/src/grub/helps.ycp (original)
+++ trunk/bootloader/src/grub/helps.ycp Tue Aug 4 18:01:51 2009
@@ -62,6 +62,11 @@
"boot_custom" :
_("<p><b>Custom Boot Partition</b> lets you choose a partition to boot from.</p>"),
+
+ "enable_redundancy" :
+ _("<p>MD array is build from 2 disks. <b>Enable Redundancy for MD Array</b>
+enable to write GRUB to MBR of both disks.</p>"),
+
"serial" :
_("<p><b>Use Serial Console</b> lets you define the parameters to use
for a serial console. Please see the grub documentation (<code>info grub</code>) for details.</p>"),
Modified: trunk/bootloader/src/grub/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/misc.ycp?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/src/grub/misc.ycp (original)
+++ trunk/bootloader/src/grub/misc.ycp Tue Aug 4 18:01:51 2009
@@ -891,6 +891,7 @@
y2milestone("globals: %1", BootCommon::globals);
y2milestone("Mode::autoinst: %1", Mode::autoinst());
y2milestone("haskey( BootCommon::globals, boot_boot ): %1", haskey( BootCommon::globals, "boot_boot" ));
+ string md_mbr = "";
if (! BootCommon::was_proposed ||
// During autoinstall, the autoyast profile must contain a bootloader
// device specification (we currently really only support system
@@ -926,6 +927,9 @@
map out = (map)SCR::Execute (.target.bash_output, command);
y2milestone ("Command output: %1", out);
}
+ md_mbr = BootStorage::addMDSettingsToGlobals();
+ if (md_mbr != "")
+ BootCommon::globals["boot_md_mbr"] = md_mbr;
}
y2milestone("(2) globals: %1", BootCommon::globals);
@@ -935,6 +939,9 @@
|| (BootCommon::cached_settings_base_data_change_time != Storage::GetTargetChangeTime()))
{
BootStorage::ProposeDeviceMap();
+ md_mbr = BootStorage::addMDSettingsToGlobals();
+ if (md_mbr != "")
+ BootCommon::globals["boot_md_mbr"] = md_mbr;
BootCommon::InitializeLibrary (true, "grub");
}
Modified: trunk/bootloader/src/grub/options.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/options.ycp?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/src/grub/options.ycp (original)
+++ trunk/bootloader/src/grub/options.ycp Tue Aug 4 18:01:51 2009
@@ -468,21 +468,43 @@
];
}
-
/**
* Init function of a widget
* @param widget string widget key
*/
void InitBootLoaderLocationWidget(string widget) {
list<string> boot_devices = BootStorage::getPartitionList(`boot, "grub");
- list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"];
- foreach(string key, list_global_target_keys,
+ string value = "";
+ if (BootCommon::VerifyMDArray ())
{
- string value = BootCommon::globals[key]:nil;
- if (value != nil)
- UI::ChangeWidget (`id (key), `Value, (value == "true")? true: false);
- });
- UI::ChangeWidget (`id ("boot_custom_list"),`Items, boot_devices);
+ if ((BootCommon::enable_md_array_redundancy == nil) || (BootCommon::enable_md_array_redundancy))
+ UI::ChangeWidget (`id ("enable_redundancy"), `Value, true);
+ else
+ UI::ChangeWidget (`id ("enable_redundancy"), `Value, false);
+
+ value = BootCommon::globals["boot_mbr"]:nil;
+ UI::ChangeWidget (`id ("boot_mbr"), `Value, (value == "true")? true: false);
+ } else {
+ list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"];
+ foreach(string key, list_global_target_keys,
+ {
+ value = BootCommon::globals[key]:nil;
+ if (value != nil)
+ UI::ChangeWidget (`id (key), `Value, (value == "true")? true: false);
+ });
+ UI::ChangeWidget (`id ("boot_custom_list"),`Items, boot_devices);
+
+ if (BootStorage::BootPartitionDevice == BootStorage::RootPartitionDevice)
+ UI::ChangeWidget (`id ("boot_boot"), `Enabled, false);
+ else
+ UI::ChangeWidget (`id ("boot_boot"), `Enabled, true);
+
+ if (BootStorage::ExtendedPartitionDevice != nil)
+ UI::ChangeWidget (`id ("boot_extended"), `Enabled, true);
+ else
+ UI::ChangeWidget (`id ("boot_extended"), `Enabled, false);
+ }
+
if ((!haskey(BootCommon::globals,"boot_custom")) &&
(BootCommon::globals["boot_custom"]:"" == ""))
{
@@ -492,17 +514,6 @@
UI::ChangeWidget (`id ("boot_custom_list"),`Enabled, true);
UI::ChangeWidget (`id ("boot_custom_list"),`Value, BootCommon::globals["boot_custom"]:"");
}
-
- if (BootStorage::BootPartitionDevice == BootStorage::RootPartitionDevice)
- UI::ChangeWidget (`id ("boot_boot"), `Enabled, false);
- else
- UI::ChangeWidget (`id ("boot_boot"), `Enabled, true);
-
- if (BootStorage::ExtendedPartitionDevice != nil)
- UI::ChangeWidget (`id ("boot_extended"), `Enabled, true);
- else
- UI::ChangeWidget (`id ("boot_extended"), `Enabled, false);
-
}
/**
* handle function of a widget
@@ -530,12 +541,18 @@
*/
void StoreBootLoaderLocationWidget (string widget, map event) {
- list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"];
- foreach(string key, list_global_target_keys,
+ if (BootCommon::VerifyMDArray ())
{
- string value = ((boolean)UI::QueryWidget(`id(key), `Value))?"true":"false";
- BootCommon::globals[key]= value;
- });
+ BootCommon::enable_md_array_redundancy = (boolean)UI::QueryWidget(`id("enable_redundancy"), `Value);
+ BootCommon::globals["boot_mbr"]= ((boolean)UI::QueryWidget(`id("boot_mbr"), `Value))?"true":"false";
+ } else {
+ list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"];
+ foreach(string key, list_global_target_keys,
+ {
+ string value = ((boolean)UI::QueryWidget(`id(key), `Value))?"true":"false";
+ BootCommon::globals[key]= value;
+ });
+ }
if ((boolean)UI::QueryWidget(`id("boot_custom"), `Value))
BootCommon::globals["boot_custom"]= (string)UI::QueryWidget(`id("boot_custom_list"), `Value);
}
@@ -550,13 +567,18 @@
string ret = "";
ret = grub_help_messages["boot_mbr"]:"";
ret = ret + "\n";
- ret = ret + grub_help_messages["boot_root"]:"";
- ret = ret + "\n";
- ret = ret + grub_help_messages["boot_boot"]:"";
- ret = ret + "\n";
- ret = ret + grub_help_messages["boot_extended"]:"";
- ret = ret + "\n";
ret = ret + grub_help_messages["boot_custom"]:"";
+ ret = ret + "\n";
+ if (BootCommon::VerifyMDArray ())
+ {
+ ret = ret + grub_help_messages["enable_redundancy"]:"";
+ } else {
+ ret = ret + grub_help_messages["boot_root"]:"";
+ ret = ret + "\n";
+ ret = ret + grub_help_messages["boot_boot"]:"";
+ ret = ret + "\n";
+ ret = ret + grub_help_messages["boot_extended"]:"";
+ }
return ret;
}
@@ -583,6 +605,21 @@
`VStretch()
);
+ if (BootCommon::VerifyMDArray ())
+ {
+ contents = `VBox (
+ `Frame (_("Boot Loader Location"),
+ `VBox (`HBox(`HSpacing(1),`VBox(
+ `Left(`CheckBox( `id("boot_mbr"), _("Boot from &Master Boot Record"))),
+ `Left(`CheckBox( `id("enable_redundancy"), _("Enable Red&undancy for MD Array"))),
+ `Left(`CheckBox( `id("boot_custom"), `opt(`notify), _("C&ustom Boot Partition"))),
+ `Left(`ComboBox( `id("boot_custom_list"), `opt (`editable, `hstretch),"", [])),
+ `VStretch()
+ )))
+ ),
+ `VStretch()
+ );
+ }
return $[
"widget" : `custom,
"custom_widget" : contents,
Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Tue Aug 4 18:01:51 2009
@@ -297,6 +297,11 @@
global list<string> bootloaders = ["lilo", "grub", "elilo",
"zipl", "ppc"];
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * if true enable redundancy for md array
+ */
+global boolean enable_md_array_redundancy = nil;
+
global define string getLoaderType (boolean recheck);
global define list<string> getBootloaders ();
@@ -305,7 +310,7 @@
global string UpdateSerialConsole (string append, string console);
global string examineMBR (string device);
global boolean ThinkPadMBR (string disk);
-
+global boolean VerifyMDArray ();
/*
* help message and dscription definitions
*/
@@ -829,7 +834,17 @@
// convert XEN section to linux section id running in domU
// bnc #436899
ConvertXENinDomU ();
+ if (VerifyMDArray())
+ {
+ if ((enable_md_array_redundancy == false) && (haskey(my_globals, "boot_md_mbr")))
+ my_globals = remove(my_globals, "boot_md_mbr");
+ if ((enable_md_array_redundancy) && (!haskey(my_globals, "boot_md_mbr")))
+ my_globals["boot_md_mbr"] = BootStorage::addMDSettingsToGlobals();
+ } else {
+ if (haskey(globals, "boot_md_mbr"))
+ my_globals = remove(my_globals, "boot_md_mbr");
+ }
// add check if there is memtest and delete from memtest section
// keys like append, initrd etc...
checkMemtest ();
@@ -1165,6 +1180,29 @@
return sectnum;
}
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * Verify if proposal includes md array with 2 diferent disks
+ *
+ * @return boolean true if there is md array based on 2 disks
+ */
+global boolean VerifyMDArray ()
+{
+ boolean ret = false;
+ if (haskey(globals, "boot_md_mbr"))
+ {
+ string md_array = globals["boot_md_mbr"]:"";
+ list<string> disks = splitstring(md_array,",");
+ disks = filter(string v, disks, {return (v !="");});
+ if (size(disks) == 2)
+ {
+ y2milestone("boot_md_mbr includes 2 disks: %1", disks);
+ ret = true;
+ }
+
+ }
+ return ret;
+}
+
}
/*
Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Tue Aug 4 18:01:51 2009
@@ -507,7 +507,31 @@
// FATE#305403: Bootloader beep configuration
// read status of acoustic signals
if (Mode::normal())
- GfxMenu::ReadStatusAcousticSignal();
+ {
+ GfxMenu::ReadStatusAcousticSignal();
+ string md_value = BootStorage::addMDSettingsToGlobals();
+ string pB_md_value = BootCommon::globals["boot_md_mbr"]:"";
+ if (md_value != pB_md_value)
+ {
+ if (pB_md_value != "")
+ {
+ list <string> disks = splitstring(pB_md_value,",");
+ disks = filter(string v, disks, {return (v != "");});
+ if (size(disks) == 2)
+ {
+ BootCommon::enable_md_array_redundancy = true;
+ md_value = "";
+ }
+ y2milestone("disks from md array (perl Bootloader): %1", disks);
+ }
+ if (md_value != "")
+ {
+ BootCommon::enable_md_array_redundancy = false;
+ BootCommon::globals["boot_md_mbr"] = md_value;
+ y2milestone("Add md array to globals: %1", BootCommon::globals);
+ }
+ }
+ }
return ret;
}
Modified: trunk/bootloader/src/modules/BootStorage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootStorage.ycp?rev=58279&r1=58278&r2=58279&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootStorage.ycp (original)
+++ trunk/bootloader/src/modules/BootStorage.ycp Tue Aug 4 18:01:51 2009
@@ -135,6 +135,14 @@
*/
global list<string> floppy_devices = nil;
+
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * list <string> includes physical disks used for md raid
+ */
+
+global list <string> md_physical_disks = [];
+
+
/** FATE #302219 - Use and choose persistent device names for disk devices
* Function prepare maps with mapping disks and partitions by uuid, id, path
* and label.
@@ -1047,7 +1055,7 @@
``(p["fstype"]:"" == "Linux native"
|| p["fstype"]:"" == "Extended"
|| p["fstype"]:"" == "Linux RAID"
- || p["fstype"]:"" == "MD Raid"
+ || tolower(p["fstype"]:"") == "md raid"
|| p["fstype"]:"" == "DM RAID"));
}
list<string>partition_names
@@ -1059,7 +1067,153 @@
return (list<string>)ret;
}
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * Check if devices has same partition number and if they are from different disks
+ *
+ * @param list <string> list of devices
+ * @return boolean true on success
+ */
+boolean checkDifferentDisks (list <string> devices)
+{
+ boolean ret = false;
+ list <string> disks = [];
+ string no_partition = "";
+ foreach(string dev, devices,
+ {
+ map p_dev = Storage::GetDiskPartition (dev);
+ if (!contains(disks, p_dev["disk"]:""))
+ disks=add(disks,p_dev["disk"]:"");
+ else
+ {
+ y2milestone("Same disk for md array -> disable synchronize md arrays");
+ break;
+ }
+ // add disk from partition to md_physical_disks
+ if (!contains(md_physical_disks, p_dev["disk"]:""))
+ md_physical_disks = add(md_physical_disks,p_dev["disk"]:"");
+
+ string no_p = p_dev["nr"]:"";
+ if (no_p == "")
+ {
+ y2error("Wrong number of partition: %1 from Storage::GetDiskPartition: %2", dev, p_dev);
+ break;
+ }
+ if (no_partition == "")
+ no_partition = no_p;
+ else
+ if (no_partition == no_p)
+ ret = true;
+ else
+ y2milestone("Different number of partitions -> disable synchronize md arrays");
+
+ });
+
+ y2milestone("checkDifferentDisks for devices: %1 return: %2",devices, ret);
+
+ return ret;
+}
+
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * Check if device are build from 2 partitions with same number but from different disks
+ *
+ * @param map