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
issue when same resource pool name is used in different clusters #39470
Conversation
…different clusters
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) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
@evertmulder Thanks for the fix. |
CI failure in integration test: https://app.shippable.com/github/ansible/ansible/runs/63124/67/tests |
@evertmulder Any news ? |
@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? |
@evertmulder Thanks for the contribution. I will close this in favour of #39792 |
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
COMPONENT NAME
vmware_guest
ANSIBLE VERSION
2.5