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

issue when same resource pool name is used in different clusters #39470

Closed
wants to merge 1 commit into from
Closed

issue when same resource pool name is used in different clusters #39470

wants to merge 1 commit into from

Conversation

evertmulder
Copy link
Contributor

SUMMARY

Fix for issue #38043. Incorrect resource pool can be selected when the same resource pool is used in multiple clusters.

Change: Option to select multiple resource pools that are filtered by cluster when a cluster is provider as parameter.

Fixes #38043.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmware_guest

ANSIBLE VERSION

2.5

@ansibot
Copy link
Contributor

ansibot commented Apr 28, 2018

@ansibot ansibot added 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 Apr 28, 2018
@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 Apr 28, 2018
resource_pool = self.cache.find_obj(self.content, [vim.ResourcePool], resource_pool_name)
if resource_pool is None:
def select_resource_pool_by_name(self, resource_pool_name, cluster=None):
resource_pools = self.cache.find_obj(self.content, [vim.ResourcePool], resource_pool_name, return_list=True)
Copy link
Member

Choose a reason for hiding this comment

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

self.cache contains function get_all_objs which already does this, so we can reuse it directly rather than modifying find_obj

self.module.fail_json(msg='Could not find resource_pool "%s"' % resource_pool_name)
return resource_pool
if cluster:
for resource_pool in resource_pools:
Copy link
Member

Choose a reason for hiding this comment

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

Can we also check the condition where user has provided esxi_hostname?

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't resource pools a vSphere only construct, so they don't exist at the ESXi level? So would it even make sense to check for that condition?

self.module.fail_json(msg='Could not find resource_pool "%s"' % resource_pool_name)
return resource_pool
if cluster:
for resource_pool in resource_pools:
Copy link
Member

@Akasurde Akasurde Apr 29, 2018

Choose a reason for hiding this comment

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

Add condition to check like, because we don't want resource pool which is different than
the user specified name.

             if resource_pool.name != resource_pool_name:
                 continue

@Akasurde
Copy link
Member

@evertmulder Thanks for the fix.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Apr 29, 2018
@mattclay
Copy link
Member

mattclay commented May 2, 2018

CI failure in integration test: https://app.shippable.com/github/ansible/ansible/runs/63124/67/tests

@mattclay mattclay added the ci_verified Changes made in this PR are causing tests to fail. label May 2, 2018
@ansibot
Copy link
Contributor

ansibot commented May 2, 2018

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 10, 2018
@Akasurde
Copy link
Member

@evertmulder Any news ?

@ansibot ansibot added the affects_2.6 This issue/PR affects Ansible v2.6 label May 21, 2018
@evertmulder
Copy link
Contributor Author

@Akasurde Sorry I did not found any time to work on this PR. I am keeping an eye on #39792 what seems to be a better solution overall. It looks to me this PR will also solve the issue. This PR looks promising and a good solution and is passing all tests already... Do you know why this PR is not merged?

@Akasurde
Copy link
Member

Akasurde commented Jul 2, 2018

@evertmulder Thanks for the contribution. I will close this in favour of #39792

@Akasurde Akasurde closed this Jul 2, 2018
@ansible ansible locked and limited conversation to collaborators Jul 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. ci_verified Changes made in this PR are causing tests to fail. cloud module This issue/PR relates to a module. 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.

Bug with two resource pools with same name in different clusters
5 participants