Re: [PATCH 25/25] Use separate method for copying network configuration to system (#520146).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Radek, I got one question below.

On 05/05/2010 09:15 AM, Radek Vykydal wrote:
> Better version of the patch adding Network.write() before
> Network.copyConfigToSystem() which is needed for cases
> when UI is configured/enabled neither in stage2 UI
> nor in stage2 kickstart.
> 
> 
> [PATCH] Use separate method for copying network configuration to system
> (#520146).
> 
> Former Network.write was used to write config both to anaconda
> environment and to installed system. It became quite messy and
> unreadable doing both things as writing to installed system was just
> copying the file from anaconda root to system root for all files
> except ifcfg-DEVICE. Using two separate methods makes clear what
> we are doing.
> 
> Also there is a question if we need to copy the network config
> to system twice as we are doing - first in preinstall step,
> and then in writeconfig step. The latter is not necessary I think
> and seem to be actually a noop.
> ---
> __init__.py   |    3 +-
> network.py    |  193
> +++++++++++++++++++++++++++++----------------------------
> yuminstall.py |    3 +-
> 3 files changed, 101 insertions(+), 98 deletions(-)

> diff --git a/network.py b/network.py
> index 9e46f00..97eb992 100644
> --- a/network.py
> +++ b/network.py

> @@ -700,66 +714,53 @@ class Network:

>         # /etc/udev/rules.d/70-persistent-net.rules
>         rules = "/etc/udev/rules.d/70-persistent-net.rules"
> -        destRules = instPath + rules
> -        if (not instPath) or (not os.path.isfile(destRules)) or \
> -           flags.livecdInstall:
> -            if not os.path.isdir("%s/etc/udev/rules.d" %(instPath,)):
> -                iutil.mkdirChain("%s/etc/udev/rules.d" %(instPath,))
> -
> -            if os.path.isfile(rules) and rules != destRules:
> -                shutil.copy(rules, destRules)

Sorry, I couldn't follow the whole thread on your patch set, so please
bear with me if my question has been answered already.
Is this part that copies an existing rules file if it already exists
moved to somewhere else or dropped completely?
We need this for network on s390x and other platforms. David introduced
it in 0ba6cb516da384e30efdd0dbd70a6c12336fd4f5 for bug 526322 (and
updated it in d1efd7c6ef7e68639a778bedf8250c86db86df2f for bug 527707).

> -            else:
> -                f = open(destRules, "w")
> -                f.write("""
> +        f = open(rules, "w")
> +        f.write("""
> # This file was automatically generated by the /lib/udev/write_net_rules
> # program run by the persistent-net-generator.rules rules file.
> #
> # You can modify it, as long as you keep each rule on a single line.
> .
> """)
> -                for dev in self.netdevices.values():
> -                    addr = dev.get("HWADDR")
> -                    if not addr:
> -                        continue
> -                    devname = dev.get("DEVICE")
> -                    basename = devname
> -                    while basename != "" and basename[-1] in
> string.digits:
> -                        basename = basename[:-1]
> -
> -                    # rules are case senstive for address. Lame.
> -                    addr = addr.lower()
> -
> -                    s = ""
> -                    if len(dev.description) > 0:
> -                        s = "# %s (rule written by anaconda)\n" %
> (dev.description,)
> -                    else:
> -                        s = "# %s (rule written by anaconda)\n" %
> (devname,)
> -                    s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\",
> DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", KERNEL=="%s*",
> NAME="%s"\n' % (addr, basename, devname,)
> -
> -                    f.write(s)
> -
> -                f.close()
> +        for dev in self.netdevices.values():
> +            addr = dev.get("HWADDR")
> +            if not addr:
> +                continue
> +            devname = dev.get("DEVICE")
> +            basename = devname
> +            while basename != "" and basename[-1] in string.digits:
> +                basename = basename[:-1]
> +
> +            # rules are case senstive for address. Lame.
> +            addr = addr.lower()
> +
> +            s = ""
> +            if len(dev.description) > 0:
> +                s = "# %s (rule written by anaconda)\n" %
> (dev.description,)
> +            else:
> +                s = "# %s (rule written by anaconda)\n" % (devname,)
> +            s = s + 'SUBSYSTEM==\"net\", ACTION==\"add\",
> DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", KERNEL=="%s*",
> NAME="%s"\n' % (addr, basename, devname,)
> +
> +            f.write(s)
> +
> +        f.close()
> .
>     # write out current configuration state and wait for NetworkManager
>     # to bring the device up, watch NM state and return to the caller


Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux