Skip to content
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 functions to allow to update Vdc storage profile #340

Merged
merged 22 commits into from
Nov 5, 2020

Conversation

vbauzys
Copy link
Contributor

@vbauzys vbauzys commented Oct 26, 2020

This new function will allow to update VDC storage profile.

  • adminVdc.UpdateStorageProfile
  • fix incorrect types.vdcStorageProfile usage. Create Vdc, update Storage profile and get Storage profile has different types.

Merge branch 'master' of github.com:vmware/go-vcloud-director
Merge branch 'master' of github.com:vmware/go-vcloud-director
Merge branch 'master' of github.com:vmware/go-vcloud-director
# Conflicts:
#	govcd/api.go
#	govcd/api_vcd_test.go
#	govcd/openapi_endpoints.go
#	types/v56/constants.go
#	types/v56/openapi.go
@vbauzys vbauzys marked this pull request as draft October 26, 2020 15:28
@vbauzys vbauzys marked this pull request as ready for review October 27, 2020 06:15
NetworkQuota int `xml:"NetworkQuota,omitempty"`
VmQuota int `xml:"VmQuota,omitempty"`
IsEnabled bool `xml:"IsEnabled,omitempty"`
VdcStorageProfile []*CreateVdcStorageProfile `xml:"VdcStorageProfile"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting confusing. Please add a comment why "CreateVdcStorageProfile" in "VdcStorageProfile".

Copy link
Contributor Author

@vbauzys vbauzys Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was hard to grasp for me too, until I figured out that API uses 3 types or VDC storage profile types which are almost incidental. Some of them need different XML root name. Every type has links to API description type. In general CreateType is used when creating Org VDC - which has less fields, VdcStorageProfile is used for GET and AdminVdcStorageProfile for update.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the explanation as comment in code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where too? all this type are referenced in different locations and every type already has explanation for what it used and reference to API.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we possible call it AttachVdcStorageProfile or something similar. The CreateVdcStorageProfile sounds as if it is going to create a storage profile but in fact it is not (storage profiles are defined in pVdcs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well result will be I have to introduce new functions for createOrgVdc, createOrgVdcType then +4 VdcStorageProfile types and new functions for getStorageProfilHref and everything will be with "silly namings" and deprecate 2 functions. Overall this minimum I recalled in my head. @lvirbalas what to do?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion we renamed to VdcStorageConfiguration to be inline with VdcConfiguration - structs that are used to create the VDC.

@dataclouder do you have an alternative proposal without deprecations? One alternative I can think of is actually leaving old name as is, but adding a suffix or prefix "Read" to the new structs:
VdcStorageProfileRead and AdminVdcStorageProfileRead.

Either way, we need to be consistent with these kind of prefixes going forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we do that, we break get function definitions. So more breakage

Copy link
Contributor

@dataclouder dataclouder Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving old name as is, but adding a suffix or prefix "Read" to the new structs:
VdcStorageProfileRead and AdminVdcStorageProfileRead.

That I could live with. And it would make it possible to deprecate the old one.
Unless I misunderstood the suggestion. "As is" means as it is now or as it was before the PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with VdcStorageProfileConfiguration, just last ask to add breaking changes section to changelog.

Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs a master merge.

NetworkQuota int `xml:"NetworkQuota,omitempty"`
VmQuota int `xml:"VmQuota,omitempty"`
IsEnabled bool `xml:"IsEnabled,omitempty"`
VdcStorageProfile []*CreateVdcStorageProfile `xml:"VdcStorageProfile"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we possible call it AttachVdcStorageProfile or something similar. The CreateVdcStorageProfile sounds as if it is going to create a storage profile but in fact it is not (storage profiles are defined in pVdcs)

@vbauzys
Copy link
Contributor Author

vbauzys commented Nov 4, 2020

Previous comment was a lot more clear. Now it's confusing. Please clarify the comment whether this struct is used for creating VDC.

added

Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@vbauzys vbauzys merged commit 25cf7f3 into vmware:master Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants