[PATCH 1/4] Initialize network synchronously (#902090)
Radek Vykydal
rvykydal at redhat.com
Wed Jan 23 12:49:44 UTC 2013
There is no use doing these initialization actions in a separate thread,
so let's play safe (races with UI, e.g when setting initial hostname value
as in #902090) and do only waiting for dhcp (for payload initialization)
asynchronously.
---
anaconda | 6 ++++--
pyanaconda/network.py | 12 ++++++------
pyanaconda/packaging/__init__.py | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/anaconda b/anaconda
index f291fb0..f3286b6 100755
--- a/anaconda
+++ b/anaconda
@@ -971,14 +971,16 @@ if __name__ == "__main__":
from pyanaconda.storage import storageInitialize
from pyanaconda.packaging import payloadInitialize
- from pyanaconda.network import networkInitialize
+ from pyanaconda.network import networkInitialize, networkWaitForDhcp
if anaconda.rescue:
from pyanaconda.rescue import doRescue
doRescue(anaconda.rescue_mount, ksdata, anaconda.platform)
+
+ networkInitialize(ksdata)
threadMgr.add(AnacondaThread(name="AnaStorageThread", target=storageInitialize, args=(anaconda.storage, ksdata, anaconda.protected)))
- threadMgr.add(AnacondaThread(name="AnaNetworkThread", target=networkInitialize, args=(ksdata,)))
+ threadMgr.add(AnacondaThread(name="AnaWaitForDhcpThread", target=networkWaitForDhcp, args=(ksdata,)))
threadMgr.add(AnacondaThread(name="AnaPayloadThread", target=payloadInitialize, args=(anaconda.storage, ksdata, anaconda.payload)))
atexit.register(exitHandler, ksdata.reboot, anaconda.storage)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index e814e89..0d9e427 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -1045,24 +1045,24 @@ def setOnboot(ksdata):
dev.set (("ONBOOT", "no"))
dev.writeIfcfgFile()
-# networking initialization and ksdata object update
def networkInitialize(ksdata):
log.debug("network: devices found %s" % getDevices())
logIfcfgFiles("network initialization")
+
if not flags.imageInstall:
- # XXX: this should go to anaconda dracut
if createMissingDefaultIfcfgs():
logIfcfgFiles("ifcfgs created")
- # we set ONBOOT value using network --activate activate in dracut
- # to get devices activated by NM, so set proper ONBOOT value
- # based on --onboot here
+ # For kickstart network --activate option we set ONBOOT=yes
+ # in dracut to get devices activated by NM. The real network --onboot
+ # value is set here.
setOnboot(ksdata)
if ksdata.network.hostname is None:
update_hostname(ksdata)
- # auto default dhcp connection would be activated by NM service
+def networkWaitForDhcp(ksdata):
+ # connection (e.g. auto default dhcp) is activated by NM service
if wait_for_dhcp():
update_hostname(ksdata)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index f724088..c3b2051 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -669,7 +669,7 @@ def payloadInitialize(storage, ksdata, payload):
# FIXME: condition for cases where we don't want network
# (set and use payload.needsNetwork ?)
- networkThread = threadMgr.get("AnaNetworkThread")
+ networkThread = threadMgr.get("AnaWaitForDhcpThread")
if networkThread:
networkThread.join()
--
1.7.11.7
More information about the anaconda-patches
mailing list