Don't leave charm files sitting in the cache #7010

Merged
merged 2 commits into from Mar 20, 2017

Conversation

Projects
None yet
4 participants
Member

babbageclunk commented Feb 21, 2017

Description of change

When the charmrepo downloads charm archives it stores them in a cache directory. On the controller this is unnecessary, since the archive is loaded into the blobstore (which is available to all of the controllers in HA, rather than just the one that downloaded the charm initially). Additionally, if a controller had had a large number of models that had been migrated away or otherwise removed, the charms used by those models would still be taking up space on the filesystem.

Remove the charm from the cache once it's been stored.

A cleaner way to do this would be to have the cache dir be an attribute of the CharmStore. The store would get a Cleanup method that would be called when the archive is finished with and would delete the charm dir. Then the controller code wouldn't set a cache dir at all - it would just be a temp directory, and would be removed when the charm was finished with. I haven't done that yet because I want to talk to @rogpeppe about what would work for other places that use the charm store.

Also includes a driveby to rename service to application in the apiserver/application unit tests.

QA steps

  • Bootstrap a controller and add a model
  • Deploy ubuntu
  • Check that the charm cache directory (/var/lib/juju/charmcache) is empty on the controller.

Bug reference

Part of the fix for https://bugs.launchpad.net/juju/+bug/1579976

babbageclunk added some commits Feb 20, 2017

Remove downloaded charm files once stored
There's no need to cache them in the filesystem as well, it means that
they are left lying around after the model is removed.
Member

babbageclunk commented Feb 21, 2017

$$merge$$

Contributor

jujubot commented Feb 21, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Feb 21, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10329

Owner

jameinel commented Mar 20, 2017

$$merge$$

Contributor

jujubot commented Mar 20, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit dd86e50 into juju:2.1 Mar 20, 2017

jujubot added a commit that referenced this pull request Mar 23, 2017

Merge pull request #7141 from wallyworld/merge-2.1-23032017
Merge 2.1 tip into develop

Merge latest 2.1 changes into develop branch. Includes:
- PR #7010 Don't leave charm files sitting in the cache
- PR #7094 Changes for bug 1671265
- PR #7095 Update readme with godeps info

@babbageclunk babbageclunk deleted the babbageclunk:no-cache-dir branch May 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment