Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

make rm command more robust with addition check #413

Merged
merged 1 commit into from
Sep 9, 2019

Conversation

chanwit
Copy link
Member

@chanwit chanwit commented Sep 8, 2019

Snapshot dev leak happens randomly after rm -f, but sometime it won't.
The default behavior of rm -f works mostly correct. So that the snapshot dev will be removed after RemoveVMContainer. However, there are some glitches reported by #365 and we merged #381 to fix it.

Unfortunately, cleanup in PR #381 add an extra step. If the RemoveVMContainer works correctly, there's no mapping device left to remove. So an error occurred and rm -f returned non-zero. This PR adds more check to correct that behavior.

Signed-off-by: Chanwit Kaewkasi chanwit@gmail.com

Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
@chanwit chanwit requested a review from twelho as a code owner September 8, 2019 15:24
@chanwit chanwit mentioned this pull request Sep 8, 2019
Copy link
Contributor

@stealthybox stealthybox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to make this function more robust -- lgtm

if err := cleanup.DeactivateSnapshot(vm); err != nil {
return err
// After remove the VM container, and the SnapshotDev still there
if _, err := os.Stat(vm.SnapshotDev()); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that we have to do this is a code-smell.
I have a feeling we need to look at how we store vm state.
It's a bit weird that we could run this Cleanup function and not know whether there is a container or snapshot to delete.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed.
we need to take a look into the mechanism of the vm removal process.

@stealthybox stealthybox merged commit 372f22f into weaveworks:master Sep 9, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants