]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
ifupdownaddons: iproute2: when you invalidate the cache, make sure the cache flag...
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Wed, 6 Apr 2016 15:19:10 +0000 (08:19 -0700)
committerRoopa Prabhu <roopa@cumulusnetworks.com>
Wed, 6 Apr 2016 15:19:10 +0000 (08:19 -0700)
Ticket: CM-10302
Reviewed By: julien
Testing Done: Tested ifdown of an interface and make sure the addresses
are deleted

cache_invalidate can be called when an interface gets deleted
or on any other deletion event (this is because we dont really
know, what other things have been implicitly deleted by the kernel).
on ifdown, the cache can get invalidated. But if we dont
reset the cache flag, the fill cache functions can still think
the cache is valid and can return None for any queries.
This was happening to address queries, which resulted in
leaving behind configured addresses. because ifdown
thought that there were no running addresses on the interface.

ifupdownaddons/iproute2.py

index c0711a715fa306e0ae00ffed5de537ed740eccbc..39a685a6368f7f57a7b4232b99a4aaf4180554da 100644 (file)
@@ -130,9 +130,9 @@ class iproute2(utilsBase):
         if ifacename argument given, fill cache for ifacename, else
         fill cache for all interfaces in the system
         """
-
         linkout = {}
         if iproute2._cache_fill_done and not refresh: return
+
         try:
             # Check if ifacename is already full, in which case, return
             if ifacename and not refresh:
@@ -226,6 +226,7 @@ class iproute2(utilsBase):
 
     def _cache_invalidate(self):
         linkCache.invalidate()
+        iproute2._cache_fill_done = False
 
     def batch_start(self):
         self.ipbatcbuf = ''