-
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
Improve VM Placement Policy data source for tenant users #948
Improve VM Placement Policy data source for tenant users #948
Conversation
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
go.mod
Outdated
@@ -59,3 +59,5 @@ require ( | |||
google.golang.org/grpc v1.50.1 // indirect | |||
google.golang.org/protobuf v1.28.1 // indirect | |||
) | |||
|
|||
replace github.com/vmware/go-vcloud-director/v2 => github.com/adambarreiro/go-vcloud-director/v2 v2.17.0-alpha.1.0.20221201150414-93ae0f2f6136 |
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.
Please remove this module replacement before you merge this PR,
once you completely finish your code changes and the PR is ready to be merged.
You don't need to resolve this conversation, it will be automatically removed once
go.mod is in a correct state.
Thanks! 😸
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>
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `name` - (Required) The name VM Placement Policy. | ||
* `provider_vdc_id` - (Required) The ID of the [Provider VDC](/providers/vmware/vcd/latest/docs/data-sources/vcd_provider_vdc) to which the VM Placement Policy belongs. | ||
* `provider_vdc_id` - (Required for System admins) The ID of the [Provider VDC](/providers/vmware/vcd/latest/docs/data-sources/provider_vdc) to which the VM Placement Policy belongs. | ||
* `vdc_id` - (Required for tenant users; *v3.8.1+*) The ID of the [VDC](/providers/vmware/vcd/latest/docs/data-sources/org_vdc) to which the VM Placement Policy is assigned. |
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.
This is a generic question/suggestion about "tenant" vs. "org" term across the whole PR docs. Should we use "org users" instead of "tenant users"?
E.g. here:
* `vdc_id` - (Required for tenant users; *v3.8.1+*) The ID of the [VDC](/providers/vmware/vcd/latest/docs/data-sources/org_vdc) to which the VM Placement Policy is assigned. | |
* `vdc_id` - (Required for Org users; *v3.8.1+*) The ID of the [VDC](/providers/vmware/vcd/latest/docs/data-sources/org_vdc) to which the VM Placement Policy is assigned. |
The thought behind this is that "tenant" is more a business term, while inside the CD itself we see "organization".
Comments are welcome!
CC: @dataclouder @Didainius
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.
Either we use provider/tenant
(as it is sometimes appropriate for wide operations guide) or we use System administrator/Org user
.
While I have found the provider/tenant
pair clearer in some contexts, I think that in this case it should be Org users
.
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.
I agree that we could use provider/tenant in "soft" text, while in technical docs we should use System administrrator/Org user.
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.
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
c2ebc30
to
8cb78fa
Compare
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
8cb78fa
to
26287f1
Compare
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
26287f1
to
12c889b
Compare
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
8cac8f2
to
12c889b
Compare
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Closing in favor of #953 as we need to merge conflicts while @adambarreiro is away |
Overview
This PR modifies the
vcd_vm_placement_policy
data source to add a new attribute: vdc_id. This attribute helps tenant users to fetch VM Placement Policies, as they cannot obtainprovider_vdc_id
in any way.With
vdc_id
, they can obtain the VDC identifier from the desired VDC and obtain the assigned VM Placement Policies. If the policies are not assigned, this data source will not find them (which makes sense even looking in UI).As this PR bumps latest Go SDK, in this library it is included a fix that avoids an error when the Provider VDC is backed by many Resource pools (see vmware/go-vcloud-director#530).
Detailed changes
provider_vdc_id
is now optional and conflicts withvdc_id
vdc_id
is a new optional attribute that conflicts withprovider_vdc_id
policyType==VdcVmPolicy
(this one is from v2.0.0 endpoint),isSizingOnly==false
and the vGPU policy filter. Not having these options could have lead to bugs in future.d.SetId("")
which didn't make much sense as the ID was already "" in that conditional branch.Side changes
Tests
Improved
TestAccVcdVmPlacementPolicy
to use the VDC data source (more realistic scenario) and createdTestAccVcdVmPlacementPolicyInVdc
to test the new scenario, partially (as it is run as System Administrator due to the need of creating admin resources, see the test docs for more).A manual test of vcd_vm_placement_policy using only a tenant user is required.
data.vcd_vm_placement_policy
using only a tenant user:Note: policy1 was created and assigned to VDC beforehand
data.vcd_vm_placement_policy
with novdc_id
norprovider_vdc_id
set returnsError: either provider_vdc_id or vdc_id needs to be set