diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 351: fix cache leak cause by revno 345

Message ID 20120720222110.29610.40276.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Andy Doan July 20, 2012, 10:21 p.m. UTC
------------------------------------------------------------
revno: 351
committer: Andy Doan <andy.doan@linaro.org>
branch nick: lava-dispatcher
timestamp: Fri 2012-07-20 17:17:45 -0500
message:
  fix cache leak cause by revno 345
  
  apparently we were never hitting the branch of code for an
  use_cache=false pre-built image. As can be seen here:
  
     http://validation.linaro.org/lava-server/scheduler/job/26005/log_file
  
  we are referencing the "lava_cachedir" value and it hadn't been set. Also,
  there was some logic about cache deletion that didn't work and wasn't needed
modified:
  lava_dispatcher/client/master.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/client/master.py'
--- lava_dispatcher/client/master.py	2012-07-12 05:55:34 +0000
+++ lava_dispatcher/client/master.py	2012-07-20 22:17:45 +0000
@@ -499,8 +499,8 @@ 
             else:
                 tarball_dir = mkdtemp(dir=LAVA_IMAGE_TMPDIR)
                 os.chmod(tarball_dir, 0755)
+                lava_cachedir = self.context.lava_cachedir
                 if self.context.job_data.get('health_check', False):
-                    lava_cachedir = self.context.lava_cachedir
                     if self._are_tarballs_cached(image, lava_cachedir):
                         logging.info("Reusing cached tarballs")
                         boot_tgz, root_tgz = self._get_cached_tarballs(image, tarball_dir, lava_cachedir)
@@ -521,12 +521,6 @@ 
                 else:
                     image_file = download_image(image, self.context, tarball_dir)
                     boot_tgz, root_tgz = self._generate_tarballs(image_file)
-                    # remove the cached tarballs
-                    cache_loc = self._tarball_url_to_cache(image, lava_cachedir)
-                    shutil.rmtree(cache_loc, ignore_errors=True)
-                    # remove the cached image files
-                    cache_loc = url_to_cache
-                    shutil.rmtree(cache_loc, ignore_errors=True)
 
         except CriticalError:
             raise
@@ -897,3 +891,4 @@ 
         for line in range(1, len(boot_cmds)):
             self.proc.expect(bootloader_prompt, timeout=300)
             self.proc.sendline(boot_cmds[line])
+