Skip to content

overlay: additional layer: check layer existence before using#2108

Merged
openshift-merge-bot[bot] merged 1 commit intocontainers:mainfrom
ktock:additonal-layer-check
Sep 24, 2024
Merged

overlay: additional layer: check layer existence before using#2108
openshift-merge-bot[bot] merged 1 commit intocontainers:mainfrom
ktock:additonal-layer-check

Conversation

@ktock
Copy link
Contributor

@ktock ktock commented Sep 24, 2024

Currently *Driver.get doesn't check existence of additional layers. This result in an unclear error, like mkdir /var/lib/containers/storage/overlay/a4fe7aa552629d15640e70d18b00359e6b58c413ba8aa6c57ec5a63a5742584d/diff: file exists.
This commit fixes that function to check the existence of additional layers before using and return a clear error.

return "", fmt.Errorf("linkpath must be absolute (got: %q)", ld)
}
if checkExistence {
if _, err := os.Stat(ld); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

could you please use fileutils.Exists()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. Fixed to use fileutils.Exists.

Currently *Driver.get doesn't check existence of additional layers.
This result in an unclear error.
This commit fixes that function to check the existence of additional layers
before using and return a clear error.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@ktock ktock force-pushed the additonal-layer-check branch from e646e4e to defaae6 Compare September 24, 2024 20:19
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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, ktock

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Member

rhatdan commented Sep 24, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Sep 24, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit d5fb6c1 into containers:main Sep 24, 2024
@ktock ktock deleted the additonal-layer-check branch September 25, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants