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

vmware_guest: assign device keys from a sequence generator #57994

Closed
wants to merge 3 commits into from
Closed

vmware_guest: assign device keys from a sequence generator #57994

wants to merge 3 commits into from

Conversation

lparkes
Copy link
Contributor

@lparkes lparkes commented Jun 18, 2019

SUMMARY

This PR adds a new class which contains a staticmethod that generates a sequence of integers for use as temporary client defined keys. I'm not convinced that the current system of ranges of random numbers will cope with assigning keys to disks and disks will need keys when we start using storage policies.

I'm using this PR to help discuss what we want to do.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmware_guest

ADDITIONAL INFORMATION
  1. The most important thing is assigning keys to disks. The storage policy API doesn't work if keys aren't specified even though the API doesn't refer to the keys directly.
  2. I kind of like the staticmethod for generating keys because it makes keys that look like the keys made by the VMware client.
  3. I don't care at all what class the staticmethod is part of and there is no good reason for making the new class PyVmomiKeyHelper.

for use with the VMware API.

Switch all of the current vApp and device code that uses VMware API
keys to use this new helper.

Add keys from this help to all disk devices. This will be needed later
for Storage Policy support.
@ansibot
Copy link
Contributor

ansibot commented Jun 18, 2019

@ansibot
Copy link
Contributor

ansibot commented Jun 18, 2019

@lparkes, just so you are aware we have a dedicated Working Group for vmware.
You can find other people interested in this in #ansible-vmware on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community labels Jun 18, 2019
@ansibot
Copy link
Contributor

ansibot commented Jun 18, 2019

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest.py:612:1: E302 expected 2 blank lines, found 1

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jun 18, 2019
@lparkes lparkes changed the title 02.0Add a helper class called PyVmomiKeyHelper that creates unique keys vmware_guest: assign device keys from a sequence generator Jun 18, 2019
@lparkes
Copy link
Contributor Author

lparkes commented Jun 18, 2019

I don't recall saving this PR last night. That could easily have been kitten assisted and I have tidied up the text and I'll look at the pep8 failure now.

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jun 19, 2019
def next_key():
PyVmomiKeyHelper.current_key -= 1
return PyVmomiKeyHelper.current_key

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea, but I'm not sure you need a class for that. e.g:

>>> def foo():
...     if hasattr(foo, 'cpt'):
...         foo.cpt +=1
...     else:
...         foo.cpt = 0
...     return foo.cpt
... 
>>> foo()
0
>>> foo()
1
>>> foo()
2

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jun 20, 2019
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jun 28, 2019
@ansibot ansibot added collection Related to Ansible Collections work collection:community.vmware needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this Aug 16, 2020
@ansible ansible locked and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bot_closed bug This issue/PR relates to a bug. cloud collection:community.vmware collection Related to Ansible Collections work module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_contributor This PR is the first contribution by a new community member. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants