Skip to content

Conversation

@thaJeztah
Copy link
Collaborator

relates to #40

rumpl and others added 2 commits August 5, 2022 11:09
Also moved some layerStore related initialization to the non-c8d case
because otherwise they get treated as a graphdriver plugins.

Signed-off-by: Paweł Gronowski <[email protected]>
daemon/daemon.go Outdated
Comment on lines 1017 to 1023
imageRoot := filepath.Join(config.Root, "image", layerStore.DriverName())
ifs, err := image.NewFSStoreBackend(filepath.Join(imageRoot, "imagedb"))
if err != nil {
return nil, err
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perhaps this should even be further down (line 1040); I wasn't 100% sure though if some of the other code depended on side-effects of this (creating the directories)

@thaJeztah thaJeztah force-pushed the snapshotter_configuration_suggestions branch 3 times, most recently from 3776925 to 8ddfa5d Compare August 9, 2022 09:55
daemon: move image-store creation to where it's used; imageRoot should not
be set _before_ the graphdriver name is set, otherwise it may be empty, and
would make it use `/var/lib/docker/image` instead of `/var/lib/docker/image/<storage-driver>/`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
- use early return
- combine all cases to a single switch
- don't trim io.containerd.snapshotter.v1 prefix, as containerd
  itself does not currently support fully-qualified plugin names
  either (we may consider adding support for it in future)

Signed-off-by: Sebastiaan van Stijn <[email protected]>
- make sure to de-reference the whole struct
- use gotest.tools
- rename variables for consistency/clarity

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Reduce the use of daemon.graphDriver field, which should be removed.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the snapshotter_configuration_suggestions branch from 8ddfa5d to a549834 Compare August 9, 2022 10:49
daemon/daemon.go Outdated
Comment on lines -930 to -931
imageRoot := filepath.Join(config.Root, "image", d.graphDriver)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was actually a bug; at this point, d.graphDriver is not yet set, so it would use an empty string; in the old code, d.graphDriver was already set before;

imageRoot := filepath.Join(config.Root, "image", d.graphDriver)

moby/daemon/daemon.go

Lines 841 to 854 in 5de7704

if isWindows {
// On Windows we don't support the environment variable, or a user supplied graphdriver
d.graphDriver = "windowsfilter"
} else {
// Unix platforms however run a single graphdriver for all containers, and it can
// be set through an environment variable, a daemon start parameter, or chosen through
// initialization of the layerstore through driver priority order for example.
if drv := os.Getenv("DOCKER_DRIVER"); drv != "" {
d.graphDriver = drv
logrus.Infof("Setting the storage driver from the $DOCKER_DRIVER environment variable (%s)", drv)
} else {
d.graphDriver = config.GraphDriver // May still be empty. Layerstore init determines instead.
}
}

@vvoland vvoland force-pushed the snapshotter-configuration branch 2 times, most recently from f060068 to e645f73 Compare August 9, 2022 12:52
@thaJeztah thaJeztah deleted the branch rumpl:snapshotter-configuration August 9, 2022 14:21
@thaJeztah thaJeztah closed this Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants