File use-storage-activatemultipath.diff of Package yast2-multipath
Index: yast2-multipath-2.17.1/src/complex.ycp
===================================================================
--- yast2-multipath-2.17.1.orig/src/complex.ycp 2008-09-27 14:18:03.000000000 +0800
+++ yast2-multipath-2.17.1/src/complex.ycp 2008-11-21 17:44:05.000000000 +0800
@@ -33,6 +33,7 @@
textdomain "multipath";
import "Service";
+import "Storage";
integer service_status = 0;
boolean has_dumbtab = false;
@@ -2691,37 +2692,61 @@
UI::ChangeWidget(`id(`status_summary_id), `Value, info);
}
+void CallInsserv( boolean on, string name )
+{
+ y2milestone( "CallInsserv on:%1 name:%2", on, name );
+ string scrname = "/etc/init.d/" + name;
+ if( SCR::Read( .target.size, scrname )>0 )
+ {
+ string cmd = "cd / && /sbin/insserv ";
+ if( !on )
+ cmd = cmd + "-r ";
+ cmd = cmd + scrname;
+ y2milestone( "CallInsserv cmd %1", cmd );
+ map bo = (map)SCR::Execute (.target.bash_output, cmd );
+ y2milestone( "CallInsserv bo %1", bo );
+ }
+}
+
void Start_Service() {
if (service_status == 1)
return;
string prop_info = _("Use multipath failed:") + "\n";
- boolean ret = Service::Enable("boot.multipath");
- if (ret == false)
- {
- prop_info = prop_info + _("* Can not enable boot.multipath") + "\n";
- Popup::Message(prop_info);
- Update_Service_Status();
- return;
- }
- ret = Service::Enable("multipathd");
- if (ret == false)
- {
- prop_info = prop_info + _("* Can not enable multipathd") + "\n";
- Popup::Message(prop_info);
- Update_Service_Status();
- return;
- }
- /* do not check result for starting boot.multipath */
- ret = Service::Start("boot.multipath");
- ret = Service::Start("multipathd");
- if (ret == false)
- {
- prop_info = prop_info + _("* Can not start multipathd") + "\n";
- Popup::Message(prop_info);
- Update_Service_Status();
- return;
- }
+ if (Mode::normal() && Stage::normal()) {
+ boolean ret = Service::Enable("boot.multipath");
+ if (ret == false)
+ {
+ prop_info = prop_info + _("* Can not enable boot.multipath") + "\n";
+ Popup::Message(prop_info);
+ Update_Service_Status();
+ return;
+ }
+ ret = Service::Enable("multipathd");
+ if (ret == false)
+ {
+ prop_info = prop_info + _("* Can not enable multipathd") + "\n";
+ Popup::Message(prop_info);
+ Update_Service_Status();
+ return;
+ }
+ /* do not check result for starting boot.multipath */
+ ret = Service::Start("boot.multipath");
+ ret = Service::Start("multipathd");
+ if (ret == false)
+ {
+ prop_info = prop_info + _("* Can not start multipathd") + "\n";
+ Popup::Message(prop_info);
+ Update_Service_Status();
+ return;
+ }
+
+ } else {
+// CallInsserv(true, "boot.multipath");
+// CallInsserv(true, "multipathd");
+ Storage::ActivateMultipath(true);
+ }
+
service_status = 1;
Update_Service_Status();
}
@@ -2731,32 +2756,40 @@
return;
string prop_info = _("Do not use multipath failed:") + "\n";
- boolean ret = Service::Stop("multipathd");
- if (ret == false)
- {
- prop_info = prop_info + _("* Can not stop multipath") + "\n";
- Popup::Message(prop_info);
- Update_Service_Status();
- return;
- }
- /* do not check result of stopping boot.multipath */
- ret = Service::Stop("boot.multipath");
- ret = Service::Disable("multipathd");
- if (ret == false)
- {
- prop_info = prop_info + _("* Can not disable multipathd") + "\n";
- Popup::Message(prop_info);
- Update_Service_Status();
- return;
- }
- ret = Service::Disable("boot.multipath");
- if (ret == false)
- {
- prop_info = prop_info + _("* Can not disable boot.multipath") + "\n";
- Popup::Message(prop_info);
- Update_Service_Status();
- return;
- }
+ if (Mode::normal() && Stage::normal()) {
+ boolean ret = Service::Stop("multipathd");
+ if (ret == false)
+ {
+ prop_info = prop_info + _("* Can not stop multipath") + "\n";
+ Popup::Message(prop_info);
+ Update_Service_Status();
+ return;
+ }
+ /* do not check result of stopping boot.multipath */
+ ret = Service::Stop("boot.multipath");
+ ret = Service::Disable("multipathd");
+ if (ret == false)
+ {
+ prop_info = prop_info + _("* Can not disable multipathd") + "\n";
+ Popup::Message(prop_info);
+ Update_Service_Status();
+ return;
+ }
+ ret = Service::Disable("boot.multipath");
+ if (ret == false)
+ {
+ prop_info = prop_info + _("* Can not disable boot.multipath") + "\n";
+ Popup::Message(prop_info);
+ Update_Service_Status();
+ return;
+ }
+
+ } else {
+ Storage::ActivateMultipath(false);
+// CallInsserv(false, "multipathd");
+// CallInsserv(false, "boot.multipath");
+ }
+
service_status = 0;
Update_Service_Status();
}
Index: yast2-multipath-2.17.1/src/Multipath.ycp
===================================================================
--- yast2-multipath-2.17.1.orig/src/Multipath.ycp 2008-11-21 17:43:33.000000000 +0800
+++ yast2-multipath-2.17.1/src/Multipath.ycp 2008-11-21 17:43:33.000000000 +0800
@@ -46,6 +46,7 @@
import "PackageSystem";
import "Mode";
import "Stage";
+import "Storage";
global boolean config_modified = false;
@@ -81,7 +82,7 @@
/**
* work around a bug in compiling ybc with UI as Y2Namespace
- * #299258
+ * #299258
*/
any dummy = UI::GetDisplayInfo();
@@ -92,14 +93,14 @@
boolean Read_Configures()
{
boolean ret = false;
-
+
config_modified = false;
defaults_items = $[];
devices_items = [];
multipaths_items = [];
blacklist_items = [];
blacklist_exception_items = [];
-
+
/* prepare for loading built-in configurations */
SCR::Execute(.target.bash, "/sbin/multipath -t > " + builtin_multipath_conf_path);
@@ -175,14 +176,17 @@
// BNC #418703
// Checking and Installing packages only if needed (possible)
- if (Mode::normal() && Stage::normal()) {
list<string> required_pack_list = ["multipath-tools", "device-mapper"];
+ if (Mode::normal() && Stage::normal()) {
ret = PackageSystem::CheckAndInstallPackagesInteractive (required_pack_list);
if (ret == false) {
Report::Error(_("Cannot install required packages"));
return false;
}
} else {
+ import "PackagesProposal";
+ string proposal_ID = "multipath_proposal";
+ PackagesProposal::SetResolvables(proposal_ID, `package, required_pack_list);
y2milestone ("Not checking installed packages");
}
@@ -266,13 +270,19 @@
/* restart multipathd */
Progress::NextStage ();
+
if(service_status == 1) {
- if( 0 != SCR::Execute(.target.bash, "/etc/init.d/multipathd restart")) {
- Report::Error(_("Restart multipathd failed."));
- return false;
+ if (Mode::normal() && Stage::normal()) {
+ if( 0 != SCR::Execute(.target.bash, "/etc/init.d/multipathd restart")) {
+ Report::Error(_("Restart multipathd failed."));
+ return false;
+ }
+ sleep(sl);
+ } else {
+ Storage::ActivateMultipath(false);
+ Storage::ActivateMultipath(true);
+ }
}
- sleep(sl);
- }
/* Progress finished */
Progress::NextStage();