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-api

[Xen-API] [PATCH 13 of 33] interface-reconfigure: do not remove ifcfg fi

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 13 of 33] interface-reconfigure: do not remove ifcfg files when unplugging a PIF
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Dec 2009 14:17:08 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Fri, 18 Dec 2009 06:19:45 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1261145815@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Doing so breaks when unplugging a VLAN when the VLAN slave is already
unplugged since the ifcfg files are already removed. This reverts the
fix to CA-21401 which should be solved by stopping anything in domain
0 which is not under our control from acting on a PIF hotplug.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 5402c8dd35fd -r 3e604242abf0 scripts/interface-reconfigure
--- a/scripts/interface-reconfigure     Fri Dec 18 14:16:32 2009 +0000
+++ b/scripts/interface-reconfigure     Fri Dec 18 14:16:32 2009 +0000
@@ -123,7 +123,6 @@
         self.__path    = os.path.join(dirname, basename)
         self.__oldpath = os.path.join(dirname, "." + basename + ".xapi-old")
         self.__newpath = os.path.join(dirname, "." + basename + ".xapi-new")
-        self.__unlink = False
 
         self.__f = open(self.__newpath, "w")
 
@@ -143,13 +142,6 @@
         if self.__state != self.__STATE['OPEN']:
             raise Error("Attempt to write to file in state %s" % self.__state)
         self.__f.write(args)
-
-    def unlink(self):
-        if self.__state != self.__STATE['OPEN']:
-            raise Error("Attempt to unlink file in state %s" % self.__state)
-        self.__unlink = True
-        self.__f.close()
-        self.__state = self.__STATE['NOT-APPLIED']
 
     def close(self):
         if self.__state != self.__STATE['OPEN']:
@@ -184,10 +176,7 @@
 
         # Apply new configuration.
         assert(os.path.exists(self.__newpath))
-        if not self.__unlink:
-            os.link(self.__newpath, self.__path)
-        else:
-            pass # implicit unlink of original file
+        os.link(self.__newpath, self.__path)
 
         # Remove temporary file.
         os.unlink(self.__newpath)
@@ -1232,14 +1221,6 @@
 
     return f
 
-def unconfigure_pif(pif):
-    """Clear up the files created by configure_pif"""
-    f = open_pif_ifcfg(pif)
-    log("Unlinking stale file %s" % f.path())
-    f.unlink()
-    return f
-
-
 def bring_down_bridge(bridge, destroy=False):
     """Bring down the bridge associated with a PIF."""
     log("Bring bridge %s down" % bridge)
@@ -1394,14 +1375,6 @@
         bring_down_interface(master, destroy=True)
         if master_bridge:
             bring_down_bridge(master_bridge, destroy=True)
-        # unconfigure master
-        removed = unconfigure_pif(master)
-        f.attach_child(removed)
-        if master_bridge:
-            removed = open_network_ifcfg(master)
-            log("Unlinking stale file %s" % removed.path())
-            removed.unlink()
-            f.attach_child(removed)
 
     # No masters left - now its safe to reconfigure the slave.
     bring_down_interface(pif)
@@ -1430,25 +1403,6 @@
 
 def action_down(pif):
     bring_down_interface(pif, destroy=True)
-
-    # Clear up the pif's config file
-    f = unconfigure_pif(pif)
-
-    # If there's a bridge associated, clear up its config file
-    bridge = bridge_name(pif)
-    if bridge:
-        br = open_network_ifcfg(pif)
-        log("Unlinking stale file %s" % br.path())
-        br.unlink()
-        f.attach_child(br)
-
-    try:
-        f.apply()
-        f.commit()
-    except Error, e:
-        log("action_down failed to apply changes: %s" % e.msg)
-        f.revert()
-        raise
 
 def action_rewrite(pif):
 

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

<Prev in Thread] Current Thread [Next in Thread>