Il 10/05/2012 18:32, Ben Pfaff ha scritto:
> Hmm.  This does sound like the correct pattern for a fix, but will it
> cause OVS to delete tap devices that it didn't create?  If not, then
> it definitely sounds right to me.

Good question. It causes OVS to close the fd. I think that If this
causes the interface to disappear, then probably that was the intended
behaviour.  For example, PlanetLab's OVS has to obtain the fd from a
Unix domain socket, so it has not created the tap itself. Anyway, I do
want the tap to disappear when OVS closes it. Outside PlanetLab, I have
tried with persistent taps created by tunctl and then added via

ovs-vsctl add-port br0 tap0 -- set interface tap0 type=tap

They do not disappear when deleted from the bridge.
>
> Will you submit the patch to be included in upstream OVS?  I'd
> appreciate that.

Sure, it is in attachment.

Best regards,
Giuseppe

-- 
Dr. Ing. Giuseppe Lettieri
Dipartimento di Ingegneria della Informazione
Universita' di Pisa
Largo Lucio Lazzarino 2, 56122 Pisa - Italy
Ph. : (+39) 050-2217.649 (direct) .599 (switch)
Fax : (+39) 050-2217.600
e-mail: [email protected]

>From 3325f9aa0d1452a0612c2a1c758b6831e1fd20ef Mon Sep 17 00:00:00 2001
From: Giuseppe Lettieri <[email protected]>
Date: Wed, 9 May 2012 12:17:15 +0200
Subject: [PATCH] proper destruction of netdev datapaths

Bridges with datapath_type=netdev do not destroy the datapath when
deleted. In particular, the tap device implementing the internal
interface is not close()d, and therefore the tap persists until
ovs-vswitchd exit()s.

This behaviour appears to be caused by the missing callback
for 'enumerate' in the dpif-netdev class. Without this callback
'bridge_reconfigure' fails to realize that there are datapaths with no
bridge, and thus cannot destroy them. Providing an 'enumerate' callback
fixes this.
---
 lib/dpif-netdev.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index a33fe23..6a05a7f 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -165,6 +165,17 @@ get_dp_netdev(const struct dpif *dpif)
     return dpif_netdev_cast(dpif)->dp;
 }
 
+static int
+dpif_netdev_enumerate(struct sset *all_dps)
+{
+    struct shash_node *node;
+
+    SHASH_FOR_EACH(node, &dp_netdevs) {
+        sset_add(all_dps, node->name);        
+    }
+    return 0;    
+}
+
 static struct dpif *
 create_dpif_netdev(struct dp_netdev *dp)
 {
@@ -1241,7 +1252,7 @@ dp_netdev_execute_actions(struct dp_netdev *dp,
 
 const struct dpif_class dpif_netdev_class = {
     "netdev",
-    NULL,                       /* enumerate */
+    dpif_netdev_enumerate,
     dpif_netdev_open,
     dpif_netdev_close,
     dpif_netdev_destroy,
-- 
1.7.3.4

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to