Not in anaconda environment - that can bring down device used to get packages. --- instdata.py | 4 +++- network.py | 40 ++++++++++++++++++++++++++-------------- yuminstall.py | 2 +- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/instdata.py b/instdata.py index c23cec9..aefad18 100644 --- a/instdata.py +++ b/instdata.py @@ -149,8 +149,10 @@ class InstallData: except RuntimeError, msg: log.error("Error running %s: %s", args, msg) - self.network.write(anaconda=self.anaconda) + self.network.write() self.network.copyConfigToPath(instPath=self.anaconda.rootPath) + self.network.disableNMForStorageDevices(self.anaconda, + instPath=self.anaconda.rootPath) self.firewall.write (self.anaconda.rootPath) self.security.write (self.anaconda.rootPath) self.desktop.write(self.anaconda.rootPath) diff --git a/network.py b/network.py index 8b0d109..02f1ff2 100644 --- a/network.py +++ b/network.py @@ -307,6 +307,17 @@ class NetworkDevice(IfcfgFile): lf.close() f.close() + def isStorageDevice(self, anaconda): + import storage + rootdev = anaconda.id.storage.rootDevice + # FIXME: use d.host_address to only add "NM_CONTROLLED=no" + # for interfaces actually used enroute to the device + for d in anaconda.id.storage.devices: + if isinstance(d, storage.devices.NetworkStorageDevice) and\ + (rootdev.dependsOn(d) or d.nic == self.iface): + return True + return False + class Network: @@ -540,7 +551,21 @@ class Network: self._copyFileToPath("/etc/udev/rules.d/70-persistent-net.rules", instPath, overwrite=flags.livecdInstall) - def write(self, anaconda=None): + def disableNMForStorageDevices(self, anaconda, instPath=''): + for devName, device in self.netdevices.items(): + if device.isStorageDevice(anaconda): + dev = NetworkDevice(instPath + netscriptsDir, devName) + if os.access(dev.path, os.R_OK): + dev.loadIfcfgFile() + dev.set(('NM_CONTROLLED', 'no')) + dev.writeIfcfgFile() + log.info("network device %s used by storage will not be " + "controlled by NM" % device.path) + else: + log.warning("disableNMForStorageDevices: %s file not found" % + device.path) + + def write(self): devices = self.netdevices.values() @@ -557,19 +582,6 @@ class Network: self.overrideDHCPhostname): dev.set(('DHCP_HOSTNAME', self.hostname)) - # tell NetworkManager not to touch any interfaces used during - # installation when / is on a network backed device. - if anaconda is not None: - import storage - rootdev = anaconda.id.storage.rootDevice - # FIXME: use d.host_address to only add "NM_CONTROLLED=no" - # for interfaces actually used enroute to the device - for d in anaconda.id.storage.devices: - if isinstance(d, storage.devices.NetworkStorageDevice) and\ - (rootdev.dependsOn(d) or d.nic == device): - dev.set(('NM_CONTROLLED', 'no')) - break - dev.writeIfcfgFile() # XXX: is this necessary with NetworkManager? diff --git a/yuminstall.py b/yuminstall.py index 8c1aab0..68bf681 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1643,7 +1643,7 @@ debuglevel=10 if os.access("/etc/modprobe.d/anaconda.conf", os.R_OK): shutil.copyfile("/etc/modprobe.d/anaconda.conf", anaconda.rootPath + "/etc/modprobe.d/anaconda.conf") - anaconda.id.network.write(anaconda=anaconda) + anaconda.id.network.write() anaconda.id.network.copyConfigToPath(instPath=anaconda.rootPath) anaconda.id.storage.write(anaconda.rootPath) if not anaconda.id.isHeadless: -- 1.6.0.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list