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

Re: [Ovirt-devel] [PATCH node] Enabled automated network configuration via kernel arguments.



On Tue, Nov 18, 2008 at 01:02:20PM -0500, Darryl L. Pierce wrote:
> This patch removes unnecessary kernel argument dependencies and adds support for IPv6.
> 
> If supplied, the user can set the IP address, netmask and gateway for
> this interface using the OVIRT_IP_ADDRESS, OVIRT_IP_NETMASK and
> OVIRT_IP_GATEWAY respectively. If all of these options are not provided
> then DHCP is assumed.
> 
> Signed-off-by: Darryl L. Pierce <dpierce redhat com>
> ---
>  scripts/ovirt-config-networking |   94 ++++++++++++++++++++++++++++++++-------
>  scripts/ovirt-firstboot         |   11 +----
>  2 files changed, 79 insertions(+), 26 deletions(-)
> 
> diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
> index 4ad8af0..15c09de 100755
> --- a/scripts/ovirt-config-networking
> +++ b/scripts/ovirt-config-networking
> @@ -3,6 +3,10 @@
>  # Iterates over the list of network devices on the node and prompts the user
>  # to configure each.
>  
> +ME=$(basename "$0")
> +warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
> +die() { warn "$*"; exit 1; }
> +
>  WORKDIR=$(mktemp -d) || exit 1
>  
>  # Remove $WORKDIR upon interrupt (and HUP, PIPE, TERM) and upon normal
> @@ -17,11 +21,15 @@ function configure_interface
>  {
>      NIC=$1
>      AUTO=$2
> -    IPADDR=$OVIRT_IP_ADDRESS
> -    NETMASK=$OVIRT_IP_NETMASK
> -    GATEWAY=$OVIRT_IP_GATEWAY
> -
> -    BRIDGE=ovirtbr`echo $NIC | cut -b4-`
> +    if [[   "$AUTO" == "AUTO"    &&
> +         -n "$OVIRT_IP_ADDRESS" ]]; then
> +        IPADDR=$OVIRT_IP_ADDRESS
> +        NETMASK=$OVIRT_IP_NETMASK
> +        GATEWAY=$OVIRT_IP_GATEWAY
> +        PREFIX=$OVIRT_IP_PREFIX
> +    fi
> +
> +    BRIDGE=ovirtbr$NIC
>      IF_FILENAME="$WORKDIR/augtool-$NIC"
>      BR_FILENAME="$WORKDIR/augtool-$BRIDGE"
>  
> @@ -40,6 +48,21 @@ function configure_interface
>      # how do you want to configure this device? (dhcp, static IP)
>      while true; do
>          if [ -z "$AUTO" ]; then
> +            IPADDR=
> +            NETMASK=
> +            GATEWAY=
> +            IPTYPE=
> +
> +            IPTYPES="IPv4 IPv6 Abort"
> +            PS3="What type of network will be used? "
> +            select TYPE in $IPTYPES
> +            do
> +                case "$TYPE" in
> +                    "Abort") return ;;
> +                    *) IPTYPE=$TYPE; break ;;
> +                esac
> +            done

This is wrong. You can have IPv4 only, IPv6 only (unlikely) or IPv4+IPv6
co-existing (likely). So you have to be able to setup IP details for 
each.

Also, this is using inconsistent/mixed concepts. You're asking for
netmask with IPv4 and prefix with IPv6. 

> +
>              read -p "Will $BRIDGE use dynamic addressing? (Y/N) "

This is insufficient for IPv6.

With IPv4 you have a choice of

  - Static config
  - Stateful autoconfig (ie DHCP)

With IPv6 you have a choice of

  - Static config
  - Stateful autoconf (ie DHCPv6)
  - Stateless autoconf (fully automatic)

I think you're better off combining the questions into one, so

 - Do you want to enable IPv4 ?  no/static/dhcp

     If static
       => Prompt for IPv4 address, prefix or netmask (allow them to
          enter either and figure out which they provided yourself),
          and gateway

 - Do you want to enable IPv6 ?  no/static/dhcp6/autoconf

    If static
       => Prompt for IPv6 address and prefix.


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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