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

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

 



Use ksdevice, or device activated in loader, or first device found.

Use case:

- have 2 NICs
- PXE boot from one of them
- want to configure this (bootif) device in kickstart using network
  command

We should probably also document it.

---
 kickstart.py |   13 ++++++++++++-
 network.py   |    2 ++
 2 files changed, 14 insertions(+), 1 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..b902f31 100644
--- a/network.py
+++ b/network.py
@@ -369,6 +369,8 @@ class Network:
                 if ksdevice == 'link' and isys.getLinkStatus(dev):
                     self.ksdevice = dev
                     break
+                elif ksdevice == 'bootif':
+                    self.ksdevice = ":".join(flags.cmdline.get('BOOTIF')[3:].split("-"))
                 elif ksdevice == dev:
                     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