[ovs-dev] [PATCH v2] docker: Integrate docker containers with Open vSwitch.

Gurucharan Shetty shettyg at nicira.com
Thu Oct 16 18:51:51 UTC 2014


On Thu, Oct 16, 2014 at 11:23 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Thu, Oct 16, 2014 at 01:26:37AM -0700, Gurucharan Shetty wrote:
>> Open vSwitch does not have native integration with Docker.
>> INSTALL.Docker explains how Open vSwitch can be integrated
>> with docker non-natively.
>>
>> ovs-docker is a helper script to add network interfaces to
>> docker containers and to attach them as ports to OVS bridge.
>> This script can be further enhanced as we understand different
>> use cases.
>>
>> Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
>
> Thank you for v2!
>
> I think I may have caused some trouble by suggesting "trap".  Now
> there is a minor issue, that may still be worth addressing: when one
> sends a process a signal, one expects that it will exit due to that
> signal, but calling "exit" from the trap handler causes it to exit
> with the specified exit code instead.  The usual way to solve that is
> to change back to the signal's default handling and then re-raise the
> signal.  You can do that with something like:
>
>     for signal in 1 2 3 13 14 15; do
>         trap 'delete_netns_link; trap - $signal; kill -$signal $$' $signal
>     done
This is neat.
I will add the following incremental and push it after a couple of
hours (if no comments).
diff --git a/utilities/ovs-docker b/utilities/ovs-docker
index d27228a..4a43a15 100755
--- a/utilities/ovs-docker
+++ b/utilities/ovs-docker
@@ -31,15 +31,15 @@ create_netns_link () {
     mkdir -p /var/run/netns
     if [ ! -e /var/run/netns/"$PID" ]; then
         ln -s /proc/"$PID"/ns/net /var/run/netns/"$PID"
-        trap 'delete_netns_link' 0 1 2 3 13 14 15
+        trap 'delete_netns_link' 0
+        for signal in 1 2 3 13 14 15; do
+            trap 'delete_netns_link; trap - $signal; kill -$signal $$' $signal
+        done
     fi
 }

 delete_netns_link () {
-    RET="$?"
     rm -f /var/run/netns/"$PID"
-    trap '' 0 1 2 3 13 14 15
-    exit "$RET"
 }

>
> but I do not know whether it is worth it.
>
> Either way,
> Acked-by: Ben Pfaff <blp at nicira.com>
Thanks!



More information about the dev mailing list