Author: mvidner
Date: Mon Jun 6 18:42:26 2011
New Revision: 64234
URL: http://svn.opensuse.org/viewcvs/yast?rev=64234&view=rev
Log:
ifcfg-ethX.Y style config files for VLAN(fate#309240)
re-applied mzugec's changes from December: r63027, r63028
Modified:
branches/SuSE-Code-11-SP2-Branch/network/package/yast2-network.changes
branches/SuSE-Code-11-SP2-Branch/network/src/lan/address.ycp
branches/SuSE-Code-11-SP2-Branch/network/src/lan/hardware.ycp
branches/SuSE-Code-11-SP2-Branch/network/src/modules/LanItems.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/network/package/yast2-network.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/network/package/yast2-network.changes?rev=64234&r1=64233&r2=64234&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/network/package/yast2-network.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/network/package/yast2-network.changes Mon Jun 6 18:42:26 2011
@@ -18,6 +18,12 @@
- 2.17.153
-------------------------------------------------------------------
+Thu Dec 23 00:44:01 CET 2010 - mzugec@suse.de
+
+- ifcfg-ethX.Y style config files for VLAN(fate#309240)
+- 2.17.152
+
+-------------------------------------------------------------------
Fri Dec 17 10:05:06 CET 2010 - mzugec@suse.de
- L3: don't propose bridge for vbox (bnc#648044)
Modified: branches/SuSE-Code-11-SP2-Branch/network/src/lan/address.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/network/src/lan/address.ycp?rev=64234&r1=64233&r2=64234&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/network/src/lan/address.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/network/src/lan/address.ycp Mon Jun 6 18:42:26 2011
@@ -124,6 +124,7 @@
void InitVLANSlave(string key)
{
settings["ETHERDEVICE"] = NetworkInterfaces::Current["ETHERDEVICE"]:"";
+ settings["VLAN_ID"] = tointeger(NetworkInterfaces::Current["VLAN_ID"]:"0");
list items = [];
map configurations = NetworkInterfaces::FilterDevices("netcard");
@@ -133,7 +134,19 @@
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;
}
/**
@@ -143,7 +156,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);
}
@@ -634,11 +648,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"]:"",
],
@@ -877,7 +895,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),
@@ -1120,6 +1138,7 @@
if (LanItems::type == "vlan"){
LanItems::vlan_etherdevice = settings["ETHERDEVICE"]:"";
+ LanItems::vlan_id = tostring((integer)settings["VLAN_ID"]:0);
} else if (LanItems::type == "br"){
LanItems::bridge_ports = settings["BRIDGE_PORTS"]:"";
} else if (contains(["tun", "tap"], LanItems::type)){
Modified: branches/SuSE-Code-11-SP2-Branch/network/src/lan/hardware.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/network/src/lan/hardware.ycp?rev=64234&r1=64233&r2=64234&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/network/src/lan/hardware.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/network/src/lan/hardware.ycp Mon Jun 6 18:42:26 2011
@@ -538,6 +538,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: branches/SuSE-Code-11-SP2-Branch/network/src/modules/LanItems.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/network/src/modules/LanItems.ycp?rev=64234&r1=64233&r2=64234&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/network/src/modules/LanItems.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/network/src/modules/LanItems.ycp Mon Jun 6 18:42:26 2011
@@ -84,6 +84,7 @@
// VLAN option
global string vlan_etherdevice="";
+global string vlan_id="";
// interfaces attached to bridge (list delimited by ' ')
global string bridge_ports="";
@@ -828,6 +829,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,
@@ -1109,7 +1111,7 @@
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;
+// if (deletechars(Items[current, "ifcfg"]:"", "0123456789")!=type) newdev["INTERFACETYPE"]=type;
if(hotplug == "pcmcia") newdev["DHCLIENT_SET_DOWN_LINK"] = "yes";
@@ -1138,6 +1140,7 @@
if (type=="vlan"){
newdev["ETHERDEVICE"]=vlan_etherdevice;
+ newdev["VLAN_ID"]=vlan_id;
}
if (type=="br"){
newdev["BRIDGE_PORTS"]=bridge_ports;
@@ -1211,6 +1214,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