Author: mzugec Date: Sat Oct 4 11:36:36 2008 New Revision: 51843 URL: http://svn.opensuse.org/viewcvs/yast?rev=51843&view=rev Log: - adapt yast to configure network devices on s390 using udev (fate#304938) Modified: trunk/network/VERSION trunk/network/package/yast2-network.changes trunk/network/src/lan/hardware.ycp trunk/network/src/lan/wizards.ycp trunk/network/src/modules/LanItems.ycp Modified: trunk/network/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=51843&r1=51842&r2=51843&view=diff ============================================================================== --- trunk/network/VERSION (original) +++ trunk/network/VERSION Sat Oct 4 11:36:36 2008 @@ -1 +1 @@ -2.17.35 +2.17.36 Modified: trunk/network/package/yast2-network.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.changes?rev=51843&r1=51842&r2=51843&view=diff ============================================================================== --- trunk/network/package/yast2-network.changes (original) +++ trunk/network/package/yast2-network.changes Sat Oct 4 11:36:36 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Sat Oct 4 11:25:21 CEST 2008 - mzugec@suse.de + +- adapt yast to configure network devices on s390 using udev + (fate#304938) +- 2.17.36 + +------------------------------------------------------------------- Thu Oct 2 21:21:38 CEST 2008 - mzugec@suse.de - check NM plugin after network is up (bnc#427374) Modified: trunk/network/src/lan/hardware.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/hardware.ycp?rev=51843&r1=51842&r2=51843&view=diff ============================================================================== --- trunk/network/src/lan/hardware.ycp (original) +++ trunk/network/src/lan/hardware.ycp Sat Oct 4 11:36:36 2008 @@ -164,7 +164,7 @@ /* Text entry label */ `ComboBox(`id(`modul), `opt(`editable), _("&Module Name"), hardware["modules_from_hwinfo"]:[]), `HSpacing(0.2), - `TextEntry(`id(`options), Label::Options (), hardware["options"]:"") + `InputField(`id(`options), `opt(`hstretch), Label::Options (), hardware["options"]:"") ), `VSpacing(0.4), CheckBoxes, @@ -202,7 +202,7 @@ // TODO: Ud ... Rules `Frame(_("Udev rules"), `HBox( - `TextEntry(`id(`device_name), _("Device Name"), ""), + `InputField(`id(`device_name), `opt(`hstretch), _("Device Name"), ""), `PushButton(`id(`change_udev), _("Change")) ) ); @@ -269,7 +269,7 @@ `ReplacePoint(`id(`rp), `SelectionBox(`id(`cards), _("&Network Card"), cards)), `VSpacing(0.5), /* Text entry field */ - `TextEntry(`id(`search), `opt(`notify), _("&Search")), + `InputField(`id(`search), `opt(`hstretch, `notify), _("&Search")), `VSpacing(0.5) ); @@ -525,6 +525,8 @@ */ define any S390Dialog() { + // already configured device (on hardware layer), skip this dialog + if (size(LanItems::Items[LanItems::current, "hwinfo", "dev_name"]:"")>0) return `next; ScreenName("lan-hardware-s390"); /* S/390 dialog caption */ @@ -535,17 +537,25 @@ string helptext = ""; term contents = `Empty (); + if(LanItems::type == "qeth") { + // CHANIDS + list<string> tmp_list=splitstring(LanItems::qeth_chanids, " "); + map<string, any> chanids_map = $[ + "read" : tmp_list[0]:"", + "write" : tmp_list[1]:"", + "control" : tmp_list[2]:"" + ]; contents = `HBox( `HSpacing(6), /* Frame label */ `Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox( `VSpacing(1), /* TextEntry label */ - `TextEntry(`id(`chan_mode), _("&Port Name"), LanItems::chan_mode), + `InputField(`id(`chan_mode), `opt(`hstretch), _("&Port Name"), LanItems::chan_mode), `VSpacing(1), /* TextEntry label */ - `TextEntry(`id(`qeth_options), Label::Options (), LanItems::qeth_options), + `InputField(`id(`qeth_options), `opt(`hstretch), Label::Options (), LanItems::qeth_options), `VSpacing(1), /* CheckBox label */ `Left(`CheckBox(`id(`ipa_takeover), _("&Enable IPA Takeover"))), @@ -553,8 +563,14 @@ /* CheckBox label */ `Left(`CheckBox(`id(`qeth_layer2), `opt(`notify), _("Enable &Layer 2 Support"))), /* TextEntry label */ - `TextEntry(`id(`qeth_macaddress), _("Layer2 &MAC Address"), LanItems::qeth_macaddress), - `VSpacing(1) + `InputField(`id(`qeth_macaddress), `opt(`hstretch), _("Layer2 &MAC Address"), LanItems::qeth_macaddress), + `VSpacing(1), +// `InputField(`id(`qeth_chanids), `opt(`hstretch), _("CHAN IDS"), LanItems::qeth_chanids) + `HBox( + `InputField(`id(`qeth_chan_read), `opt(`hstretch), _("Read Channel"), chanids_map["read"]:""), + `InputField(`id(`qeth_chan_write), `opt(`hstretch), _("Write Channel"), chanids_map["write"]:""), + `InputField(`id(`qeth_chan_control), `opt(`hstretch), _("Control Channel"), chanids_map["control"]:"") + ) ), `HSpacing(2))), `HSpacing(6) ); @@ -574,7 +590,7 @@ `Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox( `VSpacing(1), /* TextEntry label */ - `TextEntry(`id(`qeth_options), Label::Options (), LanItems::qeth_options), + `InputField(`id(`qeth_options), `opt(`hstretch), Label::Options (), LanItems::qeth_options), `VSpacing(1), /* CheckBox label */ `Left(`CheckBox(`id(`ipa_takeover), _("&Enable IPA Takeover"))), @@ -582,7 +598,7 @@ /* CheckBox label */ `Left(`CheckBox(`id(`qeth_layer2), `opt(`notify), _("Enable &Layer 2 Support"))), /* TextEntry label */ - `TextEntry(`id(`qeth_macaddress), _("Layer2 &MAC Address"), LanItems::qeth_macaddress), + `InputField(`id(`qeth_macaddress), `opt(`hstretch), _("Layer2 &MAC Address"), LanItems::qeth_macaddress), `VSpacing(1) ), `HSpacing(2))), `HSpacing(6) @@ -601,10 +617,10 @@ `Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox( `VSpacing(1), /* TextEntry label */ - `TextEntry(`id(`chan_mode), _("&Port Number"), LanItems::chan_mode), + `InputField(`id(`chan_mode), `opt(`hstretch), _("&Port Number"), LanItems::chan_mode), `VSpacing(1), /* TextEntry label */ - `TextEntry(`id(`lcs_timeout), _("&LANCMD Time-Out"), LanItems::lcs_timeout) + `InputField(`id(`lcs_timeout), `opt(`hstretch), _("&LANCMD Time-Out"), LanItems::lcs_timeout) ), `HSpacing(2))), `HSpacing(6) ); @@ -625,6 +641,11 @@ ]; if(drvtype == "ctc") { + list<string> tmp_list=splitstring(LanItems::qeth_chanids, " "); + map<string, any> chanids_map = $[ + "read" : tmp_list[0]:"", + "write" : tmp_list[1]:"", + ]; contents = `HBox( `HSpacing(6), /* Frame label */ @@ -632,7 +653,11 @@ `VSpacing(1), /* TextEntry label */ `ComboBox(`id(`chan_mode), _("&Protocol"), ctcitems), - `VSpacing(1) + `VSpacing(1), + `HBox( + `InputField(`id(`qeth_chan_read), `opt(`hstretch), _("Read Channel"), chanids_map["read"]:""), + `InputField(`id(`qeth_chan_write), `opt(`hstretch), _("Write Channel"), chanids_map["write"]:"") + ) ), `HSpacing(2))), `HSpacing(6) ); @@ -647,7 +672,7 @@ `Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox( `VSpacing(1), /* TextEntry label, #42789 */ - `TextEntry(`id(`chan_mode), _("&Peer Name"), ""), + `InputField(`id(`chan_mode), `opt(`hstretch), _("&Peer Name"), ""), `VSpacing(1) ), `HSpacing(2))), `HSpacing(6) @@ -702,25 +727,14 @@ break; } else if(ret == `next) { - break; - } - else if(ret == `qeth_layer2) { - continue; - } - else { - y2error("Unexpected return code: %1", ret); - continue; - } - } - - if(ret == `next) { if(LanItems::type == "iucv") { // #176330, must be static LanItems::nm_name = "static-iucv-id-" + (string) UI::QueryWidget(`id(`chan_mode), `Value); LanItems::device = "id-" + (string) UI::QueryWidget(`id(`chan_mode), `Value); } - else if (LanItems::type != "hsi") - LanItems::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), `Value); + if (LanItems::type != "hsi") + LanItems::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), `Value); + if(LanItems::type == "lcs") LanItems::lcs_timeout = (string) UI::QueryWidget(`id(`lcs_timeout), `Value); if(LanItems::type == "qeth" || LanItems::type == "hsi") { @@ -729,7 +743,25 @@ LanItems::qeth_layer2 = (boolean) UI::QueryWidget(`id(`qeth_layer2), `Value); LanItems::qeth_macaddress = (string) UI::QueryWidget(`id(`qeth_macaddress), `Value); } - + string read = (string) UI::QueryWidget(`id(`qeth_chan_read), `Value); + string write = (string) UI::QueryWidget(`id(`qeth_chan_write), `Value); + string control = (string) UI::QueryWidget(`id(`qeth_chan_control), `Value); + if (control==nil) control=""; + LanItems::qeth_chanids = String::CutBlanks( sformat("%1 %2 %3", read, write, control) ); + if (!LanItems::createS390Device()){ + Popup::Error(_("An error occured while creating device.\nSee YaST log for details.")); + ret=nil; + continue; + }; + break; + } + else if(ret == `qeth_layer2) { + continue; + } + else { + y2error("Unexpected return code: %1", ret); + continue; + } } return ret; Modified: trunk/network/src/lan/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/wizards.ycp?rev=51843&r1=51842&r2=51843&view=diff ============================================================================== --- trunk/network/src/lan/wizards.ycp (original) +++ trunk/network/src/lan/wizards.ycp Sat Oct 4 11:36:36 2008 @@ -155,7 +155,8 @@ if(action == "add") ws_start = "hardware"; /* All S/390 network devices */ - if(Arch::s390 () && LanItems::operation == `add) { +// if(Arch::s390 () && LanItems::operation == `add) { + if(Arch::s390 () ) { ws_start = "s390"; } Modified: trunk/network/src/modules/LanItems.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp?rev=51843&r1=51842&r2=51843&view=diff ============================================================================== --- trunk/network/src/modules/LanItems.ycp (original) +++ trunk/network/src/modules/LanItems.ycp Sat Oct 4 11:36:36 2008 @@ -127,6 +127,7 @@ // MAC address handling for IPv4 with the layer2 option global boolean qeth_layer2 = false; global string qeth_macaddress = "00:00:00:00:00:00"; +global string qeth_chanids = ""; // Timeout for LCS LANCMD global string lcs_timeout = "5"; @@ -552,7 +553,7 @@ rich = " " + conn + "<br>" + mac_dev; rich = HTML::Bold ( descr ) + rich; - if (!hasAnyValue(Items[key, "hwinfo", "dev_name"]:"") && size(Items[key, "hwinfo"]:$[])>0) + if (!hasAnyValue(Items[key, "hwinfo", "dev_name"]:"") && size(Items[key, "hwinfo"]:$[])>0 && !Arch::s390()) rich = rich + _("<p>Unable to configure the network card because the kernel device (eth0, wlan0) is not present. This is mostly caused by missing firmware (for wlan devices). See dmesg output for details.</p>"); else if (hasAnyValue(Items[key, "ifcfg"]:"") ) rich = rich + HTML::List (bullets); else { @@ -1577,8 +1578,62 @@ global boolean enableCurrentEditButton(){ if (needFirmwareCurrentItem()) return true; + if (Arch::s390()) return true; if (!hasAnyValue(LanItems::getCurrentItem()["hwinfo", "dev_name"]:"") && size(LanItems::getCurrentItem()["hwinfo"]:$[])>0) return false; else return true; } +global boolean createS390Device(){ + y2milestone("creating device s390 network device"); + boolean result=true; + // command to create device + string command1=""; + // command to find created device + string command2=""; + switch(type){ + case "qeth": + // chan_ids (read, write, control), port + command1=sformat("qeth_configure -p %1 %2 1", chan_mode, qeth_chanids); + command2=sformat("ls /sys/devices/%1/%2/net/|head -n1|tr -d '\n'", type, (splitstring(qeth_chanids, " "))[0]:""); + break; + case "ctc": + // chan_ids (read, write), protocol + command1=sformat("ctc_configure %1 1 %2", qeth_chanids, chan_mode); + command2=sformat("ls /sys/devices/cu3088/%1/net/|head -n1|tr -d '\n'", (splitstring(qeth_chanids, " "))[0]:""); + break; + case "iucv": + // router + command1=sformat("iucv_configure %1", chan_mode); + command2=sformat("ls /sys/devices/%1/*/net/|head -n1|tr -d '\n'", type); + break; + default: + y2error("Unsupported type : %1", type); + } + y2milestone("execute %1", command1); + map<string, any> output1=(map<string, any>) SCR::Execute(.target.bash_output, command1); + if (output1["exit"]:-1==0 && size(output1["stderr"]:"")==0) y2milestone("Success : %1", output1); + else{ + y2error("Problem occured : %1", output1); + result=false; + } + y2milestone("output1 %1", output1); + + + if (result){ + y2milestone("command2 %1", command2); + map<string, any> output2=(map<string, any>) SCR::Execute(.target.bash_output, command2); + y2milestone("output2 %1", output2); + if (output2["exit"]:-1==0 && size(output2["stderr"]:"")==0){ + Items[current, "ifcfg"] = output2["stdout"]:""; + Items[current, "hwinfo", "dev_name"] = output2["stdout"]:""; + y2milestone("Device %1 created", output2["stdout"]:""); + }else{ + y2error("Some problem occured : %1", output2); + result=false; + } + } + + return result; +} + } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org