-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix additional image stores in podman info #24731
Fix additional image stores in podman info #24731
Conversation
test/system/005-info.bats
Outdated
if [[ -z "$CI_DESIRED_STORAGE" ]]; then | ||
# When running in Cirrus, CI_DESIRED_STORAGE *must* be defined | ||
# in .cirrus.yml so we can double-check that all CI VMs are | ||
# using overlay or vfs as desired. | ||
if [[ -n "$CIRRUS_CI" ]]; then | ||
die "CIRRUS_CI is set, but CI_DESIRED_STORAGE is not! See #20161" | ||
fi | ||
|
||
# Not running under Cirrus (e.g., gating tests, or dev laptop). | ||
# Totally OK to skip this test. | ||
skip "CI_DESIRED_STORAGE is unset--OK, because we're not in Cirrus" | ||
fi | ||
is "$(podman_storage_driver)" "$CI_DESIRED_STORAGE" "podman storage driver is not CI_DESIRED_STORAGE (from .cirrus.yml)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessary, the test does not have to depend on any CI setup so it shouldn't as we should be able to run that locally.
Just call $(podman_storage_driver)
to know the current driver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will do that
test/system/005-info.bats
Outdated
is "$(podman_storage_driver)" "$CI_DESIRED_STORAGE" "podman storage driver is not CI_DESIRED_STORAGE (from .cirrus.yml)" | ||
skip_if_remote "--storage-opt flag is not supported for remote" | ||
# Only overlay storage driver supports additional image stores | ||
if [[ "$CI_DESIRED_STORAGE" = "overlay" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That isn't true, vfs supports extra imagestores as well so the condition is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -260,7 +261,14 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) { | |||
program["Version"] = ver | |||
program["Package"] = version.Package(split[1]) | |||
graphOptions[split[0]] = program | |||
} else { | |||
case strings.HasSuffix(split[0], "imagestore"): | |||
key := strings.ReplaceAll(split[0], "imagestore", "additionalImageStores") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means the old imagestore
field is no longer included while the certainly was buggy it might be that users depend on that field somehow so we should not remove it and keep for backwards compat at least until 6.0 IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can keep that key as well, with the same logic if you think it can break someone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need both. imagestore refers to a path where images will be stored. This feature is mostly used by CRI-O to split containers and images on two different file systems. It is not the same as additionalimagestores.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@giuseppe I see that there are 2 different configs in storage.conf
:
[storage]
imagestore = "/first/path"
[storage.options]
additionalimagestores = [ "second/path" ]
But podman info
returns only the additionalimagestores
path:
...
store:
...
graphOptions:
overlay.imagestore: "second/path"
overlay.additionalImageStores: ["second/path"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRI-O shouldn't be affected by what podman info
returns (this PR change), right?
0b6899b
to
0aa347a
Compare
test/system/005-info.bats
Outdated
store1=$PODMAN_TMPDIR/store1 | ||
store2=$PODMAN_TMPDIR/store2 | ||
mkdir -p $store1 $store2 | ||
run_podman info --storage-opt=$(podman_storage_driver)'.imagestore='$store1 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you cache $(podman_storage_driver)
in a var? It seems the function calls podman info each time and info is a rather slow command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
test/system/005-info.bats
Outdated
mkdir -p $store1 $store2 | ||
run_podman info --storage-opt=$(podman_storage_driver)'.imagestore='$store1 \ | ||
--storage-opt=$(podman_storage_driver)'.imagestore='$store2 \ | ||
--format '{{index .Store.GraphOptions "'$(podman_storage_driver)'.additionalImageStores"}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{index .Store.GraphOptions "'$(podman_storage_driver)'.additionalImageStores"}}\n{{index .Store.GraphOptions "'$(podman_storage_driver)'.imagestore"}}
Can you use this format then check
assert "${lines[0]}" == "["$store1" "$store2"]" "output includes additional image stores"
assert "${lines[1]}" == "$store2" "old imagestore output"
In general assert
should be preferred over is
as is
has some rather dangerous pitfalls, i.e. your current test can end up broken as []
is valid regex so is may assume it should perfom a regex match not an exact match.
With assert
you must specify ==
or =~
so there is no ambiguity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
The command `podman info` returned only one imagestore in `store.graphOptions.<driver>.imagestore` even if multiple image stores were configured. This change replaces the field `<driver>.imagestore` with the field `<driver>.additionalImageStores`, that instead of a string is an array of strings and that includes all the configured additional image stores. Fix containers/storage#2094 Signed-off-by: Mario Loriedo <[email protected]>
0aa347a
to
0d3a653
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: l0rd, Luap99 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
The command
podman info
returned only one imagestore instore.graphOptions.<driver>.imagestore
even if multipleimage stores were configured.
This change replaces the field
<driver>.imagestore
with the field<driver>.additionalImageStores
, that is an array of strings that includes all the configured additional image stores.Fix containers/storage#2094
Does this PR introduce a user-facing change?