Author: mzugec Date: Thu Dec 23 00:32:50 2010 New Revision: 63021 URL: http://svn.opensuse.org/viewcvs/yast?rev=63021&view=rev Log: ifcfg-ethX.Y style config files for VLAN(fate#309240) 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/LanItems.ycp Modified: trunk/network/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=63021&r1=63020&r2=63021&view=diff ============================================================================== --- trunk/network/VERSION (original) +++ trunk/network/VERSION Thu Dec 23 00:32:50 2010 @@ -1 +1 @@ -2.20.9 +2.20.10 Modified: trunk/network/package/yast2-network.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.changes?rev=63021&r1=63020&r2=63021&view=diff ============================================================================== --- trunk/network/package/yast2-network.changes (original) +++ trunk/network/package/yast2-network.changes Thu Dec 23 00:32:50 2010 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Dec 23 00:32:23 CET 2010 - mzugec@suse.cz + +- ifcfg-ethX.Y style config files for VLAN(fate#309240) +- 2.20.10 + +------------------------------------------------------------------- Mon Dec 20 11:37:02 CET 2010 - mzugec@suse.cz - fate#306855: FCoE boot support Modified: trunk/network/src/lan/address.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/address.ycp?rev=63021&r1=63020&r2=63021&view=diff ============================================================================== --- trunk/network/src/lan/address.ycp (original) +++ trunk/network/src/lan/address.ycp Thu Dec 23 00:32:50 2010 @@ -126,6 +126,7 @@ void InitVLANSlave(string key) { settings["ETHERDEVICE"] = NetworkInterfaces::Current["ETHERDEVICE"]:""; + settings["VLAN_ID"] = tointeger(NetworkInterfaces::Current["VLAN_ID"]:"0"); list items = []; // unconfigured devices @@ -143,10 +144,21 @@ items = add (items, `item(`id(devname), sformat("%1 - %2", devname, configurations[devtype, devname, "NAME"]:""), settings["ETHERDEVICE"]:""==devname) ); }); }); - UI::ChangeWidget(`id(key), `Items, items); + UI::ChangeWidget(`id(`vlan_eth), `Items, items); + UI::ChangeWidget(`id(`vlan_id), `Value, settings["VLAN_ID"]:0); } +symbol HandleVLANSlave(string key, map event){ + if (event["EventReason"]:""=="ValueChanged"){ + string configname = sformat("%1.%2", UI::QueryWidget(`id(`vlan_eth), `Value), UI::QueryWidget(`id(`vlan_id), `Value)); + NetworkInterfaces::Name = configname; + LanItems::Items[LanItems::current, "ifcfg"]= configname; + UI::ChangeWidget(`id("IFCFGID"), `Value, configname); + } + return nil; +} + /** * Default function to store the value of ETHERDEVICE devices box. @@ -155,7 +167,8 @@ */ void StoreVLANSlave(string key, map event) { - settings["ETHERDEVICE"] = (string)UI::QueryWidget (`id(key), `Value); + settings["ETHERDEVICE"] = (string)UI::QueryWidget (`id(`vlan_eth), `Value); + settings["VLAN_ID"] = UI::QueryWidget (`id(`vlan_id), `Value); } @@ -733,11 +746,15 @@ "help": help["bridge_ports"]:"", ], "ETHERDEVICE": $[ - "widget": `combobox, - "label": _("Real Interface for &VLAN"), - "items" : [ ], + "widget": `custom, + "custom_widget": + `HBox( + `ComboBox(`id(`vlan_eth), `opt(`notify), _("Real Interface for &VLAN"), []), + `IntField(`id(`vlan_id), `opt(`notify), _("VLAN id"), 0, 9999, 0) + ), "opt": [`hstretch], "init": InitVLANSlave, + "handle": HandleVLANSlave, "store": StoreVLANSlave, "help": help["etherdevice"]:"", ], @@ -1005,7 +1022,7 @@ // interface types. It will work in some cases, like // overriding eth to wlan but not in others where we would // need to change the contents of the dialog. #30890. - "IFCFGTYPE", + LanItems::type!="vlan" ? "IFCFGTYPE" : `Empty(), `HSpacing(1.5), `MinWidth(30, "IFCFGID"), `HSpacing(0.5), @@ -1260,6 +1277,9 @@ if (LanItems::type == "vlan"){ LanItems::vlan_etherdevice = settings["ETHERDEVICE"]:""; +y2internal("%1, %2", LanItems::vlan_id, (integer)settings["VLAN_ID"]:0); + LanItems::vlan_id = tostring((integer)settings["VLAN_ID"]:0); +y2internal("%1", LanItems::vlan_id); } else if (LanItems::type == "br"){ LanItems::bridge_ports = settings["BRIDGE_PORTS"]:""; } else if (contains(["tun", "tap"], LanItems::type)){ Modified: trunk/network/src/lan/hardware.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/hardware.ycp?rev=63021&r1=63020&r2=63021&view=diff ============================================================================== --- trunk/network/src/lan/hardware.ycp (original) +++ trunk/network/src/lan/hardware.ycp Thu Dec 23 00:32:50 2010 @@ -530,6 +530,10 @@ y2milestone("interface without hwinfo, proposing STARTMODE=auto"); LanItems::startmode="auto"; } + if (LanItems::type=="vlan"){ + string vlanid=(string) UI::QueryWidget(`id(`num), `Value); + NetworkInterfaces::Current["VLAN_ID"] = vlanid; + } } string driver = (string) UI::QueryWidget(`modul, `Value); Modified: trunk/network/src/modules/LanItems.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp?rev=63021&r1=63020&r2=63021&view=diff ============================================================================== --- trunk/network/src/modules/LanItems.ycp (original) +++ trunk/network/src/modules/LanItems.ycp Thu Dec 23 00:32:50 2010 @@ -85,6 +85,7 @@ // VLAN option global string vlan_etherdevice=""; +global string vlan_id=""; // interfaces attached to bridge (list delimited by ' ') global string bridge_ports=""; @@ -832,6 +833,7 @@ usercontrol = GetDeviceVar (devmap, defaults, "USERCONTROL") == "yes"; description = GetDeviceVar (devmap, defaults, "NAME"); bond_option = GetDeviceVar(devmap, defaults, "BONDING_MODULE_OPTS"); + vlan_id = GetDeviceVar(devmap, defaults, "VLAN_ID"); bond_slaves=[]; foreach(any key, any value, devmap, @@ -1063,7 +1065,9 @@ newdev["NAME"] = description; // L3: bnc#585458 // if (!issubstring(Items[current, "ifcfg"]:"", type)) newdev["INTERFACETYPE"]=type; - if (deletechars(Items[current, "ifcfg"]:"", "0123456789")!=type) newdev["INTERFACETYPE"]=type; + // exception for VLAN + // because of ethX.Y +// if (deletechars(Items[current, "ifcfg"]:"", "0123456789")!=type && type!="vlan") newdev["INTERFACETYPE"]=type; if(hotplug == "pcmcia") newdev["DHCLIENT_SET_DOWN_LINK"] = "yes"; @@ -1092,6 +1096,7 @@ if (type=="vlan"){ newdev["ETHERDEVICE"]=vlan_etherdevice; + newdev["VLAN_ID"]=vlan_id; } if (type=="br"){ newdev["BRIDGE_PORTS"]=bridge_ports; @@ -1158,6 +1163,7 @@ } NetworkInterfaces::Name = Items[current, "ifcfg"]:""; NetworkInterfaces::Current = newdev; +y2internal("%1", newdev); if (!NetworkInterfaces::Commit()) Items[current, "ifcfg"]=""; } else { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org