-
Notifications
You must be signed in to change notification settings - Fork 467
fix: simultaneous attempts to create parent directories #2366
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: simultaneous attempts to create parent directories #2366
Conversation
2c061b1
to
3a03e78
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.
Hi, @skevir! 👋🏻 The HashiCorp CLA needs to be signed before this pull request can proceed.
3a03e78
to
7a28861
Compare
Thanks - I'm just confirming with my company's legal department that they are happy for me to sign. Once I have that, I will remove the "Draft" status for this PR so that it can proceed. |
Understood! Note that right now the commit is signed-off with your no-reply that does not designate an employer. So be mindful if you need to agree to the CLA as an individual contrinutor or through your employer. Merge: 7a288618 9ad0f32c
Author: skevir <[email protected]>
Date: Mon Mar 31 17:03:54 2025 +0100 |
a09bfcd
to
564536d
Compare
2d0d0cd
to
3ebb159
Compare
564536d
to
76e98e9
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.
@skevir the diff looks good!
Can you please sign your last commit and mark the PR as ready (non-draft)
eb6b166
to
8c55aee
Compare
9984ae7
to
d770398
Compare
Handles `fm.MakeDirectory` failing when creating parent directories for a virtual disk. Signed-off-by: skevir <[email protected]>
d770398
to
02a05f0
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
Description
This PR fixes the functionality that attempts to cope with a directory already existing when creating the parent directories for a
vsphere_virtual_disk
resource. For VSAN datastores it has been observed that multiple simultaneous attempts to create the same parent directories can result in vSphere reporting errors.A previous attempt to fix this (under #639) appears to be flawed, in that the error message the functionality is triggered off is actually slightly different to what the code is written to expect. Additionally, there is different error that is sometimes hit in the same scenario, and the original fix didn't handle that case at all.
To capture both of these cases, as well as any other errors that might be seen in the future, I have changed the implementation to ignore the error hit when attempting to create the parent directories and use the existing functionality that performs a post-check that the directory now exists to determine if the creation was successful.
Testing
I have installed a fixed version of the provider and tested the following. In all case I have performed the test both in the case when the directory doesn't already exist, as well as when it does:
count
field on a single resource definition in the Terraform config file.In the cases that would have previously failed (that is, when the directory didn't already exist) I have confirmed, by looking at the debug logs, that errors were reported when trying to create the directories for some of the vsphere_virtual_disk resources to verify that the bug fix was being invoked.
Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Closes #2309
PR for previous fix attempt: #639