[ovs-dev] [PATCH] interface-reconfigure: Handle CHIN Tunnel objects

Ian Campbell Ian.Campbell at citrix.com
Wed Jun 23 01:22:03 PDT 2010


On Wed, 2010-06-23 at 09:18 +0100, Ian Campbell wrote:
> Only the vswitch backend is able to implement CHIN.

Largely untested patch for 5.5 and 5.6 compatibility if you want it:

diff -r c578743087f2 scripts/InterfaceReconfigure.py
--- a/scripts/InterfaceReconfigure.py	Tue May 11 14:53:57 2010 +0100
+++ b/scripts/InterfaceReconfigure.py	Tue May 11 14:59:08 2010 +0100
@@ -386,7 +386,12 @@
                 continue
             self.__pifs[p] = {}
             for f in _PIF_ATTRS:
-                self.__pifs[p][f] = rec[f]
+                if f in [ "tunnel_access_PIF_of", "tunnel_transport_PIF_of" ] and f not in rec:
+                    # XenServer 5.5 network records did not have
+                    # these fields, so allow them to be missing.
+                    pass
+                else:
+                    self.__pifs[p][f] = rec[f]
             self.__pifs[p]['other_config'] = {}
             for f in _PIF_OTHERCONFIG_ATTRS:
                 if not rec['other_config'].has_key(f): continue
@@ -492,7 +497,13 @@
 
                 self.__get_pif_records_from_xapi(session, host)
 
-                self.__get_tunnel_records_from_xapi(session)
+                try:
+                    self.__get_tunnel_records_from_xapi(session)
+                except XenAPI.Failure, e:
+                    error,details = e.details
+                    if error == "MESSAGE_METHOD_UNKNOWN" and details == "tunnel.get_all":
+                        pass
+
                 self.__get_vlan_records_from_xapi(session)
                 self.__get_bond_records_from_xapi(session)
                 self.__get_network_records_from_xapi(session)
@@ -834,7 +845,8 @@
 # Tunnel PIFs
 #
 def pif_is_tunnel(pif):
-    return len(db().get_pif_record(pif)['tunnel_access_PIF_of']) > 0
+    rec = db().get_pif_record(pif)
+    return rec.has_key('tunnel_access_PIF_of') and len(rec['tunnel_access_PIF_of']) > 0
 
 #
 # Datapath base class






More information about the dev mailing list