Commit Graph

5 Commits

Author SHA1 Message Date
Miloslav Trmač d0d72245eb Use the new built-in min() and max() functions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-04-23 22:21:27 +02:00
Daniel J Walsh a26587fcfe Define error type for ErrNoAvailableIDs
Want to allow Podman to print helpful error message when
users runs out of UIDs to use with podman run --userns=auto.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-03 14:24:35 -05:00
Sascha Grunert a41ae81840 Switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of the
deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-07 13:22:46 +02:00
Giuseppe Scrivano 7d41427411 containers: detect overlapping mappings
when the container specifies some mappings to be applied, verify that
they are not overlapping and give a clearer error message.

Closes: https://github.com/containers/storage/issues/1127

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-08 09:57:34 +01:00
Kan Li 15187b0bb8 Rework autons ID mapping generation.
This implements the algorithm proposed in
https://github.com/containers/storage/issues/852#issuecomment-798954173,
which is:
1. find available IDs from subuid/subgid file; by subtracting the used
   IDs (from other containers) as well as additional IDs, we get the IDs
   available to allocate;
2. target ID range is [0, requestedSize), subtract the additional IDs;
3. allocate IDs from range in step 1; the number to allocate is the
   number of IDs in step 2;
4. generate a mapping from IDs in step 3 to the ones in step 2.

Closes: https://github.com/containers/storage/issues/852

Signed-off-by: Kan Li <likan@google.com>
2021-04-03 13:22:23 -07:00