tumblr / genesis

A tool for data center automation
http://tumblr.github.io/genesis/
Apache License 2.0
156 stars 24 forks source link

Build process should cleanup loop devices #73

Open nshalman opened 7 years ago

nshalman commented 7 years ago

The build process (sometimes??) leaves dangling /dev/loopN devices. My Makefile contains shenanigans for cleaning those up which are relatively simple under Linux. I imagine that on a Mac, the Docker Linux VM could get cluttered up in a way that is even harder to clean up.

It would be better if the build process just cleaned up after itself.

I think the culprit is the livecd-iso-to-pxeboot tool. Assuming that it won't be fixed any time soon, it is possible that after create-image.sh#L78 we could add: losetup -a | grep /genesis/bootcd/genesis.iso | cut -d: -f1 | xargs -r -n 1 losetup -d

Further testing of this idea is needed.

roymarantz commented 7 years ago

That seems quite doable although I would lean towards implement it as:

losetup -a | awk -d: '/genesis/bootcd/genesis.iso {print $1}' | xargs -r -n 1 losetup -d
nshalman commented 7 years ago

I've added a commit to #72 that moves the cleanup logic to create-image.sh (and calls losetup directly from awk, removing the need for xargs as well)