Skip to content

Commit

Permalink
Merge pull request #281 from mchf/fate316140-vlanid
Browse files Browse the repository at this point in the history
Configure vlan at install time
  • Loading branch information
mchf committed Jan 19, 2015
2 parents 0aa87d2 + cac4703 commit 3ee7b04
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.17.202
2.17.203
8 changes: 8 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Jan 19 08:07:42 UTC 2015 - mfilka@suse.com

- fate#316140
- configure vlan during installation when vlan id is provided by
user / linuxrc
- 2.17.203

-------------------------------------------------------------------
Wed Jan 14 11:26:43 UTC 2015 - mfilka@suse.com

Expand Down
43 changes: 29 additions & 14 deletions src/clients/save_network.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ define boolean ReadInstallInf() {
install_inf = .etc.install_inf;
InstallInf["installation"] = "yes";
}
/* FIXME
else if(SCR::Read(.target.size,"/var/lib/YaST2/install.inf") > 0)
install_inf = .var.lib.YaST2.install_inf;
*/
else
return false;

Expand All @@ -102,15 +98,14 @@ define boolean ReadInstallInf() {
ReadInstallInfItem(install_inf, "hostname", "Hostname");
ReadInstallInfItem(install_inf, "module", "Alias");
ReadInstallInfItem(install_inf, "proxy", "Proxy");
// ReadInstallInfItem(install_inf, "options", "Options");
ReadInstallInfItem(install_inf, "vlanid", "VLanID");
// OSAHwAddr parameter s390
ReadInstallInfItem(install_inf, "hwaddr", "HWAddr");
ReadInstallInfItem(install_inf, "ethtool_options", "ethtool");
ReadInstallInfItem(install_inf, "unique", "NetUniqueID");
ReadInstallInfItem(install_inf, "connect_wait", "ConnectWait");

ReadInstallInfItem(install_inf, "QETH_LAYER2_SUPPORT", "Layer2");
// ReadInstallInfItem(install_inf, "LLADDR", "OSAHWAddr");
ReadInstallInfItem(install_inf, "dhcptimeout", "DHCPTimeout");

ReadInstallInfItem(install_inf, "WESSID", "WlanESSID");
Expand All @@ -136,7 +131,6 @@ define boolean ReadInstallInf() {
if(netdevice != "") {
string devtype = NetworkInterfaces::device_type(netdevice);
if(devtype != nil && devtype != "") InstallInf["type"] = devtype;
// InstallInf = remove(InstallInf, "netdevice");
}

if (Arch::s390()) {
Expand Down Expand Up @@ -234,6 +228,9 @@ string StdoutOf(string command) {

void CreateIfcfg() {
string ifcfg="";
integer vlanid = tointeger(InstallInf["vlanid"]:nil);

y2milestone("creating ifcfg, vlan id: %1", vlanid);

if (network_disk == `iscsi && contains(NetworkStorage::getiBFTDevices(), InstallInf["netdevice"]:"")){
ifcfg = sformat("%1STARTMODE='nfsroot'\nBOOTPROTO='ibft'\n", ifcfg);
Expand All @@ -252,9 +249,12 @@ void CreateIfcfg() {
}
else {
//DHCP (also for IPv6) setup
if (InstallInf["bootproto"]:""=="dhcp") ifcfg="BOOTPROTO='dhcp4'\n";
else if (InstallInf["bootproto"]:""=="dhcp6") ifcfg="BOOTPROTO='dhcp6'\n";
else if (InstallInf["bootproto"]:""=="dhcp,dhcp6") ifcfg="BOOTPROTO='dhcp'\n";
if (InstallInf["bootproto"]:""=="dhcp")
ifcfg="BOOTPROTO='dhcp4'\n";
else if (InstallInf["bootproto"]:""=="dhcp6")
ifcfg="BOOTPROTO='dhcp6'\n";
else if (InstallInf["bootproto"]:""=="dhcp,dhcp6")
ifcfg="BOOTPROTO='dhcp'\n";

// set DHCP_SET_HOSTNAME=yes #suse30528
y2milestone("set DHCLIENT_SET_HOSTNAME=yes on installed system");
Expand Down Expand Up @@ -316,7 +316,8 @@ void CreateIfcfg() {
}

string new_netdevice = netdevice;
if (! LanUdevAuto::AllowUdevModify()) {
if(!LanUdevAuto::AllowUdevModify())
{
// bnc#821427: use same options as in /lib/udev/rules.d/71-biosdevname.rules
string cmd = sformat("biosdevname --policy physical --smbios 2.6 --nopirq -i %1", netdevice);
string out = String::FirstChunk(StdoutOf(cmd), "\n");
Expand All @@ -325,6 +326,13 @@ void CreateIfcfg() {
new_netdevice = out;
}
}
string real_device = new_netdevice;
if(vlanid != nil)
{
new_netdevice = sformat("vlan%1", vlanid);
ifcfg = sformat("%1ETHERDEVICE='%2'\n", ifcfg, real_device);
ifcfg = sformat("%1VLAN_ID='%2'\n", ifcfg, vlanid);
}

string ifcfg_name = sformat("ifcfg-%1", new_netdevice);

Expand All @@ -343,6 +351,16 @@ void CreateIfcfg() {
string dev_file=sformat("/etc/sysconfig/network/%1", ifcfg_name);

SCR::Write(.target.string, dev_file, ifcfg);

if(vlanid != nil)
{
string real_dev_file = sformat("/etc/sysconfig/network/ifcfg-%1", real_device);
// very minimal ifcfg for vlan's phy device - see man ifcfg-vlan
string real_dev_ifcfg = "STARTMODE='auto'\n";

SCR::Write(.target.string, real_dev_file, real_dev_ifcfg);
}

y2milestone("ifcfg file: %1", dev_file);
}

Expand Down Expand Up @@ -564,9 +582,6 @@ void save_network(){


if(install_inf){
// string hwcfgname = CreateHardwareFile();
// string ifcfg = sformat("ifcfg-%1", InstallInf["netdevice"]:"");

if (!configure_network){
CreateIfcfg();
CreateOtherNetworkFiles();
Expand Down
6 changes: 2 additions & 4 deletions src/modules/Lan.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ Check configuration manually."));
if(Abort()) return false;
/* Progress step 7/9 */
if (gui) ProgressNextStage(_("Reading installation information..."));
// ReadInstallInf();
sleep(sl);

if(Abort()) return false;
Expand Down Expand Up @@ -1260,9 +1259,8 @@ global define boolean AnyDHCPDevice() {
}


global define list<map> PrepareForAutoinst() {

// ReadInstallInf();
global define list<map> PrepareForAutoinst()
{
LanItems::ReadHw();
return LanItems::Hardware;
}
Expand Down

0 comments on commit 3ee7b04

Please sign in to comment.