You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A data "nsxt_policy_vm" block will intermittently fail to find VMs in large (1k+) VM environment. Despite the VM existing it returns with:
Error: Error while reading Virtual Machine <GUID>: Could not find Virtual Machine with ID: <GUID>
The error happens intermittently across GUIDs.
Reproduction steps
Have more than 1k VMs
Loop over a terraform plan for a document with a data "nsxt_policy_vm"
Eventually it will fail with Could not find Virtual Machine with ID: <GUID>
Expected behavior
Existing VM with a given ID is found.
Additional context
Tested with NSX-T 3.2.3.
The root cause of this appears to be an inconsistency in how VMs are returned from /policy/api/v1/infra/realized-state/virtual-machines endpoint when the order is not specified with sort_order. When sort_order is not set the results come back in an inconsistent order between calls which breaks the pagination. This can be tested in a large environment with a (roughly) static set of VMs:
a.json and b.json should have the same VMs in the same order, but without sort_order that is not always the case. Please note that it can take quite a few calls to trigger the inconsistency. As the result of this, the slice of VMs that comes back from listAllPolicyVirtualMachines will contain duplicated VMs and will also be missing VMs. Setting the sort order resolves this problem and I will follow up with a PR to add that.
The text was updated successfully, but these errors were encountered:
This PR adds external_id as the sortByParam for calls to the realized VM
endpoint. This is needed in larger environments (1k+ VMs) because as of
NSX-T 3.2.3 the /policy/api/v1/infra/realized-state/virtual-machines
endpoint is not respecting a consistent ordering by default. This means
that the internal slice representing VMs returned from
listAllPolicyVirtualMachines may include duplicates and may be missing
VMs that actually exist. Explicitly setting an order forces consistent
results across the paginated calls.
Resolves: vmware#1193
This PR adds external_id as the sortByParam for calls to the realized VM
endpoint. This is needed in larger environments (1k+ VMs) because as of
NSX-T 3.2.3 the /policy/api/v1/infra/realized-state/virtual-machines
endpoint is not respecting a consistent ordering by default. This means
that the internal slice representing VMs returned from
listAllPolicyVirtualMachines may include duplicates and may be missing
VMs that actually exist. Explicitly setting an order forces consistent
results across the paginated calls.
Resolves: vmware#1193
Signed-off-by: Paul Zerkel <[email protected]>
Describe the bug
A
data "nsxt_policy_vm"
block will intermittently fail to find VMs in large (1k+) VM environment. Despite the VM existing it returns with:The error happens intermittently across GUIDs.
Reproduction steps
terraform plan
for a document with adata "nsxt_policy_vm"
Could not find Virtual Machine with ID: <GUID>
Expected behavior
Existing VM with a given ID is found.
Additional context
Tested with NSX-T 3.2.3.
The root cause of this appears to be an inconsistency in how VMs are returned from
/policy/api/v1/infra/realized-state/virtual-machines
endpoint when the order is not specified withsort_order
. Whensort_order
is not set the results come back in an inconsistent order between calls which breaks the pagination. This can be tested in a large environment with a (roughly) static set of VMs:a.json
andb.json
should have the same VMs in the same order, but withoutsort_order
that is not always the case. Please note that it can take quite a few calls to trigger the inconsistency. As the result of this, the slice of VMs that comes back fromlistAllPolicyVirtualMachines
will contain duplicated VMs and will also be missing VMs. Setting the sort order resolves this problem and I will follow up with a PR to add that.The text was updated successfully, but these errors were encountered: