lxd-images: Use tempfile instead of memory #1301

Merged
merged 3 commits into from Nov 11, 2015

Conversation

Projects
None yet
2 participants
Owner

stgraber commented Nov 11, 2015

Closes #1300

Signed-off-by: Stéphane Graber stgraber@ubuntu.com

lxd-images: Use tempfile instead of memory
Closes #1300

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
+ # Create our workdir
+ self.workdir = tempfile.mkdtemp()
+
+ def __del__(self):
@tych0

tych0 Nov 11, 2015

Member

So I always thought this sucked, but __del__ isn't guaranteed to ever be called. If you want cleanup behavior, you have to use a context manager and define __exit__. (Perhaps we don't care about this as it rarely happens, but it's worth noting.)

@stgraber

stgraber Nov 11, 2015

Owner

Yeah, not sure how much we care about this right now with lxd-images going away real soon.

It looks like I've been lucky though as I've yet to see a case where it doesn't trigger :)

Owner

stgraber commented Nov 11, 2015

Also we really need to figure out what's going on with that kvm test...

stgraber added some commits Nov 11, 2015

tests: Fix conflict/race in char device test
When running the char device test multiple times in parallel, you
eventually hit the case where /dev/lxdkvm would be in the wrong state.

Instead use a normal Linux char device for the test.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
tests: Fix noise about loop devices
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>

tych0 added a commit that referenced this pull request Nov 11, 2015

Merge pull request #1301 from stgraber/master
lxd-images: Use tempfile instead of memory

@tych0 tych0 merged commit e9b91f7 into lxc:master Nov 11, 2015

2 checks passed

Jenkins Testsuite passed No test results found.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment