Re: [PATCH rhel6-branch] (take II) Fix default of network --device option to match rhel5 (#647462).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Thanks for the catch, I'll post better version.


Even one without screwed formatting :/


>From d2eff7af08649827dd11e9c93f046cabb489d713 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@xxxxxxxxxx>
Date: Fri, 26 Nov 2010 17:24:12 +0100
Subject: [PATCH rhel6-branch] Fix default of network --device option to match rhel5 (#647462).

Use ksdevice, or device activated in loader, or first device found.
---
 kickstart.py |   13 ++++++++++++-
 network.py   |    9 ++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index e197c32..8b4f865 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -558,7 +558,18 @@ class NetworkData(commands.network.F8_NetworkData):
 
         devices = anaconda.id.network.netdevices
 
-        device = self.device or min(devices.keys())
+        if not self.device:
+            if anaconda.id.network.ksdevice:
+                # ksdevice boot parameter
+                device = anaconda.id.network.ksdevice
+            elif network.hasActiveNetDev():
+                # device activated in stage 1 by network kickstart command
+                device = network.getActiveNetDevs()[0]
+            else:
+                # first device found
+                device = min(devices.keys())
+        else:
+            device = self.device
 
         # If we were given a network device name, grab the device object.
         # If we were given a MAC address, resolve that to a device name
diff --git a/network.py b/network.py
index 5b1ebb9..cf1d5e9 100644
--- a/network.py
+++ b/network.py
@@ -365,15 +365,22 @@ class Network:
 
         ksdevice = flags.cmdline.get('ksdevice', None)
         if ksdevice:
+            if ksdevice == 'bootif':
+                bootif_mac = ":".join(flags.cmdline.get('BOOTIF')[3:].split("-")).upper()
             for dev in self.netdevices:
+                mac = self.netdevices[dev].get('HWADDR').upper()
                 if ksdevice == 'link' and isys.getLinkStatus(dev):
                     self.ksdevice = dev
                     break
+                elif ksdevice == 'bootif':
+                    if bootif_mac == mac:
+                        self.ksdevice = dev
+                        break
                 elif ksdevice == dev:
                     self.ksdevice = dev
                     break
                 elif ':' in ksdevice:
-                    if ksdevice.upper() == self.netdevices[dev].get('HWADDR'):
+                    if ksdevice.upper() == mac:
                         self.ksdevice = dev
                         break
 
-- 
1.7.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux