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 task manager and collector #2535

Merged
merged 1 commit into from
Sep 3, 2021
Merged

Add task manager and collector #2535

merged 1 commit into from
Sep 3, 2021

Conversation

embano1
Copy link
Contributor

@embano1 embano1 commented Aug 3, 2021

Description

This change introduces a task manager (https://vdc-download.vmware.com/vmwb-repository/dcr-public/8946c1b6-2861-4c12-a45f-f14ae0d3b1b9/a5b8094c-c222-4307-9399-3b606a04af55/vim.TaskManager.html) with support for creating a task history collector.

History collector is moved from object into its own package and changes were made to the event package accordingly (collector logic is shared between task and event manager).

Notes:

  • followed event manager/collector approach
  • won't work against vcsim as the task manager is not implemented there yet (Add task manager to vcsim #2567)
  • moved HistoryCollector from object to its own package to avoid cyclic imports
  • CreateTask method not implemented (not sure if this is useful), can be added later if need to
  • newHistoryCollector not exported since it's merely a helper and does not add value to external API IMHO
    • did same for creating the history collector in the events package

⚠️ BREAKING changes:

event.Manager does not embed object.Common anymore. Only the methods Client() and Reference() were implemented. event.NewHistoryCollector() is now unexported (newHistoryCollector()) as it was merely a helper and to comply with the task manager implementation.

Closes: #2497
Signed-off-by: Michael Gasch [email protected]

Type of change

Please mark options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested example against vCenter 6.7.

Test Configuration:

  • Toolchain:
  • SDK:
  • (add more if needed)

Checklist:

  • My code follows the CONTRIBUTION guidelines of
    this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

@embano1 embano1 requested a review from dougm August 3, 2021 18:20
@embano1 embano1 changed the title Add task manager and collector WIP: Add task manager and collector Aug 5, 2021
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

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

Thanks @embano1 , +1 for adding this. We can probably find a way around the import issue, I'll try to take a look at that soon. I can also help with the vcsim support

@embano1
Copy link
Contributor Author

embano1 commented Aug 6, 2021

That'd be great Doug. No rush, I'm on PTO and will get back to this in a couple of weeks. Pretty sure you have found a workaround by then :)

@embano1
Copy link
Contributor Author

embano1 commented Sep 1, 2021

TODOs:

  • Create issue to add TaskManager in vcsim
  • Add example for TaskManager

@embano1 embano1 changed the title WIP: Add task manager and collector Add task manager and collector Sep 2, 2021
@embano1
Copy link
Contributor Author

embano1 commented Sep 2, 2021

@dougm ready for review. Updated PR notes incl. breaking changes related to the events package.

Something odd I found is that while the EventHistoryCollector returns items sorted in ascending order (by eventID), TaskHistoryCollector returns tasks sorted in descending order (by taskID). I don't see any code differences between the events and task implementation or how to influence this. So pretty sure this is server behavior then?

This change introduces a task manager
(https://vdc-download.vmware.com/vmwb-repository/dcr-public/8946c1b6-2861-4c12-a45f-f14ae0d3b1b9/a5b8094c-c222-4307-9399-3b606a04af55/vim.TaskManager.html)
with support for creating a task history collector.

History collector is moved from object into its own package and changes
were made to the event package accordingly (collector logic is shared
between task and event manager).

BREAKING:

`event.Manager` does not embed `object.Common` anymore. Only the methods
`Client()` and `Reference()` are implemented.
`event.NewHistoryCollector()` is now unexported (to
`newHistoryCollector()`) as it was merely a helper and to comply with
the task manager implementation.

Closes: vmware#2497
Signed-off-by: Michael Gasch <[email protected]>
@dougm
Copy link
Member

dougm commented Sep 3, 2021

Something odd I found is that while the EventHistoryCollector returns items sorted in ascending order (by eventID), TaskHistoryCollector returns tasks sorted in descending order (by taskID). I don't see any code differences between the events and task implementation or how to influence this. So pretty sure this is server behavior then?

Not sure, I've yet to try TaskHistoryCollector, but yes sounds like it's server behavior.

Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @embano1 !

@embano1 embano1 merged commit e49ad93 into vmware:master Sep 3, 2021
@embano1 embano1 deleted the issue-2497 branch September 3, 2021 05:32
dougm added a commit to dougm/govmomi that referenced this pull request Oct 13, 2021
Prior to vmware#2535 both managers implemented mo.Reference via the embedded 'object.Common' field,
but that field was removed.
yuyin002 pushed a commit to yuyin002/govmomi that referenced this pull request Jan 12, 2022
Prior to vmware#2535 both managers implemented mo.Reference via the embedded 'object.Common' field,
but that field was removed.
pradeep288 pushed a commit to pradeep288/govmomi that referenced this pull request Jan 17, 2022
Prior to vmware#2535 both managers implemented mo.Reference via the embedded 'object.Common' field,
but that field was removed.
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.

Is there a few code example for getting task list in datacenter?
3 participants