-
Notifications
You must be signed in to change notification settings - Fork 76
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 multiple resource pools issue when fetching VM Groups #530
Merged
Didainius
merged 13 commits into
vmware:main
from
adambarreiro:fix-vm-placement-policy-support
Dec 7, 2022
Merged
Fix multiple resource pools issue when fetching VM Groups #530
Didainius
merged 13 commits into
vmware:main
from
adambarreiro:fix-vm-placement-policy-support
Dec 7, 2022
Conversation
This file contains 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
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
3 tasks
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
dataclouder
approved these changes
Dec 2, 2022
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Didainius
reviewed
Dec 2, 2022
Signed-off-by: abarreiro <[email protected]>
Didainius
approved these changes
Dec 2, 2022
lvirbalas
approved these changes
Dec 5, 2022
dataclouder
approved these changes
Dec 5, 2022
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.
Context
In v2.17.0, more specifically in #504, we introduced the ability to fetch VM Groups from VCD. However, these methods were failing when the Provider VDC had more than one resource pool.
RCA
The buggy functions are
GetVmGroupByNamedVmGroupIdAndProviderVdcUrn
andGetVmGroupByNameAndProviderVdcUrn
. They use a private function calledgetResourcePools
which is the culprit. This function is wrongly assuming that there can be only a single resource pool per Provider VDC.Fix
This PR changes:
getResourcePools
doesn't return error if there is more than one resource pool, as this the natural way of working: A Provider VDC can have multiple Resource pools.filter=(vmGroupName==testVmGroup;(clusterMoref==domain-c12,clusterMoref==domain-c12);(vcId==f583b76e-9e34-48e7-b90d-930653ee1616,vcId==f583b76e-9e34-48e7-b90d-930653ee1616))
Test
To test this, one can create more Resource Pools in the vSphere that serves VCD. In the following image, we have foo and STFTestRootResourcePool:

Once the Resource Pool is created, one can place some VMs there and create a VM Group there. In the following image, we have a VM Group called foo1 with ldap-server VM (in STFTestRootResourcePool resource pool) and VM Group asd with saddasd VM (in foo resource pool)


Ideally, we should have something like the above: some VM Groups locating VMs to different VMs served by different Resource Pools.
After we have some VM Groups, we can configure the target Provider VDC to add the new Resource pool:

Test
Test_VmGroupsCRUD
should pass with this patch and this configuration. Without this fix, it should fail with the error