Skip to content

Commit

Permalink
fixed detection of need for persistent mac address (bnc#728611)
Browse files Browse the repository at this point in the history
dev_name or sysfs_id are missing/wrong in the available hwinfo,
so construct sysfs_id from busid

svn path=/branches/SuSE-Code-11-SP2-Branch/network/; revision=67316
  • Loading branch information
mvidner authored and mchf committed Apr 19, 2013
1 parent a1bf28f commit 5b7778b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/clients/save_network.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ define boolean ReadInstallInf() {
if (Arch::s390()) {
y2milestone ("Interface type: %1", InstallInf["type"]:"");
// only some card types need a persistent MAC (bnc#658708)
if (! s390_device_needs_persistent_mac(netdevice,hardware)) {
string sysfs_id = dev_name_to_sysfs_id(netdevice, hardware);
if (! s390_device_needs_persistent_mac(sysfs_id, hardware)) {
InstallInf = remove (InstallInf, "hwaddr");
}
// hsi devices do not support setting hwaddr (bnc #479481)
Expand Down
13 changes: 10 additions & 3 deletions src/modules/LanItems.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,10 +1492,17 @@ global define boolean Commit() {
newdev["NETWORK"] = "";

newdev["REMOTE_IPADDR"] = remoteip;

// set LLADDR to sysconfig only for device on layer2 and only these which needs it
if (qeth_layer2 &&
s390_device_needs_persistent_mac(Items[current, "ifcfg"]:"",Hardware)){
newdev["LLADDR"] = qeth_macaddress;
if (qeth_layer2) {
string busid = Items[current, "hwinfo", "busid"]:"";
// string sysfs_id = busid_to_sysfs_id(busid, Hardware);
// sysfs id has changed from css0...
string sysfs_id = "/devices/qeth/" + busid;
y2milestone("busid %1", busid);
if (s390_device_needs_persistent_mac(sysfs_id, Hardware)) {
newdev["LLADDR"] = qeth_macaddress;
}
}

if(alias == "") {
Expand Down
15 changes: 10 additions & 5 deletions src/routines/routines.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -366,22 +366,27 @@ boolean needHwcfg(map hw){
return need;
}

string busid_to_sysfs_id(string busid, list<map> hardware) {
// hardware is cached list of netcards
map hw_item = find(map i, hardware, ``( i["busid"]:"" == busid ));
return hw_item["sysfs_id"]:"";
}

string dev_name_to_sysfs_id(string dev_name, list<map> hardware) {
// hardware is cached list of netcards
map hw_item = find(map i, hardware, ``( i["dev_name"]:"" == dev_name ));
return hw_item["sysfs_id"]:"";
}

string sysfs_card_type(string device,list<map> hardware) {
string sysfs_id = dev_name_to_sysfs_id(device,hardware);
string sysfs_card_type(string sysfs_id, list<map> hardware) {
if (sysfs_id == "") return "none";
string filename = "/sys" + sysfs_id + "/card_type";
string card_type = (string) SCR::Read(.target.string, filename);
return String::FirstChunk(card_type, "\n");
}

boolean s390_device_needs_persistent_mac(string device,list<map> hardware) {
string card_type = sysfs_card_type(device,hardware);
boolean s390_device_needs_persistent_mac(string sysfs_id,list<map> hardware) {
string card_type = sysfs_card_type(sysfs_id,hardware);
list<string> types_needing_persistent = [
"OSD_100",
"OSD_1000",
Expand All @@ -391,7 +396,7 @@ boolean s390_device_needs_persistent_mac(string device,list<map> hardware) {
"OSD_Express",
];
boolean needs_persistent = contains(types_needing_persistent, card_type);
y2milestone("Device: %1, card type: %2, needs persistent MAC: %3", device, card_type, needs_persistent);
y2milestone("Sysfs Device: %1, card type: %2, needs persistent MAC: %3", sysfs_id, card_type, needs_persistent);
return needs_persistent;
}

Expand Down

0 comments on commit 5b7778b

Please sign in to comment.