[Ovirt-devel] [PATCH node] Updated the configuration processing to remove the need for scripts.

Jim Meyering jim at meyering.net
Tue Oct 14 10:14:36 UTC 2008


"Darryl L. Pierce" <dpierce at redhat.com> wrote:
> The system now takes an encoded configuration descriptor from the server. It
> then parses from that a set of aliases for bondings if such exist. It then
> also extracts configuration details for the various network interfaces on the
> node. Afterward, it reloads module dependencies and then restarts the
> networking service.
...
> diff --git a/scripts/ovirt-process-config b/scripts/ovirt-process-config
...
> +modconf=$(awk '/bonding=/ {

Hi Darryl,

A couple of nit-picky details:

This should be anchored at beginning of line,
so as not to match a commented-out line:

    modconf=$(awk '/^[ \t]*bonding=/ {

> +        match($0, "bonding=(.*)", data)
> +        split(data[1], mod, "|")
> +
> +        if (match("[^[:alnum:]=_ at -]", mod[1]) >= 0) {
> +            printf "invalid bonding alias: \"%s\"\n", mod[1];
> +            exit 1;
> +        }
> +
> +        alias=mod[1]
> +
> +        printf("install %s bonding", alias)
> +    }' $CONFIG)
> +
> +echo "$modconf" > $OVIRT_KERNEL_MODULE_FILE
> +
> +# now build the list of module aliases to load and load them
> +modules=$(awk '/bonding=/ {

Same here.

> +        match($0, "bonding=(.*)", data)
> +        split(data[1], mod, "|")
> +
> +        printf("%s ", mod[1])
> +    }' $CONFIG)
> +
> +/sbin/depmod -a
> +
> +networking=$(awk '/ifcfg=/ {
> +    match($0, "ifcfg=(.*)", data)
> +    split(data[1], ifcfg, "|")
> +
> +    mac = ifcfg[1]
> +    iface = ifcfg[2]
> +
> +    printf("rm /files/etc/sysconfig/network-scripts/ifcfg-%s\n", iface)
> +    printf("set /files/etc/sysconfig/network-scripts/ifcfg-%s/DEVICE %s\n", iface, iface)

Than factor out the long, duplicated paths above and below,
and it should be fine.

...
> +            printf("set /files/etc/sysconfig/network-scripts/ifcfg-%s/%s %s\n", iface, field, value)

Thanks,
Jim




More information about the ovirt-devel mailing list