diff options
author | Radek Vykydal <rvykydal@redhat.com> | 2013-01-11 16:29:49 +0100 |
---|---|---|
committer | Radek Vykydal <rvykydal@redhat.com> | 2013-01-16 10:56:21 +0100 |
commit | 96d1c16810a95391146a4da069f7244d730f0b26 (patch) | |
tree | 2bb2df5eee95f1dee3cd96032986db5d2e0f697c /dracut | |
parent | 7c88c8797a16f0cc1fd48c654305ad73f5c96ed8 (diff) | |
download | anaconda-96d1c16810a95391146a4da069f7244d730f0b26.tar.gz anaconda-96d1c16810a95391146a4da069f7244d730f0b26.tar.xz anaconda-96d1c16810a95391146a4da069f7244d730f0b26.zip |
Take over dhcp connection by NM for network root (eg nfs) (#883451, #893656)
We need to pass dhcp lease file to NM's dhclient also in case of
kickstart installs. For non-kickstart case, this is done in dracut,
modules.d/45ifcfg/write-ifcfg.sh.
See dracut's commit 66666c670a462548df4ea4c8069d54b8c309ecf4
Diffstat (limited to 'dracut')
-rwxr-xr-x | dracut/parse-kickstart | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart index 333849bfc..7aeaecd9d 100755 --- a/dracut/parse-kickstart +++ b/dracut/parse-kickstart @@ -13,6 +13,8 @@ import sys, os import logging +import shutil +import uuid from pykickstart.parser import KickstartParser, preprocessKickstart from pykickstart.version import returnClassForVersion from pykickstart.errors import KickstartError @@ -267,7 +269,8 @@ def ksnet_to_ifcfg(net, filename=None): os.makedirs("/tmp/ifcfg") ifcfg['DEVICE'] = dev ifcfg['HWADDR'] = readsysfile("/sys/class/net/%s/address" % dev) - ifcfg['UUID'] = readsysfile("/proc/sys/kernel/random/uuid") + uuid = str(uuid.uuid4()) + ifcfg['UUID'] = uuid # we set real ONBOOT value in anaconda, here # we use it to activate devcies by NM on start ifcfg['ONBOOT'] = "yes" if net.activate else "no" @@ -305,6 +308,15 @@ def ksnet_to_ifcfg(net, filename=None): # TODO: dhcpclass, ethtool, essid/wepkey/wpakay, etc. + if net.bootProto == 'dhcp': + srcpath = "/tmp/dhclient.%s.lease" % dev + dstdir = "/tmp/ifcfg-leases" + dstpath = "%s/dhclient-%s-%s.lease" % (dstdir, uuid, dev) + if os.path.exists(srcpath): + if not os.path.isdir(dstdir): + os.makedirs(dstdir) + shutil.copyfile(srcpath, dstpath) + try: log.info("writing ifcfg for %s", dev) outf = open(filename, "w") |