Author: mzugec Date: Thu Dec 13 17:40:00 2007 New Revision: 43066 URL: http://svn.opensuse.org/viewcvs/yast?rev=43066&view=rev Log: - in Proposal() re-read NetworkDevices again (#170558) to propose correct values when toggle NM - don't propose ifplugd for NM and virtual devices (bond, vlan, br) - devices description (short, long) moved to NetworkDevices Modified: trunk/network/VERSION trunk/network/package/yast2-network.changes trunk/network/src/lan/address.ycp trunk/network/src/lan/hardware.ycp trunk/network/src/modules/Lan.ycp trunk/network/src/modules/LanItems.ycp trunk/network/src/routines/complex.ycp trunk/network/src/routines/summary.ycp trunk/network/yast2-network.spec.in Modified: trunk/network/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=43066&r1=... ============================================================================== --- trunk/network/VERSION (original) +++ trunk/network/VERSION Thu Dec 13 17:40:00 2007 @@ -1 +1 @@ -2.16.16 +2.16.17 Modified: trunk/network/package/yast2-network.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.cha... ============================================================================== --- trunk/network/package/yast2-network.changes (original) +++ trunk/network/package/yast2-network.changes Thu Dec 13 17:40:00 2007 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Thu Dec 13 18:33:06 CET 2007 - mzugec@suse.de + +- in Proposal() re-read NetworkDevices again (#170558) +to propose correct values when toggle NM +- don't propose ifplugd for NM and virtual devices (bond, vlan, br) +- devices description (short, long) moved to NetworkDevices +- 2.16.17 + +------------------------------------------------------------------- Tue Dec 11 00:01:29 CET 2007 - mzugec@suse.cz - show description for devices attached to vlan Modified: trunk/network/src/lan/address.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/address.ycp?rev=4... ============================================================================== --- trunk/network/src/lan/address.ycp (original) +++ trunk/network/src/lan/address.ycp Thu Dec 13 17:40:00 2007 @@ -650,7 +650,7 @@ */ list< list<string> > BuildTypesListCWM (list<string> types) { return maplist(string t, types, { - return [t, DeviceType(t)]; + return [t, NetworkDevices::GetDevTypeDescription(t, false)]; }); } Modified: trunk/network/src/lan/hardware.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/hardware.ycp?rev=... ============================================================================== --- trunk/network/src/lan/hardware.ycp (original) +++ trunk/network/src/lan/hardware.ycp Thu Dec 13 17:40:00 2007 @@ -99,13 +99,7 @@ if (!hasAnyValue(LanItems::nm_name) && hasAnyValue(LanItems::nm_name_old)) hardware["hwcfg"]=LanItems::nm_name_old; */ // FIXME duplicated in address.ycp - hardware["device_types"] = [ "arc", "bnep", "dummy", "eth", "fddi", "myri", "tr", "usb", "wlan", "bond", "vlan", "br" ]; - - if(Arch::s390 ()) - hardware["device_types"] = [ "eth", "tr", "hsi", "ctc", "escon", "ficon", "iucv", "qeth", "lcs", "vlan", "br" ]; - - if(Arch::ia64 ()) - hardware["device_types"] = add(hardware["device_types"]:[], "xp"); + hardware["device_types"] = NetworkDevices::GetDeviceTypes(); if(issubstring(hardware["device"]:"", "bus-pcmcia")) hardware["hotplug"] = "pcmcia"; else if(issubstring(hardware["device"]:"", "bus-usb")) hardware["hotplug"] = "usb"; Modified: trunk/network/src/modules/Lan.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/Lan.ycp?rev=4... ============================================================================== --- trunk/network/src/modules/Lan.ycp (original) +++ trunk/network/src/modules/Lan.ycp Thu Dec 13 17:40:00 2007 @@ -127,7 +127,7 @@ foreach(string devnum, (list<string>) Map::Keys(configurations[devtype]:$[]), { string confname = NetworkDevices::device_name(devtype, devnum); string mac = ((map<string, any>)SCR::Execute(.target.bash_output, sformat("cat /sys/class/net/%1/address|tr -d '\n'", confname)))["stdout"]:""; - y2internal("confname %1", mac); + y2milestone("confname %1", mac); if (!haskey(link_status, mac)) y2error("Mac address %1 not found in map %2!", mac, link_status); else if (link_status[mac]:false == false) { y2warning("Interface with mac %1 is down!", mac); @@ -228,14 +228,13 @@ // Dont read hardware data in config mode if(!Mode::config ()) { if(!NetHwDetection::running) NetHwDetection::Start(); - LanItems::ReadHw(); } sleep(sl); if(Abort()) return false; /* Progress step 3/9 - multiple devices may be present, really plural*/ ProgressNextStage(_("Reading device configuration...")); - LanItems::ReadNetworkInterfaces(); + LanItems::Read(); sleep(sl); if(Abort()) return false; @@ -688,8 +687,8 @@ if (hasAnyValue(((map)lanitem)["hwinfo", "dev_name"]:"")) { LanItems::current = number; if (!LanItems::IsItemConfigured()){ - y2internal("Nothing already configured start proposing %1 (NM)", LanItems::getCurrentItem()); - LanItems::ProposeItemConfiguration(); + y2milestone("Nothing already configured start proposing %1 (NM)", LanItems::getCurrentItem()); + LanItems::ProposeItem(); } } }); @@ -745,7 +744,7 @@ LanItems::current = number; if (!LanItems::IsItemConfigured()){ y2milestone("Nothing already configured - start proposing"); - LanItems::ProposeItemConfiguration(); + LanItems::ProposeItem(); break; } } @@ -958,6 +957,8 @@ * @return true if something was proposed */ global define boolean Propose() { +NetworkDevices::CleanCacheRead(); +LanItems::Read(); return ProposeInterfaces () && ProposeRoutesAndResolver (); Modified: trunk/network/src/modules/LanItems.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp?... ============================================================================== --- trunk/network/src/modules/LanItems.ycp (original) +++ trunk/network/src/modules/LanItems.ycp Thu Dec 13 17:40:00 2007 @@ -232,18 +232,6 @@ return mods; } -global void ReadHw(){ - Hardware = ReadHardware("netcard"); - ReadUdevRules(); - - map<string, any> udev_drivers_rules = (map<string, any>)SCR::Read(.udev_persistent.drivers); - foreach(map hwitem, Hardware, { - list udev_net = (hwitem["dev_name"]:"" != "") ? udev_net_rules[hwitem["dev_name"]:""]:[] : []; - string mod = deletechars(splitstring((udev_drivers_rules[hwitem["modalias"]:""]:[])[1]:"", "=")[1]:"", """); - Items[size(Items)] = $["hwinfo":hwitem, "udev":$["net":udev_net, "driver":mod]]; - }); -} - // get list of all configurations for "netcard" macro in NetworkDevices module list<string> getNetworkDevices(){ list<string> confs=[]; @@ -256,7 +244,21 @@ return confs; } -global void ReadNetworkInterfaces(){ +global void ReadHw(){ + Items=$[]; + Hardware = ReadHardware("netcard"); + ReadUdevRules(); + + map<string, any> udev_drivers_rules = (map<string, any>)SCR::Read(.udev_persistent.drivers); + foreach(map hwitem, Hardware, { + list udev_net = (hwitem["dev_name"]:"" != "") ? udev_net_rules[hwitem["dev_name"]:""]:[] : []; + string mod = deletechars(splitstring((udev_drivers_rules[hwitem["modalias"]:""]:[])[1]:"", "=")[1]:"", """); + Items[size(Items)] = $["hwinfo":hwitem, "udev":$["net":udev_net, "driver":mod]]; + }); +} + +global void Read(){ + ReadHw(); NetworkDevices::Read(); NetworkDevices::CleanHotplugSymlink(); @@ -796,6 +798,16 @@ y2milestone ("Not a laptop, will not prefer ifplugd"); product_startmode = hasAnyValue(Items[current, "hwinfo", "hotplug"]:"") ? "hotplug" : "auto"; } + if (product_startmode == "ifplugd" && NetworkService::IsManaged()) + { + y2milestone ("For NetworkManager will not prefer ifplugd"); + product_startmode = hasAnyValue(Items[current, "hwinfo", "hotplug"]:"") ? "hotplug" : "auto"; + } + if (product_startmode == "ifplugd" && contains(["bond", "vlan", "br"], type)) + { + y2milestone ("For virtual networktypes (bond, bridge, vlan) will not prefer ifplugd"); + product_startmode = hasAnyValue(Items[current, "hwinfo", "hotplug"]:"") ? "hotplug" : "auto"; + } devmap["STARTMODE"] = product_startmode; } @@ -1386,7 +1398,7 @@ } -global boolean ProposeItemConfiguration(){ +global boolean ProposeItem(){ y2milestone("Propose configuration for %1", getCurrentItem()); operation = nil; if(Select("") != true) return false; @@ -1402,7 +1414,8 @@ } NetworkDevices::Add(); operation = `edit; - interfacename=getCurrentItem()["hwinfo", "dev_name"]:""; +// interfacename=getCurrentItem()["hwinfo", "dev_name"]:""; + Items[current, "ifcfg"]=getCurrentItem()["hwinfo", "dev_name"]:""; description = HardwareName([getCurrentItem()["hwinfo"]:$[]], getCurrentItem()["hwinfo", "dev_name"]:""); Commit (); y2milestone("After configuration propose %1", getCurrentItem()); Modified: trunk/network/src/routines/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/routines/complex.ycp?... ============================================================================== --- trunk/network/src/routines/complex.ycp (original) +++ trunk/network/src/routines/complex.ycp Thu Dec 13 17:40:00 2007 @@ -196,120 +196,50 @@ map device_names = $[ /* Device type label */ - "arc" : _("ARCnet Network Card"), - /* Device type label */ - "atm" : _("Asynchronous Transfer Mode (ATM)"), - /* Device type label */ - "bnep" : _("Bluetooth Connection"), - /* Device type label */ - "ci" : _("Common Link Access for Workstation (CLAW)"), - /* Device type label */ - "contr" : _("ISDN Card"), - /* Device type label */ "contr-pcmcia" : _("PCMCIA ISDN Card"), /* Device type label */ "contr-usb" : _("USB ISDN Card"), /* Device type label */ - "ctc" : _("Channel to Channel Interface (CTC)"), - /* Device type label */ - "dsl" : _("DSL Connection"), - /* Device type label */ - "dummy" : _("Dummy Network Device"), - /* Device type label */ - "escon" : _("Enterprise System Connector (ESCON)"), - /* Device type label */ - "eth" : _("Ethernet Network Card"), - /* Device type label */ "eth-pcmcia" : _("PCMCIA Ethernet Network Card"), /* Device type label */ "eth-usb" : _("USB Ethernet Network Card"), /* Device type label */ - "fddi" : _("FDDI Network Card"), - /* Device type label */ "fddi-pcmcia" : _("PCMCIA FDDI Network Card"), /* Device type label */ "fddi-usb" : _("USB FDDI Network Card"), /* Device type label */ - "ficon" : _("Fiberchannel System Connector (FICON)"), - /* Device type label */ - "hippi" : _("HIgh Performance Parallel Interface (HIPPI)"), - /* Device type label */ - "hsi" : _("Hipersockets Interface (HSI)"), - /* Device type label */ - "ippp" : _("ISDN Connection"), - /* Device type label */ "ippp-pcmcia" : _("PCMCIA ISDN Connection"), /* Device type label */ "ippp-usb" : _("USB ISDN Connection"), /* Device type label */ - "irlan" : _("Infrared Network Device"), - /* Device type label */ - "irda" : _("Infrared Device"), - /* Device type label */ - "isdn" : _("ISDN Connection"), - /* Device type label */ "isdn-pcmcia" : _("PCMCIA ISDN Connection"), /* Device type label */ "isdn-usb" : _("USB ISDN Connection"), /* Device type label */ - "iucv" : _("Inter User Communication Vehicle (IUCV)"), - /* Device type label */ - "lcs" : _("OSA LCS Network Card"), - /* Device type label */ - "lo" : _("Loopback Device"), - /* Device type label */ - "modem" : _("Modem"), - /* Device type label */ "modem-pcmcia" : _("PCMCIA Modem"), /* Device type label */ "modem-usb" : _("USB Modem"), /* Device type label */ - "myri" : _("Myrinet Network Card"), - /* Device type label */ - "net" : _("ISDN Connection"), - /* Device type label */ - "plip" : _("Parallel Line Connection"), - /* Device type label */ - "ppp" : _("Modem"), - /* Device type label */ "ppp-pcmcia" : _("PCMCIA Modem"), /* Device type label */ "ppp-usb" : _("USB Modem"), /* Device type label */ - "qeth" : _("OSA-Express or QDIO Device (QETH)"), - /* Device type label */ - "sit" : _("IPv6-in-IPv4 Encapsulation Device"), - /* Device type label */ - "slip" : _("Serial Line Connection"), - /* Device type label */ - "tr" : _("Token Ring Network Card"), - /* Device type label */ "tr-pcmcia" : _("PCMCIA Token Ring Network Card"), /* Device type label */ "tr-usb" : _("USB Token Ring Network Card"), /* Device type label */ - "usb" : _("USB Network Device"), "usb-usb" : _("USB Network Device"), /* Device type label */ - "vmnet" : _("VMWare Network Device"), - /* Device type label */ - "wlan" : _("Wireless Network Card"), - /* Device type label */ "wlan-pcmcia" : _("PCMCIA Wireless Network Card"), /* Device type label */ "wlan-usb" : _("USB Wireless Network Card"), - /* Device type label */ - "xp" : _("XP Network"), - /* Device type label */ - "bond" : _("Bond Network"), - /* Device type label */ - "vlan" : _("Virtual LAN"), - /* Device type label */ - "br" : _("Network Bridge"), ]; - if(haskey(device_names, devtype)) - return device_names[devtype]:""; + if(haskey(device_names, devtype)) return device_names[devtype]:""; + else { + string descr = NetworkDevices::GetDevTypeDescription(devtype, true); + if (hasAnyValue(descr)) return descr; + } if(haskey(device_names, devtype + "-")) { y2warning("- device found: %1, %2", devtype, hwname); @@ -544,13 +474,13 @@ sformat(_("Mode: %1"), v["PPPMODE"]:_("Unknown")), startmode_descr, ]); - item = `item(`id(dev), dev, DeviceType(type), ProviderName(v["PROVIDER"]:""), rich); + item = `item(`id(dev), dev, NetworkDevices::GetDevTypeDescription(type, false), ProviderName(v["PROVIDER"]:""), rich); } /* ISDN stuff */ else if (type == "contr") { // FIXME: richtext string cname = v["NAME"]:"unknown"; - item = `item(`id(dev), dev, DeviceType(type), cname /*, "active?", ip, "?", "?"*/); + item = `item(`id(dev), dev, NetworkDevices::GetDevTypeDescription(type, false), cname /*, "active?", ip, "?", "?"*/); } /* ISDN stuff */ else if (type == "net") { @@ -658,9 +588,9 @@ case "netcard" : desc = [name, nc]; break; case "modem" : - case "dsl" : desc = [name, DeviceType (class), nc]; + case "dsl" : desc = [name, NetworkDevices::GetDevTypeDescription (class, false), nc]; break; - case "isdn" : desc = [nc, DeviceType (class), name]; + case "isdn" : desc = [nc, NetworkDevices::GetDevTypeDescription (class, false), name]; break; default : y2warning (1, "invalid class %1", class); } Modified: trunk/network/src/routines/summary.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/routines/summary.ycp?... ============================================================================== --- trunk/network/src/routines/summary.ycp (original) +++ trunk/network/src/routines/summary.ycp Thu Dec 13 17:40:00 2007 @@ -16,111 +16,7 @@ textdomain "network"; import "String"; - -/** - * Return textual device type - * @param type device type - * @return textual form of device type - * @example DeviceType("eth") -> "Ethernet" - */ -define string DeviceType(string type) { - - if(issubstring(type, "#")) - /* Device type label */ - // This is what used to be Virtual Interface (eth0:1). - // In our data model, additional addresses for an interface - // are represented as its sub-interfaces. - // And also we frequently confuse "device" and "interface" - // :-( - return _("Additional Address"); - - map device_types = $[ - /* Device type label */ - "arc" : _("ARCnet"), - /* Device type label */ - "atm" : _("ATM"), - /* Device type label */ - "bnep" : _("Bluetooth"), - /* Device type label */ - "bond" : _("Bond"), - /* Device type label */ - "ci" : _("CLAW"), - /* Device type label */ - "contr" : _("ISDN"), - /* Device type label */ - "ctc" : _("CTC"), - /* Device type label */ - "dsl" : _("DSL"), - /* Device type label */ - "dummy" : _("Dummy"), - /* Device type label */ - "escon" : _("ESCON"), - /* Device type label */ - "eth" : _("Ethernet"), - /* Device type label */ - "fddi" : _("FDDI"), - /* Device type label */ - "ficon" : _("FICON"), - /* Device type label */ - "hippi" : _("HIPPI"), - /* Device type label */ - "hsi" : _("Hipersockets"), - /* Device type label */ - "ippp" : _("ISDN"), - /* Device type label */ - "irlan" : _("IrDA"), - /* Device type label */ - "irda" : _("IrDA"), - /* Device type label */ - "isdn" : _("ISDN"), - /* Device type label */ - "iucv" : _("IUCV"), - /* Device type label */ - "lcs" : _("OSA LCS"), - /* Device type label */ - "lo" : _("Loopback"), - /* Device type label */ - "modem" : _("Modem"), - /* Device type label */ - "myri" : _("Myrinet"), - /* Device type label */ - "net" : _("ISDN"), - /* Device type label */ - "plip" : _("Parallel Line"), - /* Device type label */ - "ppp" : _("Modem"), - /* Device type label */ - "qeth" : _("QETH"), - /* Device type label */ - "sit" : _("IPv6-in-IPv4"), - /* Device type label */ - "slip" : _("Serial Line"), - /* Device type label */ - "tr" : _("Token Ring"), - /* Device type label */ - "usb" : _("USB"), - /* Device type label */ - "vmnet" : _("VMWare"), - /* Device type label */ - "wlan" : _("Wireless"), - /* Device type label */ - "xp" : _("XPNET"), - /* Device type label */ - "vlan" : _("Virtual LAN"), - /* Device type label */ - "br" : _("Network Bridge"), - ]; - - if(haskey(device_types, type)) - return device_types[type]:""; - - string type1 = String::FirstChunk (type, "-"); - if(haskey(device_types, type1)) - return device_types[type1]:""; - - y2error("Unknown type: %1", type); - return type; -} +import "NetworkDevices"; /** * Create list of Table items @@ -130,7 +26,7 @@ */ define list<term> BuildTypesList(list<string> types, string cur) { return maplist(string t, types, { - return `item(`id(t), DeviceType(t), t == cur); + return `item(`id(t), NetworkDevices::GetDevTypeDescription(t, false), t == cur); }); } Modified: trunk/network/yast2-network.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/yast2-network.spec.in?rev... ============================================================================== --- trunk/network/yast2-network.spec.in (original) +++ trunk/network/yast2-network.spec.in Thu Dec 13 17:40:00 2007 @@ -13,7 +13,7 @@ # Linuxrc::display_ip # SuSEFirewall::IsInstalled # YCP module Internet -Requires: yast2 >= 2.16.6 +Requires: yast2 >= 2.16.8 Requires: sysconfig yast2-country yast2-packager PreReq: /bin/rm @@ -36,7 +36,6 @@ @HEADER@ -Requires: yast2-network >= 2.15.53 Summary: Developer documentation for yast2-network -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org