-
Notifications
You must be signed in to change notification settings - Fork 468
[wip] fix: DiskDiffOperation #2364
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
base: main
Are you sure you want to change the base?
Conversation
For additional clarification: In my environment, I am creating 4 VMs, 3 of them reference existing datastores, the 4th references two newly created datastores (provisioned by the same apply) for a total of 6 disk (sub-)resources. The VMs that reference existing datasources will provision successfully but the fourth referencing the new datastores will fail with the provided error. However, all 4 VMs go through the same section of code referenced, and only the single VM mentioned ends up in the error. I surmise that this piece of code is not necessary and especially in the case of referencing existing datastores is "modified" such that the "diskDatastoreComputedName" is later on updated with the correct values. While this might not be the appropriate fix, in my environment this skirts around the issue and I can provision all 4 VMs without any issues. I hope this helps. |
And to be more clear, in the mentioned scenario, even for the 3 VMs being provisioned that reference an already existing datastore, the dsID = "". |
Lastly, (redacted) debug output has been provided on issue #2363 |
I have updated the description to emphasize that the datastore ID reports as |
Do you have a |
I do have the |
|
I am definitely not suggesting I fixed the root cause of the issue. But to reiterate, 3 of the 4 VMs provisioned will be successful going through the same code path that tests that the |
@mbokman - CI is failing for the build. go: downloading github.com/davecgh/go-spew v1.1.1
# github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice
Error: vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go:685:33: invalid operation: operator ! not defined on ok (variable of type interface{})
FAIL github.com/hashicorp/terraform-provider-vsphere [build failed]
FAIL github.com/hashicorp/terraform-provider-vsphere/vsphere [build failed] Marking as DRAFT until the CI passes and is ready for review. |
@tenthirtyam Apologies, I only now see your update. Understood, I will look into what is failing the CI build, thanks! |
@tenthirtyam Checks are passing now, the problem is/was my unfamiliarity with Go. Who between the two of us is the person to take the PR out of DRAFT? Sorry, still a n00b but only trying to help. |
If this is approved, fingers crossed, please move it to the v2.12.0 milestone. That release would then solve all my current issues 😄 |
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.
Original: Sets nm["datastore_id"]
to diskDatastoreComputedName
if the key is missing or if the value is an empty string.
Modified: Sets nm["datastore_id"]
to diskDatastoreComputedName
only if the key is missing, ignoring empty string values.
Implications
We'll need this think about the potential implications of this change.
Original: Ensures that nm["datastore_id"]
is never an empty string.
Modified: Allows nm["datastore_id"]
to remain an empty string if it is already set to an empty string.
@tenthirtyam I am limited in my capacity (provider/Go knowledge) to help but is there anything that I can perhaps focus on to progress this further? Not asking for detailed instructions, hoping to be helpful on general hints, but no promise. |
I agree with Ryan, this PR changes the semantics behind I will try to elaborate, let's look at the code in its current form
The conditions for this block are
If we look at what
Now here's where it gets interesting - even if Golang has the concept of default values - "" for |
@spacegospod I only now see your comment, thanks for your review. One thing that is not clearly mentioned on the PR, however it is mentioned in the Expected Behavior of the related issue #2362, is that without my change obviously the |
2d0d0cd
to
3ebb159
Compare
Description
Fixes #2363: Creating a new VM using datastores created as part of the same apply would give an error as the following:
Apologies for not creating an acceptance test but I am a n00b to Go and this provider. I am also pretty sure that my "fix" might not be the ultimate solution
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References