Author: snwint
Date: Mon Aug 8 15:28:20 2011
New Revision: 65283
URL: http://svn.opensuse.org/viewcvs/yast?rev=65283&view=rev
Log:
- support md raid1 setups (fate #305008)
Modified:
branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION
branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes
branches/SuSE-Code-11-SP1-Branch/bootloader/src/grub/misc.ycp
branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootCommon.ycp
branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp
branches/SuSE-Code-11-SP1-Branch/bootloader/src/routines/lib_iface.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION?rev=65283&r1=65282&r2=65283&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION (original)
+++ branches/SuSE-Code-11-SP1-Branch/bootloader/VERSION Mon Aug 8 15:28:20 2011
@@ -1 +1 @@
-2.17.75
+2.17.76
Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes?rev=65283&r1=65282&r2=65283&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes (original)
+++ branches/SuSE-Code-11-SP1-Branch/bootloader/package/yast2-bootloader.changes Mon Aug 8 15:28:20 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Aug 8 15:25:31 CEST 2011 - snwint@suse.de
+
+- support md raid1 setups (fate #305008)
+- 2.17.76
+
+-------------------------------------------------------------------
Mon Aug 1 18:16:07 CEST 2011 - snwint@suse.de
- yast2-storage uses fake uuids for btrfs handling; adjust our code
Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/src/grub/misc.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/grub/misc.ycp?rev=65283&r1=65282&r2=65283&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/bootloader/src/grub/misc.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/grub/misc.ycp Mon Aug 8 15:28:20 2011
@@ -927,6 +927,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
@@ -962,6 +963,9 @@
map out = (map)SCR::Execute (.target.bash_output, command);
y2milestone ("Command output: %1", out);
}
+ md_mbr = BootCommon::addMDSettingsToGlobals();
+ if (md_mbr != "")
+ BootCommon::globals["boot_md_mbr"] = md_mbr;
}
y2milestone("(2) globals: %1", BootCommon::globals);
@@ -973,6 +977,9 @@
(!(Mode::autoinst() && (BootCommon::cached_settings_base_data_change_time == nil)))))
{
grub_ProposeDeviceMap ();
+ md_mbr = BootCommon::addMDSettingsToGlobals();
+ if (md_mbr != "")
+ BootCommon::globals["boot_md_mbr"] = md_mbr;
}
if ( ! Mode::autoinst () ) {
Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootCommon.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootCommon.ycp?rev=65283&r1=65282&r2=65283&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootCommon.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootCommon.ycp Mon Aug 8 15:28:20 2011
@@ -226,6 +226,12 @@
*/
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 = [];
+
/**
* Option types for different bootloaders
*/
@@ -406,7 +412,10 @@
global list<string> bootloaders = ["lilo", "grub", "elilo", "milo", "silo",
"aboot", "zipl", "ppc", "mips"];
-
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * if true enable redundancy for md array
+ */
+global boolean enable_md_array_redundancy = true;
/**
* bnc #468922 - problem with longtime running the parsing a huge number of disks
@@ -428,6 +437,8 @@
global define boolean UsingXenPae();
global map CreateLinuxSection (string title);
global string UpdateSerialConsole (string append, string console);
+global string addMDSettingsToGlobals ();
+global boolean VerifyMDArray ();
//
@@ -1000,6 +1011,18 @@
// bnc #436899
ConvertXENinDomU ();
+ if (VerifyMDArray())
+ {
+ if ((enable_md_array_redundancy != true) && (haskey(my_globals, "boot_md_mbr")))
+ my_globals = remove(my_globals, "boot_md_mbr");
+ if ((enable_md_array_redundancy == true ) && (!haskey(my_globals, "boot_md_mbr")))
+ my_globals["boot_md_mbr"] = BootCommon::addMDSettingsToGlobals();
+
+ } else {
+ if (haskey(globals, "boot_md_mbr"))
+ my_globals = remove(my_globals, "boot_md_mbr");
+ }
+
ret = ret && DefineMultipath(multipath_mapping);
ret = ret && SetDeviceMap (my_device_mapping);
ret = ret && SetSections (sections);
@@ -1360,6 +1383,177 @@
return sectnum;
}
+/** 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 = tostring(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 tm taregte map from storage
+ * @param string device (md device)
+ * @return true if device is from 2 partisions with same number and different disks
+ */
+boolean checkMDDevices(map tm, string device)
+{
+ boolean ret = false;
+ map tm_dm = (map) tm["/dev/md"]:$[];
+
+ md_physical_disks = [];
+ // find partitions in target map
+ foreach(map p, tm_dm["partitions"]:[],
+ {
+ if (p["device"]:"" == device)
+ {
+ if (p["raid_type"]:"" == "raid1")
+ {
+ list <string> p_devices = p["devices"]:[];
+ if (size(p_devices) == 2)
+ ret = checkDifferentDisks(p_devices);
+ else
+ y2milestone("Device: %1 doesn't contain 2 partitions: %2", device, p_devices);
+
+ } else {
+ y2milestone ("Device: %1 is not on raid1: %2",device, p["raid_type"]:"");
+ }
+ }
+ });
+
+ if ((size(md_physical_disks) != 2) || (contains(md_physical_disks, "")))
+ y2milestone("device: %1 is based on md_physical_disks: %2 is not valid for enable redundancy",
+ device, md_physical_disks);
+
+ if (ret)
+ y2milestone("device: %1 is based on md_physical_disks: %2 is valid for enable redundancy",
+ device, md_physical_disks);
+
+ return ret;
+}
+
+
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * Function check partitions and set redundancy available if
+ * partitioning of disk allows it.
+ * It means if md array is based on 2 partitions with same number but 2 different disks
+ * E.g. /dev/md0 is from /dev/sda1 and /dev/sb1 and /dev/md0 is "/"
+ * There is possible only boot from MBR (GRUB not generic boot code)
+ *
+ * @return boolean true on success
+ */
+
+global boolean checkMDSettings ()
+{
+ boolean ret = false;
+ map tm = (map)Storage::GetTargetMap();
+
+ if (!haskey(tm, "/dev/md"))
+ {
+ y2milestone("Doesn't include md raid");
+ return ret;
+ }
+ list<string> boot_devices = [];
+ if ((BootPartitionDevice != "") && (BootPartitionDevice != nil))
+ boot_devices = add(boot_devices, BootPartitionDevice);
+ if ((BootPartitionDevice != RootPartitionDevice) && (RootPartitionDevice != "")
+ && (BootPartitionDevice != nil))
+ boot_devices = add(boot_devices, RootPartitionDevice);
+ if ((ExtendedPartitionDevice != "")&& (ExtendedPartitionDevice != nil))
+ boot_devices = add(boot_devices, ExtendedPartitionDevice);
+
+ y2milestone("Devices for analyse of redundacy md array: %1", boot_devices);
+ foreach(string dev, boot_devices,
+ {
+ ret = checkMDDevices(tm, dev);
+ if (!ret)
+ {
+ y2milestone("Skip enable redundancy of md arrays");
+ break;
+ }
+ });
+
+ return ret;
+}
+
+/** FATE#305008: Failover boot configurations for md arrays with redundancy
+ * Function prapare disks for synchronizing of md array
+ *
+ * @return string includes disks separatet by ","
+ */
+
+global string addMDSettingsToGlobals()
+{
+ string ret = "";
+
+ if (checkMDSettings())
+ ret = mergestring(md_physical_disks,",");
+ return ret;
+}
+
+/** 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: branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp?rev=65283&r1=65282&r2=65283&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/modules/BootGRUB.ycp Mon Aug 8 15:28:20 2011
@@ -528,6 +528,32 @@
BootCommon::ProposeDeviceMap ();
}
+ if (Mode::normal())
+ {
+ string md_value = BootCommon::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);
+ }
+ }
+ }
+
importMetaData();
return ret;
Modified: branches/SuSE-Code-11-SP1-Branch/bootloader/src/routines/lib_iface.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/bootloader/src/routines/lib_iface.ycp?rev=65283&r1=65282&r2=65283&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/bootloader/src/routines/lib_iface.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/bootloader/src/routines/lib_iface.ycp Mon Aug 8 15:28:20 2011
@@ -78,12 +78,11 @@
list<list> parts = maplist (map p, (list<map>)partitions, {
string raid = "";
if( p["used_by_type"]:`UB_NONE==`UB_MD )
- raid = p["used_by"]:"";
+ raid = p["used_by_device"]:"";
string device = p["device"]:"";
// We only pass along RAID1 devices as all other causes
// severe breakage in the bootloader stack
if (raid != "") {
- raid = "/dev/" + raid;
if (haskey (md_info, raid)) {
list<string> members = md_info[raid]:[];
members = add (members, device);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org