- write networking configuration in doInstall - consolidate the code a bit - add ksdata.network.hostname (anaconda and kickstart patch)
Short story:
Still just copying ifcfg files from installer environment to system, not actually generating them from ksdata in this patch.
Details:
Ifcfg files are copied from installer environment instead of generating from ksdata[1]. 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[2].
I am not against considering going through ifcfg -> ksdata -> ifcfg[3], 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[4]. 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[5], 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.
[1] We also copy /etc/sysconfig/network-scripts/keys-<device> files. We might want to copy also routing files created in nm-c-e.
[2] this should go to dracut IMO.
[3] 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)
[4] Note that NM updates the ifcfg file created by us after parsing it for the first time
[5] __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 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -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
import gettext _ = 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() createLuserConf(ROOT_PATH, algoname=u.getPassAlgo(ksdata.authconfig.authconfig)) diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 22025ff..639657a 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -716,6 +716,7 @@ def _copyIfcfgFiles(destPath): srcfile = os.path.join(netscriptsDir, cfgFile) _copyFileToPath(srcfile, destPath)
+# TODO: routing info from /etc/sysconfig/network-scripts? def copyConfigToPath(destPath): if flags.imageInstall: # for image installs we only want to write out @@ -892,3 +893,13 @@ def usedByRootOnISCSI(iface, storage): return True
return False + +def writeNetworkConf(storage, instClass): + write_sysconfig_network() + disableIPV6() + copyConfigToPath(ROOT_PATH) + # TODO the default for ONBOOT needs to be lay down + # before newui we didn't set it for kickstart installs + instClass.setNetworkOnbootDefault() + disableNMForStorageDevices(storage) + autostartFCoEDevices(storage)
I am not against considering going through ifcfg -> ksdata -> ifcfg[3], 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.
Yeah, I can understand why you're hesitant to do this. Keeping things in sync between the config files and ksdata is tough here. And I can't think of anywhere else in anaconda where the primary data store is really outside our control.
One other point to consider here is that if we don't have networking going through ksdata, then no networking lines will end up in anaconda-ks.cfg. This also means that using the new anaconda as a s-c-ks front end will be more difficult.
Is there at least some way ifcfg file data can be mirrored to ksdata at the very end, when networking stuff can no longer change?
@@ -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() createLuserConf(ROOT_PATH, algoname=u.getPassAlgo(ksdata.authconfig.authconfig))
I'd like writeNetworkConfig to still take a ksdata object as a second argument for parallelism with the execute methods, just in case I want to do some reworking here later.
- Chris
On 07/27/2012 05:44 PM, Chris Lumens wrote:
I am not against considering going through ifcfg -> ksdata -> ifcfg[3], 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.
Yeah, I can understand why you're hesitant to do this. Keeping things in sync between the config files and ksdata is tough here. And I can't think of anywhere else in anaconda where the primary data store is really outside our control.
One other point to consider here is that if we don't have networking going through ksdata, then no networking lines will end up in anaconda-ks.cfg. This also means that using the new anaconda as a s-c-ks front end will be more difficult.
We are actually updating ksdata from ifcfg files in NetworkSpoke.apply, I am just not using them in the patchset.
Is there at least some way ifcfg file data can be mirrored to ksdata at the very end, when networking stuff can no longer change?
We can use what we do in NetworkSpoke.apply in writeNetworkConf, but given what the post installation changes are:
instClass.setNetworkOnbootDefault() disableNMForStorageDevices(storage) autostartFCoEDevices(storage)
which is only setting ONBOOT and NM_CONTROLLED values (we don't have counterpart in ksdata for the latter), I'd rather just update ksdata created in spoke.apply in the methods above (keeping all the tweaking in one place) instead of filling the whole ksdata here - at the end of installation.
@@ -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() createLuserConf(ROOT_PATH, algoname=u.getPassAlgo(ksdata.authconfig.authconfig))
I'd like writeNetworkConfig to still take a ksdata object as a second argument for parallelism with the execute methods, just in case I want to do some reworking here later.
Yep, I am adding it in 3/4.
Instead of creating the file in installer and copying it to system. --- pyanaconda/network.py | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 639657a..3c6bc4a 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -750,9 +750,6 @@ def copyConfigToPath(destPath): _copyFileToPath("/etc/udev/rules.d/70-persistent-net.rules", destPath, overwrite=flags.livecdInstall)
- _copyFileToPath(ipv6ConfFile, destPath, - overwrite=flags.livecdInstall) - def get_ksdevice_name(ksspec=""):
if not ksspec: @@ -831,16 +828,16 @@ def write_sysconfig_network(): if not flags.imageInstall: shutil.move(newnetwork, networkConfFile)
-# TODO: do it right in sysroot (instead of copying the files later)? -def disableIPV6(): +def disableIPV6(rootpath): + cfgfile = os.path.normpath(rootpath + ipv6ConfFile) if ('noipv6' in flags.cmdline and not any(get_ifcfg_value(dev, 'IPV6INIT') == "yes" for dev in getDevices())): - if os.path.exists(ipv6ConfFile): - log.warning('Not disabling ipv6, %s exists' % ipv6ConfFile) + if os.path.exists(cfgfile): + log.warning('Not disabling ipv6, %s exists' % cfgfile) else: log.info('Disabling ipv6 on target system') - f = open(ipv6ConfFile, "w") + f = open(cfgfile, "w") f.write("# Anaconda disabling ipv6\n") f.write("options ipv6 disable=1\n") f.close() @@ -896,7 +893,7 @@ def usedByRootOnISCSI(iface, storage):
def writeNetworkConf(storage, instClass): write_sysconfig_network() - disableIPV6() + disableIPV6(ROOT_PATH) copyConfigToPath(ROOT_PATH) # TODO the default for ONBOOT needs to be lay down # before newui we didn't set it for kickstart installs
See udev's 828136. --- pyanaconda/network.py | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 3c6bc4a..cbfbef8 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -746,10 +746,6 @@ def copyConfigToPath(destPath): _copyFileToPath("/etc/resolv.conf", destPath, overwrite=flags.livecdInstall)
- # /etc/udev/rules.d/70-persistent-net.rules - _copyFileToPath("/etc/udev/rules.d/70-persistent-net.rules", - destPath, overwrite=flags.livecdInstall) - def get_ksdevice_name(ksspec=""):
if not ksspec:
The aim is to use ksdata.network.hostname which is new property (there is a related kickstart patch) obtaining the hostname from network commands (ksdata.network.network list of NetworkData objects).
notes:
- getHostname (actual hostname of system) is still used in dracutSetupArgs, we need to get ksdata passed somehow from bootloader.py:set_boot_args()
- Hostname of installer environment is still set in kickstart. We used to do it because of mdadm member naming (640743) but this is not needed anymore - mdadm actually doesn't use it. If it starts to again, or does it in some special conditions, we can pass ksdata.network.hostname (as we do for default vg names) using --homehost option. We might need to set the hostname for some installed package though, so I am keeping it.
- We should think about where to set hostname in GUI. This should happen before writing storage (vg, mdmember names) or we can drop default naming based on hostname. --- pyanaconda/install.py | 2 +- pyanaconda/network.py | 71 +++++++++++----------------------- pyanaconda/storage/__init__.py | 14 ++----- pyanaconda/ui/gui/spokes/network.py | 9 ++++- 4 files changed, 36 insertions(+), 60 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index 45a659a..ac37cbd 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -79,7 +79,7 @@ def doInstall(storage, payload, ksdata, instClass): ksdata.services.execute(storage, ksdata, instClass) ksdata.keyboard.execute(storage, ksdata, instClass)
- writeNetworkConf(storage, instClass) + writeNetworkConf(storage, ksdata, instClass)
# Creating users and groups requires some pre-configuration. u = Users() diff --git a/pyanaconda/network.py b/pyanaconda/network.py index cbfbef8..ac9bd00 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -698,7 +698,7 @@ def setHostname(hn): iutil.execWithRedirect("hostname", ["-v", hn ], stdout="/dev/tty5", stderr="/dev/tty5")
-def _copyFileToPath(file, destPath='', overwrite=False): +def copyFileToPath(file, destPath='', overwrite=False): if not os.path.isfile(file): return False destfile = os.path.join(destPath, file.lstrip('/')) @@ -709,42 +709,22 @@ def _copyFileToPath(file, destPath='', overwrite=False): shutil.copy(file, destfile) return True
-def _copyIfcfgFiles(destPath): +# /etc/sysconfig/network-scripts/ifcfg-* +# /etc/sysconfig/network-scripts/keys-* +def copyIfcfgFiles(destPath): files = os.listdir(netscriptsDir) for cfgFile in files: if cfgFile.startswith(("ifcfg-","keys-")): srcfile = os.path.join(netscriptsDir, cfgFile) - _copyFileToPath(srcfile, destPath) + copyFileToPath(srcfile, destPath)
-# TODO: routing info from /etc/sysconfig/network-scripts? -def copyConfigToPath(destPath): - if flags.imageInstall: - # for image installs we only want to write out - # /etc/sysconfig/network - destfile = os.path.normpath(destPath + networkConfFile) - if not os.path.isdir(os.path.dirname(destfile)): - iutil.mkdirChain(os.path.dirname(destfile)) - shutil.move("/tmp/sysconfig-network", destfile) - return - - # /etc/sysconfig/network-scripts/ifcfg-* - # /etc/sysconfig/network-scripts/keys-* - # we can copy all of them - _copyIfcfgFiles(destPath) - - # /etc/dhcp/dhclient-DEVICE.conf - # TODORV: do we really don't want overwrite on live cd? +# /etc/dhcp/dhclient-DEVICE.conf +# TODORV: do we really don't want overwrite on live cd? +def copyDhclientConfFiles(destPath): for devName in getDevices(): dhclientfile = os.path.join("/etc/dhcp/dhclient-%s.conf" % devName) - _copyFileToPath(dhclientfile, destPath) - - # /etc/sysconfig/network - _copyFileToPath(networkConfFile, destPath, - overwrite=flags.livecdInstall) + copyFileToPath(dhclientfile, destPath)
- # /etc/resolv.conf - _copyFileToPath("/etc/resolv.conf", destPath, - overwrite=flags.livecdInstall)
def get_ksdevice_name(ksspec=""):
@@ -782,24 +762,17 @@ def get_ifcfg_value(iface, key, root_path=""): dev.loadIfcfgFile() return dev.get(key)
-def write_sysconfig_network(): +def write_sysconfig_network(rootpath, ksdata, overwrite=False):
- if flags.imageInstall: - # don't write files into host's /etc/sysconfig on image installs - newnetwork = "/tmp/sysconfig-network" - else: - newnetwork = "%s.new" % (networkConfFile) + cfgfile = os.path.normpath(rootpath + networkConfFile) + if (os.path.isfile(cfgfile) and not overwrite): + return False
- f = open(newnetwork, "w") - f.write("# Generated by anaconda") + f = open(cfgfile, "w") + f.write("# Generated by anaconda\n") f.write("NETWORKING=yes\n") - f.write("HOSTNAME=")
- hostname = getHostname() - if hostname: - f.write(hostname + "\n") - else: - f.write("localhost.localdomain\n") + f.write("HOSTNAME=%s\n" % ksdata.network.hostname)
gateway = ipv6_defaultgw = None for iface in reversed(getDevices()): @@ -821,8 +794,7 @@ def write_sysconfig_network(): f.write("IPV6_DEFAULTGW=%s\n" % ipv6_defaultgw) f.close()
- if not flags.imageInstall: - shutil.move(newnetwork, networkConfFile) + return True
def disableIPV6(rootpath): cfgfile = os.path.normpath(rootpath + ipv6ConfFile) @@ -887,10 +859,13 @@ def usedByRootOnISCSI(iface, storage):
return False
-def writeNetworkConf(storage, instClass): - write_sysconfig_network() +def writeNetworkConf(storage, ksdata, instClass): + write_sysconfig_network(ROOT_PATH, ksdata, overwrite=flags.livecdInstall) disableIPV6(ROOT_PATH) - copyConfigToPath(ROOT_PATH) + if not flags.imageInstall: + copyIfcfgFiles(ROOT_PATH) + copyDhclientConfFiles(ROOT_PATH) + copyFileToPath("/etc/resolv.conf", ROOT_PATH, overwrite=flags.livecdInstall) # TODO the default for ONBOOT needs to be lay down # before newui we didn't set it for kickstart installs instClass.setNetworkOnbootDefault() diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index ae63bbf..64e25e8 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -1117,11 +1117,8 @@ class Storage(object): name = kwargs.pop("name") else: hostname = "" - if self.data: - for nd in self.data.network.dataList(): - if nd.hostname: - hostname = nd.hostname - break + if self.data and self.data.network.hostname is not None: + hostname = self.data.network.hostname
name = self.suggestContainerName(hostname=hostname, prefix="vg")
@@ -1188,11 +1185,8 @@ class Storage(object): # set up the volume label, using hostname if necessary if not name: hostname = "" - if self.data: - for nd in self.data.network.dataList(): - if nd.hostname: - hostname = nd.hostname - break + if self.data and self.data.network.hostname is not None: + hostname = self.data.network.hostname
name = self.suggestContainerName(prefix="btrfs", hostname=hostname) diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index b11fb4c..b19c223 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -39,7 +39,8 @@ from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke from pyanaconda.ui.gui.categories.software import SoftwareCategory from pyanaconda.ui.gui.hubs.summary import SummaryHub
-from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs +from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs, getHostname +from pyanaconda.kickstart import NetworkData
from gi.repository import GLib, GObject, Pango, Gio, NetworkManager, NMClient import dbus @@ -969,6 +970,12 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
def __init__(self, *args, **kwargs): StandaloneSpoke.__init__(self, *args, **kwargs) + + if self.data.network.hostname is None: + hostname = getHostname() + nd = NetworkData(hostname=hostname) + self.data.network.network.append(nd) + self.network_control_box = NetworkControlBox(self.builder) parent = self.builder.get_object("AnacondaStandaloneWindow-action_area5") parent.add(self.network_control_box.vbox)
The aim is to use ksdata.network.hostname which is new property (there is a related kickstart patch) obtaining the hostname from network commands (ksdata.network.network list of NetworkData objects).
You should also increase the version of the Requires: on pykickstart in anaconda.spec.in. Doing that means we can catch errors at tree composition time instead of flailing around wondering why things don't work right, only to later discover the version of pykickstart we were counting on isn't there.
- Chris
On 07/27/2012 05:17 PM, Chris Lumens wrote:
The aim is to use ksdata.network.hostname which is new property (there is a related kickstart patch) obtaining the hostname from network commands (ksdata.network.network list of NetworkData objects).
You should also increase the version of the Requires: on pykickstart in anaconda.spec.in. Doing that means we can catch errors at tree composition time instead of flailing around wondering why things don't work right, only to later discover the version of pykickstart we were counting on isn't there.
Allright.
--- pykickstart/commands/network.py | 9 +++++++++ pykickstart/handlers/control.py | 2 +- 2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py index 0a6d8aa..90a7640 100644 --- a/pykickstart/commands/network.py +++ b/pykickstart/commands/network.py @@ -327,6 +327,15 @@ class F16_Network(F9_Network): op.add_option("--wpakey", dest="wpakey", action="store", default="") return op
+class F18_Network(F16_Network): + + @property + def hostname(self): + for nd in self.dataList(): + if nd.hostname: + return nd.hostname + return None + class RHEL4_Network(FC3_Network): removedKeywords = FC3_Network.removedKeywords removedAttrs = FC3_Network.removedAttrs diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py index d18bb56..140a3bd 100644 --- a/pykickstart/handlers/control.py +++ b/pykickstart/handlers/control.py @@ -917,7 +917,7 @@ commandMap = { "mediacheck": mediacheck.FC4_MediaCheck, "monitor": monitor.F10_Monitor, "multipath": multipath.FC6_MultiPath, - "network": network.F16_Network, + "network": network.F18_Network, "nfs": method.F14_Method, "part": partition.F17_Partition, "partition": partition.F17_Partition,
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py index d18bb56..140a3bd 100644 --- a/pykickstart/handlers/control.py +++ b/pykickstart/handlers/control.py @@ -917,7 +917,7 @@ commandMap = { "mediacheck": mediacheck.FC4_MediaCheck, "monitor": monitor.F10_Monitor, "multipath": multipath.FC6_MultiPath,
"network": network.F16_Network,
"network": network.F18_Network, "nfs": method.F14_Method, "part": partition.F17_Partition, "partition": partition.F17_Partition,
Please update the RHEL7 one as well.
- Chris
On 07/27/2012 05:07 PM, Chris Lumens wrote:
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py index d18bb56..140a3bd 100644 --- a/pykickstart/handlers/control.py +++ b/pykickstart/handlers/control.py @@ -917,7 +917,7 @@ commandMap = { "mediacheck": mediacheck.FC4_MediaCheck, "monitor": monitor.F10_Monitor, "multipath": multipath.FC6_MultiPath,
"network": network.F16_Network,
"network": network.F18_Network, "nfs": method.F14_Method, "part": partition.F17_Partition, "partition": partition.F17_Partition,
Please update the RHEL7 one as well.
I will.
Do networking initialization in NetworkStandaloneSpoke.__init__. Not completely sure if it is the right place (maybe pre-GUI would be better)
The initialization consists of: - ksdata.network.hostnmae object update (only hostname atm) for storage, and perhaps for hostname GUI when we have it - creating missing ifcfg files which may go to dracut (pending patch), for now it should fix network spoke traceback from summit demo --- pyanaconda/network.py | 40 ++++++++++++++++------------------ pyanaconda/ui/gui/spokes/network.py | 8 +----- 2 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index ac9bd00..2e269df 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -400,27 +400,12 @@ class WirelessNetworkDevice(NetworkDevice): def write(self): pass
- -class Network: - - def __init__(self): - - ifcfglog.debug("Network object created called") - - # TODO this may need to be handled in getDevices() - if flags.imageInstall: - return - - # TODO this should go away (patch pending), - # default ifcfg files should be created in dracut - - # populate self.netdevices - devhash = isys.getDeviceProperties(dev=None) - for iface in devhash.keys(): - if not isys.isWirelessDevice(iface): - device = NetworkDevice(netscriptsDir, iface) - if not os.access(device.path, os.R_OK): - device.setDefaultConfig() +def createMissingDefaultIfcfgs(): + for iface in getDevices(): + if not isys.isWirelessDevice(iface): + device = NetworkDevice(netscriptsDir, iface) + if not os.access(device.path, os.R_OK): + device.setDefaultConfig()
def getDevices(): # TODO: filter with existence of ifcfg file? @@ -871,3 +856,16 @@ def writeNetworkConf(storage, ksdata, instClass): instClass.setNetworkOnbootDefault() disableNMForStorageDevices(storage) autostartFCoEDevices(storage) + +# networking initialization and ksdata object update +def init_networking(ksdata): + from pyanaconda.kickstart import NetworkData + + if not flags.imageInstall: + # XXX: this should go to anaconda dracut + createMissingDefaultIfcfgs() + + if ksdata.network.hostname is None: + hostname = getHostname() + nd = NetworkData(hostname=hostname) + ksdata.network.network.append(nd) diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index b19c223..69a9a36 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -39,8 +39,7 @@ from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke from pyanaconda.ui.gui.categories.software import SoftwareCategory from pyanaconda.ui.gui.hubs.summary import SummaryHub
-from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs, getHostname -from pyanaconda.kickstart import NetworkData +from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs, init_networking
from gi.repository import GLib, GObject, Pango, Gio, NetworkManager, NMClient import dbus @@ -971,10 +970,7 @@ class NetworkStandaloneSpoke(StandaloneSpoke): def __init__(self, *args, **kwargs): StandaloneSpoke.__init__(self, *args, **kwargs)
- if self.data.network.hostname is None: - hostname = getHostname() - nd = NetworkData(hostname=hostname) - self.data.network.network.append(nd) + init_networking(self.data)
self.network_control_box = NetworkControlBox(self.builder) parent = self.builder.get_object("AnacondaStandaloneWindow-action_area5")
Do networking initialization in NetworkStandaloneSpoke.__init__. Not completely sure if it is the right place (maybe pre-GUI would be better)
We have previously talked about the possibility of just trying to bring up the network via DHCP very early in anaconda. I believe this is what we talked about at the last design meeting a few weeks ago. mizmo will have to correct me if I am wrong.
If that's the case, there should probably be another thread started up at the bottom of the anaconda file, just like there is for storage and packaging.
- Chris
On 07/27/2012 05:38 PM, Chris Lumens wrote:
Do networking initialization in NetworkStandaloneSpoke.__init__. Not completely sure if it is the right place (maybe pre-GUI would be better)
We have previously talked about the possibility of just trying to bring up the network via DHCP very early in anaconda. I believe this is what we talked about at the last design meeting a few weeks ago. mizmo will have to correct me if I am wrong.
If that's the case, there should probably be another thread started up at the bottom of the anaconda file, just like there is for storage and packaging.
That would be a good place for init_networking().
Currently NM activates devices with missing ifcfg files (i.e. basically those not activated in dracut or specified in kickstart) with auto connection when it starts but I'd like to create missing ifcfg files in dracut [1] so that we can control the devices (NM doesn't write ifcfg files for auto connections). Then we'll really need to run the thread to activate a device. I'll come with a patch and move init_network to that place. But first I'd like to clear up the thing with NM auto-connections [1].
[1] https://www.redhat.com/archives/anaconda-devel-list/2012-July/msg00065.html
anaconda-patches@lists.fedorahosted.org