[Ovirt-devel] [PATCH] Merge developer/bundled appliance into a single appliance: ovirt-appliance

Perry N. Myers pmyers at redhat.com
Tue Jul 1 13:28:39 UTC 2008


Jeff Schroeder wrote:
[snip]
>> However you did point out two things here, first is that the check for
>> ifcfg-eth1 may not be sufficient to detect whether or not the designated
>> interface is running.  Secondly there may be portability issues with using
>> ifconfig.  I'll see if I can refactor these checks to use something like ip.
>>  Suggestions from our friends working in other distros would be appreciated
>> here.
> 
> What makes this more portable than the same thing using ifconfig?
> "ip addr show $bridge > /dev/null 2>&1 ; bridge_dev_present=$?"

No idea :) Chris just mentioned to me that ifconfig may not be portable, 
if you suggest that ifconfig is fairly prevalent then I am content to 
leave it that way for the time being.  If another random distro wants to 
use oVirt, then they can refactor the script accordingly.

> Are there distros that use something other than net-tools for /sbin/ifconfig?
> Since there is no real distro agnostic way to do this, you'll end up
> special casing
> major distro versions like redhat and debian. The majority of
> distributions are based
> upon those two anyways. Even if it is slackware based, suse has enough
> redhat-isms
> you could probably make the checks for suse the same as redhat.
> 
> +    test -f $NET_SCRIPTS/ifcfg-$bridge && die "$bridge defined in
> $NET_SCRIPTS, aborting!"
> 
> ... somewhere near the top...
> if [ -e /etc/redhat-release ]; then
>     DISTRO=redhat
> elif [ -e /etc/debian_version ]; then
>     DISTRO=debian
> fi
> 
> ifconfig "$bridge" ...  && croak because the interface is already up
> and active...
> 
> case "$DISTRO" in
>     redhat)
>          test -f "$NET_SCRIPTS/ifcfg-$bridge"; bridge_int_undefined=$?
>     ;;
>     debian)
>         grep -qs "$bridge" /etc/network/interfaces; bridge_int_undefined=$?
>     ;;
>     *) you should never be here
> esac
> 
> if [ $bridge_int_undefined = 0 ]; then
>     die "$bridge defined in $NET_SCRIPTS, aborting!"
> fi
> 
> Maybe there is a way to seperate all "distro specific checks" to a common
> shell functions file? Then you could have the common shell functions file return
> variables and keep the individual scripts a bit cleaner? This might be
> overkill, but
> there isn't a generic way to configure persistent network settings on
> Linux. If you
> absolutely need that feature, you might think about abstracting things
> out a bit more.

I think eventually that will be a good idea, but for right now I think 
we're ok.

> Also, why not be a bit more magical? Instead of dying if $bridge is
> defined, why not pick
> the next available interface? Especially for a developer appliance?

Because the user explicitly selected the interface via the -e parameter. 
I don't like the idea of iterating through the physical inferfaces since 
you don't know which one the user has wire to their oVirt physical lan. 
This is only the case for bundled installs.  For developer we don't even 
use the interface since the network is completely internal to the host box.

Perry


-- 
|=-        Red Hat, Engineering, Emerging Technologies, Boston        -=|
|=-                     Email: pmyers at redhat.com                      -=|
|=-         Office: +1 412 474 3552   Mobile: +1 703 362 9622         -=|
|=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|




More information about the ovirt-devel mailing list