storage icon indicating copy to clipboard operation
storage copied to clipboard

Refactor storage.conf loading

Open dcermak opened this issue 2 years ago • 10 comments

I would like to propose that we refactor where & when storage.conf is loaded into the storageOptions structs. Currently it happens in various places, it depends on whether we are using rootless mode or not and most of the value copying from the loaded values into the structs is done by hand on a field by field basis. This leads to subtle bugs that required amendments like https://github.com/containers/storage/pull/1468 (and ftr, this one is 100% my fault, because I didn't test the changes from https://github.com/containers/storage/pull/1460 properly).

I would propose that we refactor the config loading, so that it happens in one place only to reduce the cognitive load when dealing with the config loading.

dcermak avatar Jan 16 '23 08:01 dcermak

SGTM

@rhatdan @giuseppe @nalind WDYT?

vrothberg avatar Jan 16 '23 09:01 vrothberg

I think that would be a good idea.

rhatdan avatar Jan 18 '23 23:01 rhatdan

I agree, this part of the code is quite messy and hard to follow

giuseppe avatar Jan 19 '23 10:01 giuseppe

Looks like there's a consensus on this, I'd like to take a shot at this If that sounds okay.

danishprakash avatar Jan 20 '23 06:01 danishprakash

This seems like a good idea, given that there seems to be a bug related to the order in which /etc/containers/storage.conf and /usr/share/containers/storage.conf are processed. See https://bodhi.fedoraproject.org/updates/FEDORA-2023-a0f754c701#comment-2853529.

neverpanic avatar Jan 22 '23 15:01 neverpanic

#1587 related

Meister1593 avatar Apr 29 '23 11:04 Meister1593

It would be nice to have a /etc/containers/storage.conf.d/ directory for overrides. Similar structures already exists for e.g for /etc/containers/registries.conf.d.

This makes it so much easier for config management or Dockerfile authors.

Drop a override file in a folder instead of parsing/reading/setting a key:value in a file that changes on every package update.

e.g. my current primary use case: set driver=zfs in /etc/containers/storage.conf

That's easy to do with config mangement tools like cdist or ansible. But it's a PITA to do from a Dockerfile.

asteven avatar Aug 09 '23 06:08 asteven

I think this would be a good idea, the issue is no one has stepped forward to do the work.

rhatdan avatar Aug 09 '23 11:08 rhatdan

I can start a draft PR and perhaps we can continue this discussion there while consolidating all the ideas shared so far. Wdyt?

danishprakash avatar Aug 09 '23 12:08 danishprakash

Thanks, @danishprakash!

I think it's best to first open a separate issue and discuss how this should look like. Designing inside a PR can be very time consuming, especially for those driving the PR.

vrothberg avatar Aug 09 '23 12:08 vrothberg