Skip to content
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

Add force to umount to force the umount of a container image #198

Merged
merged 1 commit into from
Jul 17, 2018

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jul 13, 2018

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

@rhatdan
Copy link
Member Author

rhatdan commented Jul 13, 2018

@nalind PTAL

layers.go Outdated
Unmount(id string) error
Unmount(id string, force bool) (bool, error)

// Mounted returns whether or not the layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

Missing a . at the end of the godoc.

layers.go Outdated
@@ -677,7 +691,7 @@ func (r *layerStore) Unmount(id string) error {
layer.MountPoint = ""
err = r.Save()
}
return err
return false, err
Copy link
Member

Choose a reason for hiding this comment

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

If err is not nil, this probably needs to be true, since we're leaving the recorded MountCount unchanged.

store.go Outdated
@@ -262,8 +262,8 @@ type Store interface {
Mount(id, mountLabel string) (string, error)

// Unmount attempts to unmount a layer, image, or container, given an ID, a
// name, or a mount path.
Unmount(id string) error
// name, or a mount path. Returns whether or not the layer is still mounted
Copy link
Member

Choose a reason for hiding this comment

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

Missing a . at the end of the godoc.

@nalind
Copy link
Member

nalind commented Jul 16, 2018

The new value that Unmount() returns doesn't seem to be consulted anywhere, and this needs a test.

@rhatdan
Copy link
Member Author

rhatdan commented Jul 16, 2018

Added test and handling of the umount return value.

@rhatdan
Copy link
Member Author

rhatdan commented Jul 16, 2018

@nalind PTAL

optionsHelp: "LayerOrContainerNameOrID",
usage: "Check if a file system is mounted",
minArgs: 1,
action: mounted,
addFlags: func(flags *mflag.FlagSet, cmd *command) {
flags.BoolVar(&jsonOutput, []string{"-json", "j"}, jsonOutput, "Prefer JSON output")

This comment was marked as resolved.

layers.go Outdated
@@ -677,7 +691,7 @@ func (r *layerStore) Unmount(id string) error {
layer.MountPoint = ""
err = r.Save()
}
return err
return err != nil, err
Copy link
Member

Choose a reason for hiding this comment

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

If the Put() succeeds but we fail to save the updated mount count, we return true here. Is that the intention?

Copy link
Member Author

Choose a reason for hiding this comment

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

you tell me. The storage has unmounted the file system, but the database does not have the correct data. Does this mean it is mounted or not?

run storage --debug=false mount $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

# Check it layer is mounted
run storage --debug=false mounted $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
Copy link
Member

Choose a reason for hiding this comment

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

Can we compare to "$layer mounted" here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false unmount $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false mount $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false mounted $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Unmount the third layer.
Copy link
Member

Choose a reason for hiding this comment

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

This comment looks wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false unmount $layer
[ "$status" -eq 0 ]
[ "$output" == "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false unmount $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

FIxed

[ "$output" == "" ]


# Mount the layer twice and force umount
Copy link
Member

Choose a reason for hiding this comment

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

Add a period at the end.

run storage --debug=false mount $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false mounted $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Unmount the third layer.
Copy link
Member

Choose a reason for hiding this comment

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

This comment looks wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

run storage --debug=false unmount --force $layer
[ "$status" -eq 0 ]
[ "$output" != "" ]
# Check it layer is mounted
Copy link
Member

Choose a reason for hiding this comment

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

s/it/if, add a period at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

[ "$status" -eq 0 ]
[ "$output" == "" ]

# Try to delete the first layer, which should fail because it has children.
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't agree with the lines below it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@nalind
Copy link
Member

nalind commented Jul 17, 2018

This includes changes to layers.go, but updates images_ffjson.go's timestamp, so CI still tries to rebuild layers_ffjson.go.

@rhatdan rhatdan force-pushed the umount branch 2 times, most recently from abe6f92 to 46f031b Compare July 17, 2018 14:59
@rhatdan
Copy link
Member Author

rhatdan commented Jul 17, 2018

WooHoo tests pass.
@nalind PTAL, we still have the one question on what to return on partial error.

@rhatdan rhatdan force-pushed the umount branch 2 times, most recently from 6515e04 to bbecea7 Compare July 17, 2018 17:17
errText := ""
if err != nil {
errText = fmt.Sprintf("%v", err)
errors = true
}
if !mounted {
fmt.Printf("%s mountpoint unmounted\n", arg)
}
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocker: in principle it seems... off to treat mounted as useful if err is set.

}
if mounted {
fmt.Printf("%s mounted\n", arg)
}
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocker: in principle it seems... off to treat mounted as useful if err is set.

@nalind
Copy link
Member

nalind commented Jul 17, 2018

A couple of nits about the CLI's interpretation of results from Unmount(), but otherwise it LGTM.

Add force to umount to force the umount of a container image
Add an interface to indicate whether or not the layer is mounted
Add a boolean return from unmount to indicate when the layer is really unmounted

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@rhatdan rhatdan merged commit 46a8a1c into containers:master Jul 17, 2018
runcom added a commit to runcom/storage that referenced this pull request Nov 15, 2018
This check has been wrongly removed with containers#198
The check must stay as it's now part of the Stop/Delete API so reintroduce it back
This fixes containers#233 and the associated CRI-O issues
This PR + cri-o/cri-o#1910 fully fix the issue
I'm going to revendor c/storage in CRI-O to full fix crio after this is merged

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants