A question related to vde_switch

Help
2009-11-20
2013-05-09
  • Frank Pelosato

    Frank Pelosato - 2009-11-20

    Hello together,
    yesterday, I started using vde on my Ubuntu KARMIC box. I start 2 vde switches via upstart (the details are listed in the protocol).
    The following command will be used within the scripts:
    <pre>
    /usr/bin/vde_switch -sock /var/run/vde2/switch0/ctl \
    -mode 666 \
    -dirmode 777 \
    -pidfile /var/run/vde2/switch0/pid \
    -mgmt /var/run/vde2/switch0/mgmt \
    -group vde2-net \
    -mgmtmode 660 \
    -tap tap0 \
    -daemon

    </pre>
    Directly after booting my box, vde_switch has created the socket /var/run/vde2/switch0/ctl. After stoping and starting the switch with the same script used during boot, the same vde_switch command has been created the following socket: /var/run/vde2/switch0/ctl/ctl.
    Can someone take a look at this and explain it?

    Many thanks.

    **My environment:**

    *uname -a*<pre>
    Linux fpamdx550 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 x86_64 GNU/Linux</pre>

    *dpkg -l "*vde*"*

        ||/ Name                              Version                           Beschreibung
       
        +++-=================================-=================================-==================================================================================
        ii  libvdemgmt0                       2.2.2-3ubuntu1                    Virtual Distributed Ethernet - Management console library
        ii  libvdemgmt0-dev                   2.2.2-3ubuntu1                    Virtual Distributed Ethernet - Mgmt console development files
        ii  libvdeplug2                       2.2.2-3ubuntu1                    Virtual Distributed Ethernet - Plug library
        ii  libvdeplug2-dev                   2.2.2-3ubuntu1                    Virtual Distributed Ethernet - Plug development files
        ii  vde2                              2.2.2-3ubuntu1                    Virtual Distributed Ethernet
        ii  vde2-cryptcab                     2.2.2-3ubuntu1                    Virtual Distributed Ethernet - CryptCab
        ii  vdetelweb                         1.1b-3                            Telnet and Web interface for VDE 2.x
        ii  xserver-xorg-input-evdev          1:2.2.5-1ubuntu6                  X.Org X server - evdev input driver

    **lsb_release -a**<pre>
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 9.10
    Release: 9.10
    Codename: karmic</pre>

    **The start scripts using upstart:**

    **/etc/init/vde-switch0.conf**

        #
        description     "Start VDE Switch0"
        start on net-device-added INTERFACE=br0
        stop on runlevel
        console output
        pre-start exec /etc/rc.vde.switch0 start
        post-stop exec /etc/rc.vde.switch0 stop

    **/etc/init/vde-switch1.conf**

        #
        description "Start VDE Switch1"
        start on net-device-added INTERFACE=br0
        stop on runlevel
        console output
        pre-start exec /etc/rc.vde.switch1 start
        post-stop exec /etc/rc.vde.switch1 stop

    /etc/rc.vde.switch0

        #! /bin/sh   
       
        PATH=/sbin:/usr/sbin:/bin:/usr/bin
       
        . /lib/init/vars.sh
        . /lib/lsb/init-functions

        do_start() {
       
        && log_begin_msg "Start configurung vde-switch0, running boot script (/etc/rc.vde.switch0)"
       
        /usr/bin/vde_switch -sock /var/run/vde2/switch0/ctl -mode 666 -dirmode 777 -pidfile /var/run/vde2/switch0/pid -mgmt /var/run/vde2/switch0/mgmt -group vde2-net -mgmtmode 660 -tap tap0 -daemon
       
        ES=$?
       
                if ; then
       
                        return $ES
       
                fi
       
                /usr/sbin/brctl addif br0 tap0
       
                ES=$?
       
                if ; then
       
                        return $ES
       
                fi
       
                sleep 2s
       
                ifconfig tap0 up
       
                ES=$?
       
                if ; then
       
                        return $ES
       
                fi
       
        && log_end_msg $ES
       
        return $ES
       
        }
       
       
       
        do_stop() {
       
                 && log_begin_msg "Shutdown vde-switch0, running boot script (/etc/rc.vde.switch0)"
       
                kill -s TERM "`cat /var/run/vde2/switch0/pid`"
       
        ES=$?
       
                if ; then
       
                        return $ES
       
                fi
       
        && log_end_msg $ES
       
        return $ES
       
        }
       
       
       
        case "$1" in
       
            start)
       
        do_start
       
                ;;
       
            restart|reload|force-reload)
       
                echo "Error: argument '$1' not supported" >&2
       
                exit 3
       
                ;;
       
            stop)
       
        do_stop
       
                ;;
       
            *)
       
                echo "Usage: $0 start|stop" >&2
       
                exit 3
       
                ;;
       
        esac

    **/etc/rc.vde.switch1**

        #! /bin/sh
       
       
        PATH=/sbin:/usr/sbin:/bin:/usr/bin
       
       
       
        . /lib/init/vars.sh
       
        . /lib/lsb/init-functions
       
       
        do_start() {
       
        && log_begin_msg "Start configurung vde-switch1, running boot script (/etc/rc.vde.switch1)"
       
        /usr/bin/vde_switch -sock /var/run/vde2/switch1/ctl -mode 666 -dirmode 777 -pidfile /var/run/vde2/switch1/pid -mgmt /var/run/vde2/switch1/mgmt -group vde2-net -mgmtmode 660 -daemon
       
        ES=$?
       
                if ; then
       
                        return $ES
                fi
       
        && log_end_msg $ES
       
        return $ES
       
        }
       
       
       
        do_stop() {
       
                 && log_begin_msg "Shutdown vde-switch1, running boot script (/etc/rc.vde.switch1)"
       
                kill -s TERM "`cat /var/run/vde2/switch1/pid`"
       
        ES=$?
       
                if ; then
       
                        return $ES
       
                fi
       
        && log_end_msg $ES
       
        return $ES
       
        }
       
       
       
        case "$1" in
       
            start)
       
        do_start
       
                ;;
       
            restart|reload|force-reload)
       
                echo "Error: argument '$1' not supported" >&2
       
                exit 3
       
                ;;
       
            stop)
       
        do_stop
       
                ;;
       
            *)
       
                echo "Usage: $0 start|stop" >&2
       
                exit 3
       
                ;;
       
        esac

    **Situation immediately after boot:**

        ps -ef | grep vde
       
        root      1387     1  0 12:21 ?        00:00:00 /usr/bin/vde_switch -sock /var/run/vde2/switch1/ctl -mode 666 -dirmode 777 -pidfile /var/run/vde2/switch1/pid -mgmt /var/run/vde2/switch1/mgmt -group vde2-net -mgmtmode 660 -daemon
       
        root      2727     1  0 12:21 ?        00:00:00 /usr/bin/vde_switch -sock /var/run/vde2/switch0/ctl -mode 666 -dirmode 777 -pidfile /var/run/vde2/switch0/pid -mgmt /var/run/vde2/switch0/mgmt -group vde2-net -mgmtmode 660 -tap tap0 -daemon
       
        root      3986  3645  0 12:25 pts/7    00:00:00 grep -color=auto vde
       
        0 20.11.2009 12:25:52  ~
       
       
        uptime
       
         12:26:08 up 7 min,  8 users,  load average: 0.04, 0.44, 0.33
       
       
       
       
        ls -l /var/run/vde2/*
       
        /var/run/vde2/switch0:
       
        insgesamt 4
       
        srw-rw-rw- 1 root vde2-net 0 2009-11-20 12:21 ctl
         (after boot, it's a file)
        srw-rw--- 1 root root     0 2009-11-20 12:21 mgmt
       
        -rw-r-r- 1 root root     5 2009-11-20 12:21 pid
       
       
       
        /var/run/vde2/switch1:
       
        insgesamt 4
       
        srwxrwxrwx 1 root vde2-net 0 2009-11-20 12:21 ctl
         (after boot, it's a file)
        srw-rw--- 1 root root     0 2009-11-20 12:21 mgmt
       
        -rw-r-r- 1 root root     5 2009-11-20 12:21 pid
       
       
       
       
        unixterm /var/run/vde2/switch0/mgmt
       
        VDE switch V.2.2.2
       
        (C) Virtual Square Team (coord. R. Davoli) 2005,2006,2007 - GPLv2
       
       
       
        vde$ ds/showinfo
       
        0000 DATA END WITH '.'
       
        ctl dir /var/run/vde2/switch0
       
        std mode 0666
       
        .
       
        1000 Success
       
       
       
        vde$
       
       
       
        unixterm /var/run/vde2/switch1/mgmt
       
        VDE switch V.2.2.2
       
        (C) Virtual Square Team (coord. R. Davoli) 2005,2006,2007 - GPLv2
       
       
       
        vde$ ds/showinfo
       
        0000 DATA END WITH '.'
       
        ctl dir /var/run/vde2/switch1
       
        std mode 0666
       
        .
       
        1000 Success
       
       
       
        vde$

    **After stop and start with the same /etc script:**

        /etc/rc.vde.switch1 stop
       
         * Shutdown vde-switch1, running boot script (/etc/rc.vde.switch1)        
       
       
        /etc/rc.vde.switch0 stop
       
         * Shutdown vde-switch0, running boot script (/etc/rc.vde.switch0)        
       
       
        ls -l /var/run/vde2/*
       
        /var/run/vde2/switch0:
       
        insgesamt 0
       
       
       
        /var/run/vde2/switch1:
       
        insgesamt 0
       
       
        /etc/rc.vde.switch0 start
       
         * Start configurung vde-switch0, running boot script (/etc/rc.vde.switch0)          
       
       
        /etc/rc.vde.switch1 start
       
         * Start configurung vde-switch1, running boot script (/etc/rc.vde.switch1)          
       
       
       
        ls -l /var/run/vde2/*
       
        /var/run/vde2/switch0:
       
        insgesamt 4
       
        drwxrwxrwx 2 root root 60 2009-11-20 14:37 ctl
         (now, it's a directory)
        srw-rw--- 1 root root  0 2009-11-20 14:37 mgmt
       
        -rw-r-r- 1 root root  6 2009-11-20 14:37 pid
       
       
       
        /var/run/vde2/switch1:
       
        insgesamt 4
       
        drwxrwxrwx 2 root root 60 2009-11-20 14:38 ctl
       
         (now, it's a directory)
        srw-rw--- 1 root root  0 2009-11-20 14:38 mgmt
       
        -rw-r-r- 1 root root  6 2009-11-20 14:38 pid
       
       
        unixterm /var/run/vde2/switch0/mgmt
       
        VDE switch V.2.2.2
       
        (C) Virtual Square Team (coord. R. Davoli) 2005,2006,2007 - GPLv2
       
       
       
        vde$ ds/showinfo
       
        0000 DATA END WITH '.'
       
        ctl dir /var/run/vde2/switch0/ctl
       
        std mode 0666
       
       
        1000 Success
       
       
       
        vde$
       
       
        unixterm /var/run/vde2/switch1/mgmt
       
        VDE switch V.2.2.2
       
        (C) Virtual Square Team (coord. R. Davoli) 2005,2006,2007 - GPLv2
       
       
        vde$ ds/showinfo
       
        0000 DATA END WITH '.'
       
        ctl dir /var/run/vde2/switch1/ctl
       
        std mode 0666
       
        .
       
        1000 Success
       
       
       
        vde$

     
  • Luca Bigliardi

    Luca Bigliardi - 2009-11-21

    It seems there's a bug in the path canonicalization. I'm opening a bug for that and I'll try to fix it ASAP.

    As a workaround just add "mkdir -p /var/run/vde2/switch1" before starting the switch.

    On a side note: instead of killing the switch you can also use "vdecmd -s /var/run/vde2/switch0/mgmt shutdown".

    Thank you,

    Luca

     
  • Frank Pelosato

    Frank Pelosato - 2009-11-21

    Luca, thank you for the quick answer. Till the fix is available, I'll take your suggestions and change my scripts.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks