[PATCH 1/4] networking: write configuration in doInstall
rvykydal at redhat.com
Thu Jul 26 08:37:46 UTC 2012
Still just copying ifcfg files from installer environment to
system, not actually generating them from ksdata in this patch.
Ifcfg files are copied from installer environment instead of generating
from ksdata. Using nm-c-e, the configuration is applied directly to ifcfg
files so doing
write ifcfg (in dracut based on boot options or ks, or nm-c-e GUI)
-> update ksdata (in spoke's apply)
-> write ifcfg (in doInstall)
is not necessary. Currently we are creating ifcfg files in dracut (based on
boot options, and for kickstart) and in anaconda where we are creating only
missing default ifcfg files.
I am not against considering going through ifcfg -> ksdata -> ifcfg,
be it for consistency with other spokes/modules. or we may come to point
where we actually need to do it. It will require some thinking though.
We have been doing pre-NM-run ksdata -> ifcfg direction.
Ifcfg -> ksdata is implemented in basic form in spoke.apply but ksdata, as
mentioned before, it is not actually used yet in this patchset. We'd need to
consider where to sync ifcfg files created by dracut (or anaconda) with
ksdata, and if/how we need to update our ks network command. I am afraid of
storing complete network configuration doable with nm-c-e (wireless
credentials, routing) in ksdata and have fairly strong gut feeling against
doing ifcfg -> ksdata -> ifcfg. It means we need to keep up with what nm-c-e
starts to support and lost something we could get for free from nm-c-e.
 We also copy /etc/sysconfig/network-scripts/keys-<device>
files. We might want to copy also routing files created in nm-c-e.
 this should go to dracut IMO.
 Actually this would be the chain:
dracut writes ifcfg
NM can update ifcfg when activating device
(? does anaconda need to updates ksdata ?)
nm-c-e modifies ifcfg files (GUI configuration)
anaconda stores ifcfg to ksdata (spoke.apply)
anaconda dumps ksdata to ifcfg on /mnt/sysimage (doInstall)
 Note that NM updates the ifcfg file created by us
after parsing it for the first time
 __init__ of NetworkStandaloneSpoke as I do it for hostname in one
of following patches or some pre-GUI initialization
pyanaconda/install.py | 3 +++
pyanaconda/network.py | 11 +++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index be31e75..45a659a 100644
@@ -25,6 +25,7 @@ from pyanaconda.storage import turnOnFilesystems
from pyanaconda.bootloader import writeBootLoader
from pyanaconda.progress import progress_report
from pyanaconda.users import createLuserConf, Users
+from pyanaconda.network import writeNetworkConf
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -78,6 +79,8 @@ def doInstall(storage, payload, ksdata, instClass):
ksdata.services.execute(storage, ksdata, instClass)
ksdata.keyboard.execute(storage, ksdata, instClass)
+ writeNetworkConf(storage, instClass)
# Creating users and groups requires some pre-configuration.
u = Users()
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 22025ff..639657a 100644
@@ -716,6 +716,7 @@ def _copyIfcfgFiles(destPath):
srcfile = os.path.join(netscriptsDir, cfgFile)
+# TODO: routing info from /etc/sysconfig/network-scripts?
# for image installs we only want to write out
@@ -892,3 +893,13 @@ def usedByRootOnISCSI(iface, storage):
+def writeNetworkConf(storage, instClass):
+ # TODO the default for ONBOOT needs to be lay down
+ # before newui we didn't set it for kickstart installs
More information about the anaconda-patches