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

More docker compat API fixes #8494

Merged
merged 1 commit into from
Dec 4, 2020
Merged

More docker compat API fixes #8494

merged 1 commit into from
Dec 4, 2020

Conversation

mlegenovic
Copy link
Contributor

Fixes wrong VirtualSize, ParentId, Architecture, Author, Os and OsVersion value

Signed-off-by: Milivoje Legenovic [email protected]

@@ -923,6 +923,11 @@ func (i *Image) Size(ctx context.Context) (*uint64, error) {
return nil, errors.Wrap(err, "unable to determine size")
}

//VirtualSize returns the virtual size of the image
func (i *Image) VirtualSize(ctx context.Context) (*uint64, error) {
return i.Size(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

The doubled call to i.Size() should be avoided - it's a very expensive operation.

Copy link
Contributor Author

@mlegenovic mlegenovic Nov 27, 2020

Choose a reason for hiding this comment

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

@mheon What would you propose:

  • to make a new field which is lazy initialized, and if called a second time no calculation is needed (I suppose image size cannot change)
  • to remove VirtualSize function, and to always use Size because both attributes always have the same values. At the moment Size == VirtualSize is more or less everywhere I saw in code, but I do not know if this is just temporary solution, or if this will change. I did VirtualSize function just to have an abstraction for calculation logic, but if both values are always the same, it is not needed.

Or do you have any other ideas?

@mheon
Copy link
Member

mheon commented Nov 27, 2020 via email

@mheon
Copy link
Member

mheon commented Nov 30, 2020

Test failures are consistent and look legitimate, but the error doesn't seem to make much sense - missing top layers for images we built ourselves make no sense?

@vrothberg Mind taking a look here?

@mlegenovic
Copy link
Contributor Author

@mheon I assume the problem is in GetParent function. Reason for the assumption is this comment:

// FIXME: GetParent() panics
// parent, err := l.GetParent(context.TODO())

which I have deleted because of small refactoring. GetParent is now called in my change-request every time when ParentId is determined. That is one of the fixed fields.

GetParent is also called in Remove function, but maybe this function is not called in a test, and therefore problem never occurs.

I will try to find out something with the debugger (just had no time to do it before).

@mlegenovic
Copy link
Contributor Author

It is very strange. If I run podman command that is executed in test-code by hand, everything works. Then I saw test-code calls podman with vfs as storage backend, and I thought maybe that is the problem... but it is not. If I run test with go test <all_args> it fails.

What I noticed is, Runtime.layerTree() function has this tree.nodes map. If you run podman command by hand, content of this map is different (it has items) then if it is called by test-code (no items in map), but both are inspecting the same image.

@mheon
Copy link
Member

mheon commented Dec 1, 2020

This sounds like it could be because of the added store for image caching. We use an extra store for cached images (as described in https://www.redhat.com/sysadmin/image-stores-podman) in CI to speed things up (with an option to manually disable said caching for tests it breaks). We may need to disable the cache for these tests.

@mlegenovic
Copy link
Contributor Author

Can I disable this cache somehow locally? I run test with
$ go test -v test/e2e/libpod_suite_test.go test/e2e/common_test.go test/e2e/config.go test/e2e/config_amd64.go test/e2e/build_test.go
Is there an option to disable it?

@mheon
Copy link
Member

mheon commented Dec 1, 2020

@baude is the expert on this, so he might be able to help

@mlegenovic
Copy link
Contributor Author

@mheon I have found the reason for the failed test. "podman build and check identity" test in test/e2e/build_test.go calls podman once with podmanTest.Podman() and a second time with podmanTest.PodmanNoCache(). This combination does not work. It works if you run both commands with podmanTest.Podman() or with podmanTest.PodmanNoCache(), otherwise layers array is empty, and test fails as consequence.

@rhatdan
Copy link
Member

rhatdan commented Dec 4, 2020

@mlegenovic Could you rebase please.

@mheon
Copy link
Member

mheon commented Dec 4, 2020

The one failure looks like a flake
/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, mlegenovic

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2020
Fixes wrong VirtualSize, ParentId, Architecture, Author, Os and OsVersion value

Signed-off-by: Milivoje Legenovic <[email protected]>
@jwhonce
Copy link
Member

jwhonce commented Dec 4, 2020

LGTM

@mheon
Copy link
Member

mheon commented Dec 4, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 4, 2020
@openshift-merge-robot openshift-merge-robot merged commit b6536d2 into containers:master Dec 4, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants