Skip to content

overlay & native snapshotters: Usage() result differs across ext4 and XFS #7909

@AkihiroSuda

Description

@AkihiroSuda

Description

A fresh active snapshot is reported to take 4.0 KiB on ext4, 0.0 B on XFS.

Probably this is not a bug, though, but some downstreams may want the size information to be consistent regardless to the backing filesystem.

Steps to reproduce the issue

ext4:

$ sudo ctr snapshot prepare foo
$ sudo ctr snapshot usage
KEY SIZE    INODES 
foo 4.0 KiB 1

XFS:

$ sudo ctr snapshot prepare foo
$ sudo ctr snapshot usage
KEY SIZE  INODES 
foo 0.0 B 1

Describe the results you received and expected

Received: 4 KiB vs 0.0 B
Expected: consistent result

What version of containerd are you using?

containerd github.com/containerd/containerd v1.6.14 9ba4b25

Any other relevant information

On XFS distros TestContainerStats (cri-integration) fails during checking s.GetWritableLayer().GetUsedBytes().GetValue() != 0 because of this difference:

// Test to verify for a container ID
func TestContainerStats(t *testing.T) {
t.Logf("Create a pod config and run sandbox container")
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox1", "stats")
pauseImage := images.Get(images.Pause)
EnsureImageExists(t, pauseImage)
t.Logf("Create a container config and run container in a pod")
containerConfig := ContainerConfig(
"container1",
pauseImage,
WithTestLabels(),
WithTestAnnotations(),
)
cn, err := runtimeService.CreateContainer(sb, containerConfig, sbConfig)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.RemoveContainer(cn))
}()
require.NoError(t, runtimeService.StartContainer(cn))
defer func() {
assert.NoError(t, runtimeService.StopContainer(cn, 10))
}()
t.Logf("Fetch stats for container")
var s *runtime.ContainerStats
require.NoError(t, Eventually(func() (bool, error) {
s, err = runtimeService.ContainerStats(cn)
if err != nil {
return false, err
}
if s.GetWritableLayer().GetUsedBytes().GetValue() != 0 {
return true, nil
}
return false, nil
}, time.Second, 30*time.Second))
t.Logf("Verify stats received for container %q", cn)
testStats(t, s, containerConfig)
}

Show configuration if it is related to CRI plugin.

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions