WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-fr

Re: RE [Xen-fr] Installation d'une machine domU fedora 7 32 bitssurmachi

To: xen-fr@xxxxxxxxxxxxxxxxxxx
Subject: Re: RE [Xen-fr] Installation d'une machine domU fedora 7 32 bitssurmachine hotes 64 bits centos 5
From: Eric Doutreleau <Eric.Doutreleau@xxxxxxxxxxxxxx>
Date: Thu, 03 Apr 2008 15:20:22 +0200
Delivery-date: Thu, 03 Apr 2008 06:20:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <OF80E033A2.786B0F03-ONC1257420.00444E50-C1257420.004483EF@xxxxxxxxx>
List-archive: <http://lists.xensource.com/archives/html/xen-fr>
List-help: <mailto:xen-fr-request@lists.xensource.com?subject=help>
List-id: xen-fr.lists.xensource.com
List-post: <mailto:xen-fr@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-fr>, <mailto:xen-fr-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-fr>, <mailto:xen-fr-request@lists.xensource.com?subject=unsubscribe>
References: <OF80E033A2.786B0F03-ONC1257420.00444E50-C1257420.004483EF@xxxxxxxxx>
Reply-to: xen-fr@xxxxxxxxxxxxxxxxxxx
Sender: xen-fr-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.12 (X11/20080226)
Alain BARTHE a écrit :

Désolé que ça ne marche toujours pas...
Par contre, tu confirmes ? On peut installer un domU sur un VLAN ? Il faut que je regarde ça... Moi aussi j'ai un bridge par VLAN, mais je les crée par un script séparé, je n'ai pas touché au script de xen.

xen-fr-bounces@xxxxxxxxxxxxxxxxxxx a écrit sur 03/04/2008 13:59:28 :

> Alain BARTHE a écrit :
> >
> > Bonjour,
> >
> Merci de ta reponse.
> Je vais tester ca de suite.
> En fait j'arrive tres bien a installer des configurations plus "simple"
> c'est à dire meme version d'os et d'architecture dans des vlans differents.
> j'ai simplement modifie le script network-script pour creer un bridge
> par vlan.
>
> je le tiens a disposition si necessaire.
>
> _______________________________________________
> Xen-fr mailing list
> Xen-fr@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-fr
------------------------------------------------------------------------

_______________________________________________
Xen-fr mailing list
Xen-fr@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-fr
je te mets en attachement les deux scripts

dans /etc/xen/xend-config.sxp
remplacer
network-script network-bridge
par
network-script network-multi-vlan

dans le script network-multi-vlan tu rajoutes autant de ligne que de vlan que tu desires

# Once all normal bridges are active, create any vlan-based briges.
"$dir/network-bridge-vlan" "$@" vlan=15

tu redemares xend et le tour est joué


#!/bin/sh
#============================================================================
# Xen vlan bridge start/stop script.
# Xend calls a network script when it starts.
# The script name to use is defined in /etc/xen/xend-config.sxp
# in the network-script field.
#
# This script creates a bridge (default vlanbr${vlan}), creates a device
# (default eth0.${vlan}), and adds it to the bridge. This scrip assumes
# the Dom0 does not have an active interface on the selected vlan; if
# it does the network-bridge script should be used instead.
#
# To use this script, vconfig must be installed.
#
# Usage:
#
# network-bridge-vlan (start|stop|status) {VAR=VAL}*
#
# Vars:
#
# vlan       The vlan to bridge (default 2)
# bridge     The bridge to use (default vlanbr${vlan}).
# netdev     The interface to add to the bridge (default eth0}).
#
# Internal Vars:
# vlandev="${netdev}.${vlan}"
#
# start:
# Creates the bridge
# Adds vlandev to netdev
# Enslaves vlandev to bridge
#
# stop:
# Removes vlandev from the bridge
# Removes vlandev from netdev 
# Deletes bridge
#
# status:
# Print vlan, bridge
#
#============================================================================


dir=$(dirname "$0")
. "$dir/xen-script-common.sh"

findCommand "$@"
evalVariables "$@"

vlan=${vlan:-2}
bridge=${bridge:-vlanbr${vlan}}
netdev=${netdev:-eth0}

vlandev="${netdev}.${vlan}"

##
# link_exists interface
#
# Returns 0 if the interface named exists (whether up or down), 1 otherwise.
#
link_exists()
{
    if ip link show "$1" >/dev/null 2>/dev/null
    then
        return 0
    else
        return 1
    fi
}


# Usage: create_bridge bridge
create_bridge () {
    local bridge=$1

    # Don't create the bridge if it already exists.
    if ! brctl show | grep -q ${bridge} ; then
        brctl addbr ${bridge}
        brctl stp ${bridge} off
        brctl setfd ${bridge} 0
    fi
    ip link set ${bridge} up
}

# Usage: add_to_bridge bridge dev
add_to_bridge () {
    local bridge=$1
    local dev=$2
    # Don't add $dev to $bridge if it's already on a bridge.
    if ! brctl show | grep -q ${dev} ; then
        brctl addif ${bridge} ${dev}
    fi
}

# Usage: show_status vlandev bridge
# Print vlan and bridge
show_status () {
    local vlandev=$1
    local bridge=$2
    
    echo '============================================================'
    cat /proc/net/vlan/${vlandev}
    echo ' '
    brctl show ${bridge}
    echo '============================================================'
}

op_start () {
    if [ "${bridge}" = "null" ] ; then
        return
    fi

  #  if ! link_exists "$netdev"; then
  #      return
  #  fi

#    if link_exists "$vlandev"; then
#        # The device is already up.
#        return
#    fi

    create_bridge ${bridge}

    ip link set ${netdev} up

    vconfig set_name_type DEV_PLUS_VID_NO_PAD
    vconfig add ${netdev} ${vlan}
    ip link set ${vlandev} address fe:ff:ff:ff:ff:ff
    ip link set ${vlandev} up
    ip link set ${bridge} up

    add_to_bridge2 ${bridge} ${vlandev}
}

op_stop () {
    if [ "${bridge}" = "null" ]; then
        return
    fi
    if ! link_exists "$bridge"; then
        return
    fi

    if link_exists "$vlandev"; then
        ip link set ${vlandev} down

        brctl delif ${bridge} ${vlandev}
        ip link set ${bridge} down

        vconfig rem ${vlandev}
    fi
    brctl delbr ${bridge}
}

# adds $dev to $bridge but waits for $dev to be in running state first
add_to_bridge2() {
    local bridge=$1
    local dev=$2
    local maxtries=10

    echo -n "Waiting for ${dev} to negotiate link."
    for i in `seq ${maxtries}` ; do
        if ifconfig ${dev} | grep -q RUNNING ; then
            break
        else
            echo -n '.'
            sleep 1
        fi
    done

    if [ ${i} -eq ${maxtries} ] ; then echo '(link isnt in running state)' ; fi

    add_to_bridge ${bridge} ${dev}
}

case "$command" in
    start)
        op_start
        ;;
    
    stop)
        op_stop
        ;;

    status)
        show_status ${vlandev} ${bridge}
        ;;

    *)
        echo "Unknown command: $command" >&2
        echo 'Valid commands are: start, stop, status' >&2
        exit 1
esac
#!/bin/sh
#============================================================================
# Xen vlan bridge start/stop script.
# Xend calls a network script when it starts.
# The script name to use is defined in /etc/xen/xend-config.sxp
# in the network-script field.
#
# This script creates multiple bridges to segregate individual domUs to 
# separate VLANs. Customize to fit your needs.
#
# Usage:
#
# network-multi-vlan (start|stop|status)
#
#============================================================================

dir=$(dirname "$0")

##
# To make the tagged interface available to some DomUs, create the default
# bridge. Comment this out to only make vlan-based bridges available.
#"$dir/network-bridge" "$@" vifnum=0

##
# Once all normal bridges are active, create any vlan-based briges. 
"$dir/network-bridge-vlan" "$@" vlan=15

_______________________________________________
Xen-fr mailing list
Xen-fr@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-fr