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 guest properties support for vm and vapp #235

Merged
merged 25 commits into from
Aug 29, 2019

Conversation

Didainius
Copy link
Collaborator

@Didainius Didainius commented Aug 26, 2019

Both VMs and vApps allow to set guest properties which are useful for configuration (when guests support it).
This PR adds SetGuestProperties SetProductSectionList and GetGuestProperties GetProductSectionList for vm and vapp objects which allow to manipulate guest properties

@Didainius Didainius added the enhancement New feature or request label Aug 26, 2019
@Didainius Didainius self-assigned this Aug 26, 2019
@Didainius Didainius requested review from vbauzys, lvirbalas and dataclouder and removed request for vbauzys and lvirbalas August 26, 2019 09:24
govcd/guestproperties.go Outdated Show resolved Hide resolved
govcd/guestproperties.go Outdated Show resolved Hide resolved
govcd/guestproperties.go Outdated Show resolved Hide resolved
govcd/guestproperties.go Outdated Show resolved Hide resolved
govcd/vapp_vm_test.go Show resolved Hide resolved
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.

Pretty sweet. Only question is how will the property updates be implemented on the Terraform side? Is the idea that an update of a single property in the list will cause the whole guest property struct to be re-set?

@Didainius
Copy link
Collaborator Author

Only question is how will the property updates be implemented on the Terraform side? Is the idea that an update of a single property in the list will cause the whole guest property struct to be re-set?

Yes. The idea is that whatever is set in terraform it will apply "as a whole" as in PR (https://github.com/terraform-providers/terraform-provider-vcd/pull/319) in line https://github.com/terraform-providers/terraform-provider-vcd/pull/319/files#diff-dad616393369ab476ae585e64e0c9e4dR1258

There is no mechanism to set "one by one" and even if there was - such method is way quicker than setting 100 properties in "one by one" fashion.

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!

CHANGELOG.md Outdated
@@ -22,6 +22,8 @@
* Added methods `AdminOrg.GetVDCByName` and related `GetVDCById`, `GetVDCByNameOrId`
* Added methods `AdminOrg.GetAdminVDCByName` and related `GetAdminVDCById`, `GetAdminVDCByNameOrId`
* Added methods `Catalog.Refresh` and `AdminCatalog.Refresh`
* Added methods `vm.SetGuestProperties` and `vm.GetGuestProperties` [#235](https://github.com/vmware/go-vcloud-director/pull/235)
* Added methods `vapp.SetGuestProperties` and `vapp.GetGuestProperties` [#235](https://github.com/vmware/go-vcloud-director/pull/235)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Structure has been renamed, but change log entry left old.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I knew I had to miss it somewhere while renaming. Fixed.

// SetProductSectionList sets product section for a vApp
//
// The slice of properties "ProductSectionList.ProductSection.Property" is not necessarily ordered or returned as set before
func (vapp *VApp) SetProductSectionList(productSection *types.ProductSectionList) (*types.ProductSectionList, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add a sentence - a hint - that this product section represents guest properties in all comments of the four public functions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo in "maniapulate", sounds funny though :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@dataclouder dataclouder left a comment

Choose a reason for hiding this comment

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

LGTM

@Didainius Didainius merged commit 4d3f810 into vmware:master Aug 29, 2019
@Didainius Didainius deleted the guest-properties branch August 29, 2019 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants