Merge lp:~bac/launchpad/lxc_cleanup into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | no longer in the source branch. |
Merged at revision: | 15045 |
Proposed branch: | lp:~bac/launchpad/lxc_cleanup |
Merge into: | lp:launchpad |
Diff against target: | 0 lines |
To merge this branch: | bzr merge lp:~bac/launchpad/lxc_cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Poster (community) | Approve | ||
Review via email: mp+100155@code.launchpad.net |
Commit message
Have utilities/
Description of the change
Create a script /usr/local/
invoked by the buildbot slave at startup to clean up any cruft
possibly left by previous lxc ephemeral runs.
Here is the state before such a run
/home/bac> ls -ld /tmp/lxc*
drwxrwxrwt 4 root root 160 Mar 30 07:43 /tmp/lxc-
/home/bac> ls -ld /var/lib/
drwxrwxrwt 1 root root 160 Mar 30 07:43 /var/lib/
/home/bac> mount |grep lxc
none on /tmp/lxc-lp-s5Yv3XH type tmpfs (rw)
none on /var/lib/
none on /var/lib/
Now run the cleanup script.
/home/bac> sudo /usr/local/
And here we see the directories are gone and no containers are
running.
/home/bac> ls -ld /tmp/lxc*
ls: cannot access /tmp/lxc*: No such file or directory
/home/bac> ls -ld /var/lib/
ls: cannot access /var/lib/
/home/bac> mount |grep lxc
A follow-on branch for the public branch of lpbuildbot will put in the
step to have this script invoked.
Thank you Brad. Very nice. Your demo in the initial description did not also show that the process was killed, but you told me that this was accomplished as well, as I see in the code. Nice changes to how we write the sudoers file.
You could make the string raw, so that you didn't have to escape \"\"\" so many times. The only downside I see is that you'd have to do something clever about the first line, to make sure it has the shebang in it. Your call.
Maybe adding a comment about the fact that the unpleasant string parsing that you have to do in getPID mirrors what the approach done in lxc-list would be appropriate, to slightly reduce shock and surprise for someone reviewing this in the future.
The apparmor stuff (147-155 of diff) is supposed to be unnecessary now. I'd prefer to have that proved before we rip it out. Since you touched that code, I'm tempted to ask you to do something about it...but I'll forego, and add a separate card on the kanban board for the future.
You mentioned that you would send the unit tests for this code, so that we could have them available when we can divide things up better in lpsetup. I don't see that yet. Please make sure you do so. I'd hate to lose that work.
Thanks again!