Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

list: Don't fail if rootfs doesn't exist #907

Closed

Conversation

jodh-intel
Copy link
Contributor

If it is not possible to determine the owner of the rootfs, do not fail
the entire list operation, just mark the container owner field with a
question mark.

Fixes #906.

Signed-off-by: James O. D. Hunt [email protected]

If it is not possible to determine the owner of the rootfs, do not fail
the entire `list` operation, just mark the container owner field with a
question mark.

Fixes clearcontainers#906.

Signed-off-by: James O. D. Hunt <[email protected]>
@chavafg
Copy link
Contributor

chavafg commented Jan 8, 2018

lgtm

Approved with PullApprove

}

defer func() {
testingImpl.ListPodFunc = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

dump question why this is need?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This resets the virtcontainers mock handler for ListPod(). See https://github.com/containers/virtcontainers/blob/master/pkg/vcMock/mock.go#L91..L99.

By resetting the handler to nil, we guarantee that any other test that invokes any virtcontainers API calls which either directly or indirectly call ListPod() will fail with an error from the virtcontainers mock package. The reason for all this being that some virtcontainers types are private, but the runtime's unit tests need to create particular test scenarios using those private data types. They also need to simulate previous calls to particular sequences of virtcontainers calls. Since the runtime uses the virtcontainers API heavily, we have a problem as we cannot contrive such scenarios using the main virtcontainers API calls (the runtime tests might not even have sufficient privs to run some of the virtcontainers API calls). As such, virtcontainers provides two implementations of its API - the "proper" / official one and a mock one that can be used for testing the caller of the API itself, as here.

Copy link
Contributor

@jcvenegas jcvenegas left a comment

Choose a reason for hiding this comment

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

F26 is passing \o/ - I would be nice to dig and know is the reason we could not determine the owner any more.

Just some comments to add logs.

if err == nil {
owner = fmt.Sprintf("#%v", uid)
} else {
owner = "?"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an error that started to happen recently, I think we should be able always know the owner , so being this a not usual case can you log a warning and probably and log the error to probably know if the file did not exist ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm having second thoughts about whether we should do this now we've confirmed the CI failure (clearcontainers/jenkins#32) is Fedora only.

What do you think @sameo, @grahamwhaley ? FTR, runc is "semi-lenient": it does not validate whether the container rootfs exists as it doesn't really need to care about that:

Nominally, we do care because we use the container rootfs ownership to show who owns the container. However, we should really be employing a strategy similar to runc which sets the container ownership to the owner of the container directory below runc's state directory. But cc-runtime cannot do that as it doesn't know where the virtcontainers root directory is (implementation detail).

As such, this is all slightly academic as cc-runtime list will always show the owner UID 0 currently.

The advantage of not failing on rootfs lookup is that list will show atleast partial information. Maybe we should hold off deciding until we understand the F26 failure further.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure, mark it as WIP until we get some further info then OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wfm...

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jcvenegas
Copy link
Contributor

Any update on this, I think is safe close it, or merge it but add a warning to our log.

@jodh-intel
Copy link
Contributor Author

Let's close it for now as it no longer seems to be required.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants