oci2disk: fail fast if the given destinationDevice (via env DEST_DISK…#170
Open
thees wants to merge 1 commit intotinkerbell:mainfrom
Open
oci2disk: fail fast if the given destinationDevice (via env DEST_DISK…#170thees wants to merge 1 commit intotinkerbell:mainfrom
thees wants to merge 1 commit intotinkerbell:mainfrom
Conversation
…) does not exist. otherwise the action waits for a very long time. maybe the os.O_CREATE is not necessary as would fix this, too, see image2disk action. However, checking before opening is a sure fix. Signed-off-by: Sebastian Thees <thees@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…) does not exist. otherwise the action waits for a very long time.
maybe the os.O_CREATE is not necessary as would fix this, too, see image2disk action. However, checking before opening is a sure fix.
Description
Change affects the action oci2disk:
When a DISK_DEST is given which does not exist on the machine, the action tries to open the file and waits for a very long time (maybe indefinitely?).
The change just checks the availability of the given device before opening it.
I noted that the action image2disk just uses the flag os.O_WRONLY in openfile vs. the oci2disk action uses os.O_WRONLY|os.O_CREATE.
However, I just added the check beforehand so that it is safe to use. Maybe there is a reason for the os.O_CREATE flag here.
Fixes: #
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
A wrongly given DISK_DEST fails fast, instead of a hanging oci2disk action.
Checklist:
I have: