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

Make the priority for picking the storage driver configurable #1460

Merged
merged 2 commits into from Jan 6, 2023

Conversation

dcermak
Copy link
Contributor

@dcermak dcermak commented Jan 3, 2023

This fixes #1457

I have tested this locally by vendoring the specific PR into podman and then setting the following ~/.config/containers/storage.conf:

[storage]

driver_priority = [
                "zfs",
                "btrfs",
                "overlay"
]

podman then tried zfs (but failed as I don't have any zfs partitions) and picked btrfs as the next viable candidate.

Removing the setting causes podman to correctly pick up overlay as the driver.

@dcermak dcermak force-pushed the configurable-driver-priority branch from b67adf5 to ba9c182 Compare January 3, 2023 16:21
@rhatdan
Copy link
Member

rhatdan commented Jan 3, 2023

Please update the man page and make it clear the priority list is only used if graphdriver name is NOT specified.

@dcermak dcermak force-pushed the configurable-driver-priority branch from ba9c182 to 3d35b47 Compare January 3, 2023 16:45
@dcermak
Copy link
Contributor Author

dcermak commented Jan 3, 2023

@rhatdan done

@rhatdan
Copy link
Member

rhatdan commented Jan 3, 2023

One issue in the man page, once this is fixed, LGTM
@vrothberg PTAL

@dcermak dcermak force-pushed the configurable-driver-priority branch from 3d35b47 to 92ddbc9 Compare January 3, 2023 23:54
@dcermak
Copy link
Contributor Author

dcermak commented Jan 4, 2023

One question about this change though: when invoking podman now, I always get the following error:

ERRO[0000] The storage 'driver' option must be set in /home/dan/.config/containers/storage.conf to guarantee proper operation

which is also suboptimal from a UX perspective. Does it really need to be an error? The driver is after all set in the store itself.

@vrothberg
Copy link
Member

One question about this change though: when invoking podman now, I always get the following error:

ERRO[0000] The storage 'driver' option must be set in /home/dan/.config/containers/storage.conf to guarantee proper operation

which is also suboptimal from a UX perspective. Does it really need to be an error? The driver is after all set in the store itself.

@giuseppe @rhatdan WDYT? I am surprised as well. Shouldn't Podman / storage be smart enough to pick a default driver if none is set?

drivers/driver.go Outdated Show resolved Hide resolved
types/options.go Outdated Show resolved Hide resolved
@@ -59,6 +59,11 @@ A common use case for this field is to provide a local storage directory when us
container storage run dir (default: "/run/containers/storage")
Default directory to store all temporary writable content created by container storage programs. The rootless runroot path supports environment variable substitutions (ie. `$HOME/containers/storage`)

**driver_priority**=[]
Priority list for the storage drivers that will be tried in case no driver is set.
Copy link
Member

Choose a reason for hiding this comment

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

"will be tried" is a bit vague. Please be specific when a certain driver will be used and when not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it make more sense now?

@dcermak
Copy link
Contributor Author

dcermak commented Jan 4, 2023

One question about this change though: when invoking podman now, I always get the following error:

ERRO[0000] The storage 'driver' option must be set in /home/dan/.config/containers/storage.conf to guarantee proper operation

which is also suboptimal from a UX perspective. Does it really need to be an error? The driver is after all set in the store itself.

@giuseppe @rhatdan WDYT? I am surprised as well. Shouldn't Podman / storage be smart enough to pick a default driver if none is set?

The error comes from here fyi:

logrus.Errorf("The storage 'driver' option must be set in %s to guarantee proper operation", configFile)
and I suspect it has been there for a while (git blame unfortunately only goes back to a commit from 2021)

@dcermak dcermak force-pushed the configurable-driver-priority branch 2 times, most recently from 6e1ef87 to bee865b Compare January 4, 2023 09:09
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

could we keep the error only when DriverPriority is empty (and maybe change it to a warning)?

drivers/driver.go Outdated Show resolved Hide resolved
@rhatdan
Copy link
Member

rhatdan commented Jan 4, 2023

I believe at some point we forced users to specify their driver, because they kept on failing over to VFS in rootless mode, and then complained when they ran out of disk space in their homedir.

Forcing them to specify overlay and failing, caused us to know to have them install fuse-overlayfs before the kernel supported rootless overlay.

Now that rootless overlay will work for almost everyone the overlay default should work, and we might not need to require them to enter any longer.

@rhatdan
Copy link
Member

rhatdan commented Jan 5, 2023

@dcermak Would like to get this in as we are about to release a new version of containers/storage. Are you able to address the comments?

@dcermak
Copy link
Contributor Author

dcermak commented Jan 5, 2023

could we keep the error only when DriverPriority is empty (and maybe change it to a warning)?

Given @rhatdan's comment for the historical context, I'd honestly suggest to remove this error completely. WDYT?

@dcermak Would like to get this in as we are about to release a new version of containers/storage. Are you able to address the comments?

Yes, I'd like to get this is in soon.

This fixes containers#1457

Co-authored-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Dan Čermák <dcermak@suse.com>
@dcermak dcermak force-pushed the configurable-driver-priority branch from bee865b to 881ac48 Compare January 5, 2023 11:38
@rhatdan
Copy link
Member

rhatdan commented Jan 5, 2023

Could we do the check iff driver is not specified and priority is not specified, then fail.

@dcermak
Copy link
Contributor Author

dcermak commented Jan 5, 2023

Could we do the check iff driver is not specified and priority is not specified, then fail.

We do have an internal priority list as a fallback and also in New we try more or less every driver until one of them works:

func New(name string, config Options) (Driver, error) {

Thus I don't consider that warning really valid or is there a case where the user really should define a driver?

@rhatdan
Copy link
Member

rhatdan commented Jan 5, 2023

I am not crazy about the internal list, since it is not easily understood by humans, so I would rather fail and tell them (or the distribution, specify one rather then having it randomly chosen potentially based on which software they have installe.

If the user or distribution specifies a search list of the driver then we should not warn.

dcermak added a commit to dcermak/storage that referenced this pull request Jan 6, 2023
Currently we would display an error when the user does not specify a `driver` in
their config file. This has been present for historical reasons mostly to
prevent users from accidentally getting the vfs
driver (containers#1460 (comment)). Now
that most systems support the overlay driver natively, we can reduce this to a
warning and only warn about it if the driver_priority list is unset. If it is
provided, then clearly the user or the distribution wanted for c/storage to pick
a driver itself and the warning would be only confusing to users.

Signed-off-by: Dan Čermák <dcermak@suse.com>
@dcermak
Copy link
Contributor Author

dcermak commented Jan 6, 2023

@rhatdan Makes sense, I've adjusted the code accordingly, modified the error to be just a warning and tweaked the message as well to sound less scary.

Currently we would display an error when the user does not specify a `driver` in
their config file. This has been present for historical reasons mostly to
prevent users from accidentally getting the vfs
driver (containers#1460 (comment)). Now
that most systems support the overlay driver natively, we can reduce this to a
warning and only warn about it if the driver_priority list is unset. If it is
provided, then clearly the user or the distribution wanted for c/storage to pick
a driver itself and the warning would be only confusing to users.

Signed-off-by: Dan Čermák <dcermak@suse.com>
@dcermak dcermak force-pushed the configurable-driver-priority branch from fbe44c0 to b2b2fef Compare January 6, 2023 07:43
@rhatdan
Copy link
Member

rhatdan commented Jan 6, 2023

LGTM
@vrothberg @giuseppe PTAL

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan rhatdan merged commit 90d0b54 into containers:main Jan 6, 2023
dcermak added a commit to dcermak/storage that referenced this pull request Jan 13, 2023
This is an amend to containers#1460
That PR was not adressing the case when the system wide config had the
driver_priority option configured and the user had no config file of their
own. Then getRootlessStorageOpts would be called and it would override the graph
driver to "vfs".

With this commit we only override the graph driver if driver priority is
empty. Otherwise we propagate the driver priority into the storage options, so
that the driver autodetection works as expected.

Signed-off-by: Dan Čermák <dcermak@suse.com>
dcermak added a commit to dcermak/storage that referenced this pull request Jan 13, 2023
This is an amend to containers#1460 That PR was
not addressing the case when the system wide config had the driver_priority
option configured and the user had no config file of their own. Then
`getRootlessStorageOpts` would be called and it would override the graph driver
to "vfs".

With this commit we only override the graph driver if driver priority is
empty. Otherwise we propagate the driver priority into the storage options, so
that the driver autodetection works as expected.

Signed-off-by: Dan Čermák <dcermak@suse.com>
dcermak added a commit to dcermak/storage that referenced this pull request Jan 16, 2023
This is an amend to containers#1460

That PR was not addressing the case when the system wide config had the
driver_priority option configured and the user had no config file of their
own. Then `getRootlessStorageOpts` would be called and it would override the
graph driver to "vfs".

With this commit we only override the graph driver if driver priority is
empty. Otherwise we propagate the driver priority into the storage options, so
that the driver autodetection works as expected.

Signed-off-by: Dan Čermák <dcermak@suse.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.

Proposal: gracefully fallback to other drivers when loading the provided one fails
4 participants