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 additional filters to nsxt_policy_vms data source #794

Closed
m-garrido opened this issue Sep 28, 2022 · 3 comments · Fixed by #869
Closed

Add additional filters to nsxt_policy_vms data source #794

m-garrido opened this issue Sep 28, 2022 · 3 comments · Fixed by #869
Assignees
Labels
duplicate Duplicate enhancement Enhancement

Comments

@m-garrido
Copy link

m-garrido commented Sep 28, 2022

Describe the bug

In a multi-site NSX-t environment with vSphere replication/SRM in order to protect some VMs, "nsxt_policy_vms" resource only returns one entry for a replicated VM.
A replicated VM from one site creates another VM in a second site with the same name as "placeholder". The "nsxt_policy_vms " resource returns an "items" dictonary based on display_name key. So, two VMs with same name is not possible. Therefore, it returns sometimes the wrong one. Depends on the order in NSX-t VMs inventory.
It would be nice to add some filters like :

  • VM power state
  • Compute Manager
  • Location ID

With thoses filters, we can force the resource to return only the expected VM.

Reproduction steps

  1. Add two vcenters to nsx-t manager. Each one in a separate site.
  2. Replicate a VM from one site to another. Or, create 2 VMs with same name.
  3. Use "nsxt_policy_vms" resource in order to retrieves all VMs.

Expected behavior

Returned dictonary contains two VMs with the same name.

Additional context

No response

@m-garrido m-garrido added the bug Bug label Sep 28, 2022
@annakhm
Copy link
Collaborator

annakhm commented Oct 21, 2022

Hi @m-garrido, as you mentioned, this data source is defined by providing a map between display name and a certain type of VM id (single value), so by definition, it can not present two VMs with same name. What it can do, however, is fail the data source in case there are two VMs with same. Would you find this useful?

@m-garrido
Copy link
Author

m-garrido commented Nov 4, 2022

Hello @annakhm, thanks for the help.
I already know that a dictionary cannot have the same key twice. The aim of my issue is to report an incompatibility for this "data resource" when we use "vSphere replication". I think, VMware developpers can enhanced it by adding another filters like thoses i suggested for example. It would be nice. Just adding a filter for the state should fix that.

@annakhm annakhm added enhancement Enhancement and removed bug Bug labels Nov 29, 2022
@annakhm annakhm changed the title nsxt_policy_vms resource not returning multiple VMs with same name Add additional filters to nsxt_policy_vms data source Nov 29, 2022
@annakhm
Copy link
Collaborator

annakhm commented Nov 29, 2022

Thanks @m-garrido, that makes sense. I've updated issue title to reflect the ask.

@annakhm annakhm self-assigned this Apr 6, 2023
@annakhm annakhm added the duplicate Duplicate label Apr 6, 2023
@annakhm annakhm linked a pull request Apr 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate enhancement Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants