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_portgroup_info: failure_detection is reported as 'link_status_only' instead of 'No override' #1886

Open
andrei-marinache opened this issue Oct 20, 2023 · 0 comments · May be fixed by #1895

Comments

@andrei-marinache
Copy link

andrei-marinache commented Oct 20, 2023

SUMMARY

This is related to #1544
There are cases when vim.host.NetworkPolicy.NicFailureCriteria is set, but checkBeacon is unset.
For example, after portgroup creation or after:

get-vmhost -name "esxi_host" | Get-VirtualPortGroup -name "Portgroup_name" | Get-NicTeamingPolicy | Set-NicTeamingPolicy -InheritNetworkFailoverDetectionPolicy $true

In this case, failure_detection is reported as 'link_status_only' instead of 'No override'

Most probaly this can solve it (spec.policy.nicTeaming.failureCriteria.checkBeacon can be unset, true or false)

diff --git a/plugins/modules/vmware_portgroup_info.py b/plugins/modules/vmware_portgroup_info.py
index b94be38..08d7d51 100644
--- a/plugins/modules/vmware_portgroup_info.py
+++ b/plugins/modules/vmware_portgroup_info.py
@@ -162,7 +162,7 @@ class PortgroupInfoManager(PyVmomi):
                 else:
                     pg_info_dict['failover_active'] = spec.policy.nicTeaming.nicOrder.activeNic
                     pg_info_dict['failover_standby'] = spec.policy.nicTeaming.nicOrder.standbyNic
-                if spec.policy.nicTeaming.failureCriteria is None:
+                if spec.policy.nicTeaming.failureCriteria is None or spec.policy.nicTeaming.failureCriteria.checkBeacon is None:
                     pg_info_dict['failure_detection'] = "No override"
                 else:
                     if spec.policy.nicTeaming.failureCriteria.checkBeacon:
ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.vmware.vmware_portgroup_info

ANSIBLE VERSION
ansible [core 2.15.5]
  config file = /Users/amarinache/Stuff/mm/ansible.cfg
  configured module search path = ['/Users/amarinache/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/amarinache/Stuff/mm/ansible/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/amarinache/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/amarinache/Stuff/mm/ansible/bin/ansible
  python version = 3.12.0 (main, Oct  5 2023, 15:44:07) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/Users/amarinache/Stuff/mm/ansible/bin/python3.12)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /Users/amarinache/Stuff/mm/ansible/lib/python3.12/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.5.0
CONFIGURATION
CALLBACKS_ENABLED(/Users/amarinache/.ansible/ansible.cfg) = ['timer', 'profile_roles']
CONFIG_FILE() = /Users/amarinache/.ansible/ansible.cfg
OS / ENVIRONMENT

MacOS 13.5.2, vCenter 7.0U2

STEPS TO REPRODUCE
Get portgroup information with vmware_portgroup_info
  hosts: localhost
  gather_facts: false
  vars:
    errors: []
    all_vlans: []
    host_vlans: {}
  tasks:
    - name: Get ports
      community.vmware.vmware_portgroup_info:
        hostname: 'vcenter.example.com'
        username: '[email protected]'
        password: 'adminpass'
        cluster_name: 'CLUSTER1'
        esxi_hostname: esxi1.example.com
        policies: true
        validate_certs: false
      delegate_to: localhost
      register: pg_info

    - debug:
        var:
          pg_info.hosts_portgroup_info['esxi1.example.com'][0]
EXPECTED RESULTS
ok: [localhost] => {
    "pg_info.hosts_portgroup_info['esxi1.example.com'][0]": {
        "failback": "No override",
        "failover_active": "No override",
        "failover_standby": "No override",
        "failure_detection": "No override",      <-------- this
        "lb": "No override",
        "notify": "No override",
        "portgroup": "PORTGROUP-001",
        "security": [
            "No override",
            "No override",
            "No override"
        ],
        "ts": "No override",
        "vlan_id": 1111,
        "vswitch": "vSwitch0"
    }
}
ACTUAL RESULTS
ok: [localhost] => {
    "pg_info.hosts_portgroup_info['esxi1.example.com'][0]": {
        "failback": "No override",
        "failover_active": "No override",
        "failover_standby": "No override",
        "failure_detection": "link_status_only",      <-------- this
        "lb": "No override",
        "notify": "No override",
        "portgroup": "PORTGROUP-001",
        "security": [
            "No override",
            "No override",
            "No override"
        ],
        "ts": "No override",
        "vlan_id": 1111,
        "vswitch": "vSwitch0"
    }
}
andrei-marinache added a commit to andrei-marinache/community.vmware that referenced this issue Oct 25, 2023
@andrei-marinache andrei-marinache changed the title vmware_portgroup_info: failure_detection is reported as 'link_status_only' insted of 'No override' vmware_portgroup_info: failure_detection is reported as 'link_status_only' instead of 'No override' Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant