-
Notifications
You must be signed in to change notification settings - Fork 187
qemu: Unlink non-multipath disks #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I ran out of space in `/tmp` today and it turned out I had a whole lot of `/tmp/mantle-qemu` files, including some really big disk images. This is a combination of changes from coreos#1338 and the multipath PR coreos#1296 Basically if we get interrupted by Ctrl-C which is a lot more likely now when qemu isn't owning the serial console from the start, we will leak our tmpfiles. We probably need to install a `SIGINT` handler but that's a whole mess that's avoided if we just let the kernel clean up our resources for us, which is what was happening before the multipath PR (well, at least for files and not the swtpm tmpdir, but that's small). And actually coreos#1380 does install a `SIGINT` handler so someone please review that and we can maybe fix this more after that lands.
ed5df80 to
c997603
Compare
darkmuggle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cgwalters, darkmuggle The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
💯 |
| if !disk.NbdDisk { | ||
| // In the non-multipath/nbd case we can just unlink the disk now | ||
| // and avoid leaking space if we get Ctrl-C'd. | ||
| os.Remove(disk.dstFileName) | ||
| } | ||
| disk.dstFileName = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if !disk.NbdDisk { | |
| // In the non-multipath/nbd case we can just unlink the disk now | |
| // and avoid leaking space if we get Ctrl-C'd. | |
| os.Remove(disk.dstFileName) | |
| } | |
| disk.dstFileName = "" | |
| if !disk.NbdDisk { | |
| // In the non-multipath/nbd case we can just unlink the disk now | |
| // and avoid leaking space if we get Ctrl-C'd. | |
| os.Remove(disk.dstFileName) | |
| // and unset so it doesn't get added to the list of tmpFiles in | |
| // `Exec()` | |
| disk.dstFileName = "" | |
| } |
Otherwise I think in the nbd path we end up not cleaning the disk and socket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK yeah, I'm just going to stick everything in a single tempdir.
We had separate code cleaning up: - disk snapshots - rendered ignition config - swtpm Since the swtpm code was already always making a directory, just generalize that and use it for everything so we only have one directory to remove. Came out of discussion in coreos#1393
We had separate code cleaning up: - disk snapshots - rendered ignition config - swtpm Since the swtpm code was already always making a directory, just generalize that and use it for everything so we only have one directory to remove. Came out of discussion in #1393
I ran out of space in
/tmptoday and it turned out I hada whole lot of
/tmp/mantle-qemufiles, including somereally big disk images. This is a combination of changes
from #1338
and the multipath PR #1296
Basically if we get interrupted by Ctrl-C which is a lot more
likely now when qemu isn't owning the serial console from the
start, we will leak our tmpfiles.
We probably need to install a
SIGINThandler but that's a wholemess that's avoided if we just let the kernel clean up our
resources for us, which is what was happening before the multipath
PR (well, at least for files and not the swtpm tmpdir, but that's
small).
And actually
#1380
does install a
SIGINThandler so someone please review thatand we can maybe fix this more after that lands.