-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add Provider VDC and VM Group data sources, VM Placement policies resource+data source and support for VM Placement policies in VDCs #904
Merged
adambarreiro
merged 102 commits into
vmware:main
from
adambarreiro:add-vm-placement-policies
Sep 23, 2022
Merged
Add Provider VDC and VM Group data sources, VM Placement policies resource+data source and support for VM Placement policies in VDCs #904
adambarreiro
merged 102 commits into
vmware:main
from
adambarreiro:add-vm-placement-policies
Sep 23, 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 <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
adambarreiro
changed the title
Add VM Placement policies support
Add Provider VDC data source, VM Placement policies data source and support for VM Placement policies in VDCs
Aug 29, 2022
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
dataclouder
suggested changes
Sep 15, 2022
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.
Some small changes needed
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
dataclouder
approved these changes
Sep 15, 2022
terraform-provider-vcd-bot
added
test-running:acc
test-failed:acc
and removed
test-request:acc
test-running:acc
labels
Sep 15, 2022
lvirbalas
reviewed
Sep 15, 2022
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
lvirbalas
approved these changes
Sep 19, 2022
terraform-provider-vcd-bot
added
test-running:acc
test-error:acc
and removed
test-request:acc
test-running:acc
labels
Sep 21, 2022
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
9 tasks
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.
This PR solves issue #898.
This PR requires vmware/go-vcloud-director#502 and vmware/go-vcloud-director#504.
Context
The goal is to solve #898. To achieve that, we need to handle references to VM Placement Policies in a new attribute
vm_placement_policy_ids
in the VDC resources and data sources. As we don't have that mechanism, we need a new data source to fetch them:vcd_vm_placement_policy
. At same time, to fetch these VM Placement Policies we need a reference to its associated Provider VDC, as one can have same name VM Placement Policies belonging to different Provider VDCs, hence a new data sourcevcd_provider_vdc
is also required.For the sake of automating the testing of all of these, the
vcd_vm_placement_policy
resource has been implemented as well. To create them we also need thevcd_vm_group
data source which is also created in this PR.That's why this PR adds so many things (the three mentioned data sources + new resource + new attribute in VDC), as they are part of the same story.
Features and improvements
vcd_org_vdc
deprecatesdefault_vm_sizing_policy_id
because the name is incorrect, as this attribute is currently holding Sizing Policies, Placement Policies or vGPU Policies. A new attributedefault_compute_policy_id
has been added to replace it, which represents a more accurate behaviour (A Compute Policy is a superset of the three types mentioned).The idea is also that the logic considers
default_vm_sizing_policy_id
as a fallback ofdefault_compute_policy_id
if the latter is not populated. This can be done as they hold the same value (in the end is just the name which is incorrect).vcd_org_vdc
has a new attributevm_placement_policy_ids
to support VM Placement policies of the corresponding VDC.New data source
vcd_vm_placement_policy
to fetch VM Placement Policies given a name and a Provider VDC URN.New resource
vcd_vm_placement_policy
to create VM Placement Policies given a name, a Provider VDC URN and a set of VM groups or Logical VM Groups.As previous data source requires a Provider VDC URN, a
vcd_provider_vdc
data source has been added to fetch this. Now pVDCs can be obtained with a name.New data source
vcd_vm_group
to fetch VM Groups to be used to create VM Placement Policies.Minor refactors
ifIdIsPartOfSlice(id string, ids []string) bool
from resource_vcd_org_vdc.go to structure.go as it is an generic/utility function, changed its name and signature tocontains(sliceToSearch []string, searched string) bool
which is more readable.vcd_org_vdc
part that handles Compute Policies and reduce duplicated code, with not much luck.Testing
Tests require a new field in vcd_test_config.json:
vcd_vm_group
data source.vcd_provider_vdc
data source.vcd_vm_placement_policy
resource and data source.vcd_org_vdc
with VM Sizing Policies, VM Placement policies and playing with the default Compute Policy